ID:163590
 
I'm trying to make a game like a MegamanX game and I need to know some things. Mainly what I need it a way to jump. So far, all I have made is a jumping icon so that when you press up, you jump up. BUT! You always stay floating in the air. I need a way so that when you press UP you go up say maybe two or three squares and then a couple seconds later, you start to go back down.

Thanks in advance!
Look up step() and related procs.
In response to Abhishake
There is a lib on this somewhere, it has the jump verb and sidescroller system.

- Miran94
In response to Miran94
I'm not sure if this is the lib you're talking about but here it is:
http://developer.byond.com/hub/Loduwijk/KeyState
Side scrollers are too advanced for beginners like you, since BYOND wasn't built for them (though you can still manage them). First read the DM Guide and other beginner resources and experiment in making 'native' top-down games so you learn the language.
In response to Monkeykid0049
That library is no longer needed, BYOND 4.0 supports those functions natively.
In response to Ol' Yeller
OK. First of all, I AM and MAY BE a beginner, but I think that my knowledge of coding is good enough to make a 2d sidescroller. In fact! All I really need to make it is a way to only go up 2 or 3 sqares when I jump and then go down about 2 seconds later. If I JUST had that code then I think I could do it. It really doesn't seem too hard even with my knowledge of coding. Also, I can't look at the demos because my internet won't let me. So maybe the nice guy who gave me the demo instead of telling me I can't do it could tell me what the demo says. Sorry I can't read the demo! ALSO! I do what what step() is. I just don't know how to use it to fit my needs. Maybe you could tell me?
In response to Moocow696
Moocow696 wrote:
...If I JUST had that code then I think I could do it...

a quick-n-dirty method would be to develop a simple gravity algorithm that 'pulls' your character back down to the 'ground' after a jump. unfortunately there is no one *code* just for that. there is probably a half-dozen ways to implement it, depending on your needs. searching through gamedev.net will give you some ideas.

..It really doesn't seem too hard even with my knowledge of coding...

i suspect you are *not* at the point in your skills to determine that just yet. otherwise you would not be asking.

... Also, I can't look at the demos because my internet won't let me...

then how do you post on the forums? if you can post here, then you can search the forums, the hub, and gamedev.net for 2D scroller tutorials.
In response to digitalmouse
I am able to post on the forums and I can SEARCH for demos but if I try to open them it won't let me. This is for unknown reasons and it is annoying. I would be doing a lot more searching for demos for these questions instead of posting all of them if I could. Also, my knowledge of coding may be pretty weak but I have already started to make the side scroller game and it is already looking good AND possible with no problems coming up except for the one that I asked. It IS TRUE that if I solved this one problem I might not make the game of my dreams BUT a side scroller is possible. I am very good at finding my own ways to make code or even just the icons on the map work to my advantage to make a game. I have made TWO (poorly drawn) successful games already and I'm ready to move on to a side scroller. I think you guy underestimate how easy it is if you use your good'ol brain and not just the code that others give you.
In response to Moocow696
Sorry for the double post but I was just writing to tell you that I FIGURED IT OUT ON MY OWN!!! BOOYAA! I just made all the space above where you stand have a density of one so that you can't jump by pressing NORTH. Then I made a jump verb which brings your usr.density to 0 so you can jump through it. then I put step(usr,NORTH) two times and then step(usr,SOUTH) two times after those with sleep(10) inbetween all of them. Then at the end I bring my density to 1 so you have to click the verb to jump again! HA HA HA I figured it out!
In response to Moocow696
I don't want to burst your bubble, but that solution sounds potentially buggy, at least the density part. Can you use a can_jump variable that prevents the jump verb from executing if set to 0? Then you could set it to 0 when the jump executes and reset it to 1 after a second or two. Clear as mud? I thought so.
In response to Ulfhednar
Yea it is buggy but it works. Your solution sounds better though.
There are a bazillion demos that do this if you just search around on the hub a little bit.