Jump to content


Photo

Jumping + Four Way Movement... (solved)


  • This topic is locked This topic is locked
9 replies to this topic

#1 Kit630

Kit630

    GMC Member

  • New Member
  • 156 posts

Posted 07 January 2007 - 09:02 PM

-EDIT- Wow, all it took was one simple timeline and about three lines of gml in a step event.... How did I NOT think of this XD



Hey folks, thanks in advance for reading this.

I'm making a game engine similar to a Double Dragon, Littlefighter 2, River City Ransom style game. Four directional movement and jumping and fighting.

I have the four dimensional movement down pat, I have the fighting moves fine. The only thing I can't get is how to do the jumping. In each of these games, the character jumps in a certain direction, either straigh up, left, or right. Once in the air, they cannot change movement until they land.

I have tried everything from paths, variables, trying to remember the last y of the player object and when the jump object with gravity hits that y it stops as if it collided with a solid object and turns back into the player, thus seeming to jump and land and not fall off screen. I had even animated a really crappy jump sprite to fake it.

The first two things don't work properly, and the animation of a jump is too ick...

I guess I'm looking for some kind of code for an object to arch from point A to point B. Since this is not really a platform but 4 dimensions.

..............____..........
............./........\ .......
.........../............\......
point A ------------ point B.

Any ideas?

Edited by Kit630, 11 January 2007 - 01:15 AM.

  • 0

#2 Beeks

Beeks

    GMC Member

  • New Member
  • 177 posts

Posted 07 January 2007 - 09:09 PM

I'd make a variable like "Jump=0". Set it to 1 when you jump.

In your directional movement, check to see if Jump=1 first, and if it does, exit. That way, if you're jumping, nothing works as far as the user's ability to change direction until you land.
  • 0

#3 Kit630

Kit630

    GMC Member

  • New Member
  • 156 posts

Posted 07 January 2007 - 09:30 PM

I'd make a variable like "Jump=0". Set it to 1 when you jump.

In your directional movement, check to see if Jump=1 first, and if it does, exit. That way, if you're jumping, nothing works as far as the user's ability to change direction until you land.

<{POST_SNAPBACK}>


Sorry, I wasn't clear enough. It's not the jumping part that I'm having trouble with, it's the landing. The character can move up, down, left, and right. When I press jump, gravity is activated. Then the character archs towards a point just like in a platformer. In a platformer however, it is the solid object collision that stops the player on the platform. In my example, there is no such thing to stop you. This is what I'm trying to figure out how to do :3

Posted Image
  • 0

#4 Kit630

Kit630

    GMC Member

  • New Member
  • 156 posts

Posted 07 January 2007 - 09:31 PM

Gosh it's probably something simple that I just can't think of x_x
  • 0

#5 th15

th15

    GMC Member

  • GMC Member
  • 1566 posts

Posted 07 January 2007 - 09:47 PM

Instead of storing a y value and stopping at that point, use a pair of alarms. One alarm would change the gravity direction, the 2nd would turn gravity off again.

Edited by th15, 07 January 2007 - 09:48 PM.

  • 0

#6 Kit630

Kit630

    GMC Member

  • New Member
  • 156 posts

Posted 07 January 2007 - 09:52 PM

Instead of storing a y value and stopping at that point, use a pair of alarms. One alarm would change the gravity direction, the 2nd would turn gravity off again.

<{POST_SNAPBACK}>



Thanks, I'll try that next :3 I appreciate the idea
  • 0

#7 Kit630

Kit630

    GMC Member

  • New Member
  • 156 posts

Posted 07 January 2007 - 10:21 PM

Anyone have any other ideas, in the meantime?
  • 0

#8 Kit630

Kit630

    GMC Member

  • New Member
  • 156 posts

Posted 07 January 2007 - 10:27 PM

Instead of storing a y value and stopping at that point, use a pair of alarms. One alarm would change the gravity direction, the 2nd would turn gravity off again.

<{POST_SNAPBACK}>



Thanks, I'll try that next :3 I appreciate the idea

<{POST_SNAPBACK}>


I think this will work well once I tweek it correctly :3
  • 0

#9 Venomblood

Venomblood

    1=2

  • New Member
  • 378 posts

Posted 08 January 2007 - 02:53 AM

In the same part of the code that makes it jump, do this:

yyy=y
jump=1

Then in the step:

if jump=1
if yyy<y || yyy=y{
gravity=0
y=yyy
speed=0
}

In the create event:

yyy=y
jump=0

Edited by Venomblood, 08 January 2007 - 02:56 AM.

  • 0

#10 Kit630

Kit630

    GMC Member

  • New Member
  • 156 posts

Posted 09 January 2007 - 03:59 AM

In the same part of the code that makes it jump, do this:

yyy=y
jump=1

Then in the step:

if jump=1
if yyy<y || yyy=y{
  gravity=0
  y=yyy
  speed=0
}

In the create event:

yyy=y
jump=0

<{POST_SNAPBACK}>





It works to a point. Enough that I can definately build upon it. There are some pieces missing but I am filling in the blanks :3
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users