Tut Request: Character moving
Posted: Sun Sep 04, 2011 2:35 pm
Hi,
I'm hust a beginner with flash, and I can't realy understand on how to move the character around the map smoothly. (hero1 is a ball).
I used to move all the scene:
and I used
but with no difference. What i want is to make it moving on the scene smoothly like it's here: viewtopic.php?f=28&t=1623
I'm hust a beginner with flash, and I can't realy understand on how to move the character around the map smoothly. (hero1 is a ball).
I used to move all the scene:
- Code: Select All Code
stage.addEventListener(KeyboardEvent.KEY_DOWN, checkArrow3);
stop();
function checkArrow3(e:KeyboardEvent):void
{if ((e.keyCode==37)) {
this.x+=5;
hero1.x-=5; }
else if ((e.keyCode==39)) {
this.x-=5;
hero1.x+=5; }
}
and I used
- Code: Select All Code
stage.addEventListener(KeyboardEvent.KEY_DOWN, checkArrow3);
stop();
var rect:Rectangle;
rect = new Rectangle(0,0, 1024, 768);
this.scrollRect = rect;
stop();
function checkArrow3(e:KeyboardEvent):void
{
if ((e.keyCode==37)) {
rect.x-=10;
hero1.x-=10;
this.scrollRect = rect;
}
else if ((e.keyCode==39)) {
rect.x+=10;
this.scrollRect = rect;
hero1.x+=10;}
but with no difference. What i want is to make it moving on the scene smoothly like it's here: viewtopic.php?f=28&t=1623