Stick Page Forums Archive

Need help with ActionScript !

Started by: grass_master92 | Replies: 7 | Views: 664

grass_master92
2

Posts: 14
Joined: Jun 2009
Rep: 10

View Profile
Dec 10, 2009 1:17 PM #522852
Hi, I'm trying to make a game with Flash 8 where a character moves with the arrow keys, like in GTA 2:
Left and right keys rotate the character, and up and down keys moves the character forward and back...

I would appreciate some help with the code, since I am a noob with AS.

Thanks ;|
grass_master92
2

Posts: 14
Joined: Jun 2009
Rep: 10

View Profile
Dec 10, 2009 9:37 PM #522920
Please Help!!!!!!!!
Scorpioxxx
2

Posts: 1,454
Joined: Apr 2006
Rep: 10

View Profile
Dec 10, 2009 11:12 PM #523006
With what? I'm not going to give out scripts I made but I'll correct yours if you have any. If you don't, google "basic AS2 movement" since that's what you will be using with flash 8 and what you want to do.
The Dude
2

Posts: 1,526
Joined: Dec 2007
Rep: 10

View Profile
Dec 11, 2009 2:03 AM #523052

onClipEvent (enterFrame) {
if (Key.isDown(Key.UP)) {
_y -= 10;
}

if (Key.isDown(Key.DOWN)) {
_y += 10;
}

if (Key.isDown(Key.LEFT)) {
_x -= 10;
}

if (Key.isDown(Key.RIGHT)) {
_x += 10;
}
}



I wrote it up for you, just for you. Feel special, and very special at the fact you can't google something.
grass_master92
2

Posts: 14
Joined: Jun 2009
Rep: 10

View Profile
Dec 11, 2009 4:59 PM #523324
Thank you very much RazrBlade. Next time I will google it, but I forgot cos I was high...
I will post the game when finished.

Maybe I will google it... The ActionScript you wrote doesn't make the character rotate.
Scorpioxxx
2

Posts: 1,454
Joined: Apr 2006
Rep: 10

View Profile
Dec 11, 2009 6:45 PM #523326
I'll give you a hint, AS uses rotation like the trigonometry layout, ie, right is 0, up is 90, left is 180 and down is 270. Using these values you should be able to guess what you need to do. And Razr's code will work for movement but i recommend you change the value 10 for a variable (for example, add a variable speed = 10 to the frame AS and relace the 10s with the word speed) makes it a whole lot easier to change things if you needed to by allowing you to just change the 'speed = number' part to change the speed in all directions.
grass_master92
2

Posts: 14
Joined: Jun 2009
Rep: 10

View Profile
Dec 11, 2009 11:30 PM #523418
Thanks Scorpio, I'll try to make the code.
The Dude
2

Posts: 1,526
Joined: Dec 2007
Rep: 10

View Profile
Dec 12, 2009 12:20 AM #523452
You wanted it to rotate?
>.>
I'm gonna cut you.
Website Version: 1.0.4
© 2025 Max Games. All rights reserved.