Quite lost!

I’m quite lost here. I need some help. I know my flash, but not my actionscripting.

I’m trying to build a simple game for a design assignment thats due in soon.

My dilemma is to build a page where the dinosaur rolls from left to right (by keyboard command), simultaneously trying avoiding falling rocks.

I have built two movies so far, one which allows the dino to roll right, and the other to the left. They are of frame by frame animation.

I have also added the actionscripting to the dino thats rolling right:

onClipEvent (load) {
moveSpeed = 10;
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.RIGHT)) {
this._x += moveSpeed;
}
}

thats about as far as i got.

I need help on how i can allow the dino to roll right and left, using the left and right arrows on the keyboards.

Cheers

Anniebelle.

I’m not sure i understasnd you. Since you already have the code there for the right, won’t it work for the left? or am i missing something :-\

oh ok…
its quite hard to explain it without actually demostrating it.
Basically. when i press the left arrow, i want the dino to move left, and right when i press the right arrow.
for example: if i was to start pressing right, and then switch to left, i want the dino to move left from where i had left it off…
confused?
refer to webpage for file:
http://www.our-emails.freeservers.com/dino.swf
please note that there should really be one dino playing at a time.

Cheers

Anniebelle

I have never tried to use keys before.

but i would try something like this

a movie with 3 frames

frame 1 has your move left loop
frame 2 has your standing still loop
frame 3 has your moving right loop

onClipEvent (enterFrame) {

?.onKeyUp > go to frame 2

else

if (Key.isDown(Key.RIGHT)) go to frame 3

else

if (Key.isDown(Key.LEFT)) go to frame 1

}

Sorry if this doesn’t help much…
if you had attached your file…

[AS]
onClipEvent (enterFrame) {
if (Key.isDown(Key.RIGHT)) {
_root.dino.play();
_root.dino._x += moveSpeed;
} else {
_root.dino.stop()
}
if(Key.isDown(Key.LEFT)){
_root.dino.play();
_root.dino._x -= moveSpeed
} else {
_root.dino.stop();
}
}
[/AS]

I’m kinda in a hurry so i’m writing this fast without actually thinking well. Gotta go !

ummm… maybe im making it alot complicated than it really should be by animating it frame by frame and having two movies, instead of 1.
Let’s try again, shall we!
how would i make the dino rotate in circles (both clockwise and anti closewise), and simultaneously move left (anticlockwise) and right (clockwise) to keyboard commands?

This should get you starting :wink:

Thanks Voetsjoeba!
That’s mad, its working now!

Cheers

Anniebelle.

Glad to help :beam: