View Full Version : How do I make my guy stop flying?
ImCannon
02-19-2005, 08:47 AM
Hello, I'm new to flash an I've been trying to do a game with a figure jumping and running and such... I've been able to get him to move with the arrow keys and jump with space. Now the problem is that I can't get him to stop flying up in the air as long as I press space. How do I make it possible for him only to reach a certain heigth from his starting location and then sink down to the "ground" again without letting go of space?
Lost ?
02-19-2005, 08:56 AM
Could you please post the current ActionScript you are using. I think you might need to use some physics which I can help you with :D :D
ImCannon
02-19-2005, 09:06 AM
Sure... Here it is:
Key.addListener(watchKeyBoard);
StageWidth = 600
StageHeight = 400
Ground = 300
function moveStuff() {
if (Key.isDown(Key.LEFT)) {
this._x -= 7;
}
if (Key.isDown(Key.RIGHT)) {
this._x += 7;
}
if (Key.isDown(Key.SPACE)) {
this._y -= 30;
}
else (Key.isDown(Key.SPACE))
{ this._y += 15;
}
if (this._y>Ground) {
this._y = Ground;
}
if (this._y>Ground) {
this._y = Ground;
}
if (this._x>stagewidth+(this._width/2)) {
this._x = 0-(this._width/2);
}
if (this._x<0-(this._width/2)) {
this._x = stagewidth+(this._width/2);
}
}
gubbe_mc.onEnterFrame = moveStuff;[/CODE]
Lost ?
02-19-2005, 09:24 AM
Ok. This (http://www.prospects-web.com/platform.php) tutorial will teach you physics. Its great and its realistic aswell :D :D
Hope it helps :D
ImCannon
02-19-2005, 09:35 AM
thnx very much!
ImCannon
02-19-2005, 09:48 AM
takes a very long time to load... :-(
ImCannon
02-19-2005, 10:51 AM
hmm... Is there any other tutorial on this matter? Couse this one doesn't work for me for some reason...
Lost ?
02-19-2005, 09:38 PM
You may need to rearrange the ActionScript for it a bit. Ill look for a tut thats more straight forward. Oh yeah are you running MX or MX2004 or 5?
ImCannon
02-20-2005, 08:49 AM
Im running MX... is the 2004 version neccesary?
Lost ?
02-20-2005, 09:05 PM
No I have MX...
ImCannon
02-21-2005, 04:02 PM
hmmm... it's weird cause I can't seem to get it to work, and I don't mean with the actionscript... I mean with the whole tutorial, I can read like two pages of it and then it ends... Really weird.
Lost ?
02-22-2005, 07:40 AM
Here, Ive built my own example in MX format. Its took me a few hours to do but it looks pretty cool :D :D
Hope you find it useful :D
ImCannon
02-22-2005, 07:54 PM
great everything seems to work noe... Thanks for all your help!
Lost ?
02-22-2005, 08:21 PM
No problem :D :D :D
G3M3NI
03-06-2005, 10:16 AM
Not bad physics Lost ?. I use the same ones myself. The problem is if you put multiple platforms, or if he falls from a really high spot, he just goes straight through the ground!! :confused:
I think he picks up 2 much velocity :confused: :confused:
Anyone know how to fix this?
rippazinc
03-28-2005, 02:56 PM
set an if statement depending on the y (you know, like if y is 0 then...) shouldnt be too hard, i'll do it myself if u want
G3M3NI
04-02-2005, 07:44 AM
Here, Ive built my own example in MX format. Its took me a few hours to do but it looks pretty cool :D :D
Hope you find it useful :D
Wait a minute... I built that file originally... Where did you get it... are you unreal2003champion...???? :mad: :)
|
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.