help w/ ACTUAL MOVING Character Control (UP, DOWN, LEFT, RIGHT)
I understand:
how to make a movie clip jump to a position on a key movement
how to make a movie cilp jump to another spot when it rolls over another mc. eg a boat over a wave
but I am looking for something a little more. I would like it to be:
When you press up, down, left, or right, rather than have the mc "jump" to a specific spot.
when the charachter mc goes over a "wave" mc, it "moves" (not jumps) the charachter movieclip in a certain direcion.
Could I use a tween, an acionscript for movement (ir there is one)? I have tried many things, but it gets ever so complicated. Please help!!
Here is a short summary of the game:
the charachter moves around w/ the (up, down, left, right, ) keys
when the charachter mc (the boat), goes over a "wave" mc, the boat should push the boat a little distance
If you have ever played the little puzzle in pokemon red/blue, where you walk around, and certain tiles move you up down left right, this is exactly lke that
and No, I dont play pokemon anymore! Just my little brother does!
If you would like the file, please email me.
Last edited by stillfunny2u; 02-27-2004 at 11:42 AM.
Thie is what I have for my actionscript on the boat:
onClipEvent (enterFrame) {
//when the user presses 'up', the boat goes up
if(Key.isDown(Key.UP)) {
if(direction=="up"){
this._y -=36;
}
else {
this._rotation=0
direction = "up";
}
}
// added _rotation modifier- so it looks like it is going up or down when you press the arrows
//when the user presses 'down', the boat goes down
if(Key.isDown(Key.DOWN)) {
if(direction=="down"){
this._y +=36;
}
else {
this._rotation=180
direction = "down";
}
}
//when the user presses 'left', the boat goes left
if(Key.isDown(Key.LEFT)) {
if(direction=="left"){
this._x -=36;
}
else {
this._rotation=270
direction = "left";
}
}
//when the user presses 'right', the boat goes right
if(Key.isDown(Key.RIGHT)) {
if(direction=="right"){
this._x +=36;
}
else {
this._rotation=90
direction = "right";
}
}
}
This is pretty much what you have, exept mine has
this._x, not _x;. I want the user to be able to tap up, then have the boat, MOVE, up, not just go "dun!" and make it just jump.
that is a frame rate problem you have there. -36 is quite a lot, and i guess you have the standard frame rate of 12. change the frame rate to 30 or 40 and the _x+=5. then it will look smoother.
Edit: aha, tilebased. forget what i said. i think tonypa has some stuff on this. i came up with a way to do it though:
i mean, maybe on the first frame have a movieclip, then have a tween. then when you press up, it plays the movie moving the movieclip? but how could it move to a different spot each time? I want the mc to move to _x+36, not just in an instant be there.
Originally posted by stillfunny2u just one tiny little problem, how do i know whats going on so that I can edit it, like if I wanted to make more waves?
Just a quick question did you just copy and paste that code or did you actually write it out?
And I cant really say how to add more waves without actually knowing how you make waves in first place. You only posted the movement code.
These are my questions:
[list=1][*]What does the "s" variable do?[*]How did you change it to "xs" and "ys"?[*]What does the "pos" variable mean?[*]If I wanted to add more "waves", how would I do so? (I guess I probably could figure that one out myself, if I understood how it all worked)[/list=1]
Just for some background info, this is going to be used for a puzzle in a game I am making. The game is a rpg/puzzle game inspired by Myst, Mystery of Time and Space (MOTAS), and The Curse of Monkey Island.
When I finish the entire game(which at the rate I'm going, will be when I'm 60), I will post it in the forums.
One more thing, if you don't want to answer this you don't have to:
What kind of position are you in that you can just be on your computer all day long, answering requests like mine?
(believe me, I would die for that life )
Oh yeah, one more "one more thing", Thanks again, for all that you have done to help me!!
1) the s variable is the speed you want the boat to move at. thei higher it is, the faster the boat moves, but the more it "jumps"
2) it wasnt hard chanign it to xs and ys
3) pos is just for checking if the boat has traveled far enough. there are 36 pixels between one tile and the next, so when pos==36, it is at the next tile and the moving should be stopped.
4) good question. i would sugest using a 2d array and learning tilebased game making. hunt down tonypa for that
xs and ys is the speed and the direction controler. if xs is positive, it will move to the right and if it isnt, it will move to the left. if ys is positive, it wil move down, and if it isnt, it will move up.