Jump to content


Photo

Making A Character Jump


  • Please log in to reply
9 replies to this topic

#1 Iceman Etika

Iceman Etika

    GMC Member

  • New Member
  • 31 posts

Posted 10 August 2008 - 09:31 PM

I have a character in my game, and this character has movement ability in all directions as an object, however, I also want to be able to make my character jump as well by using the jumping sprites I have for it... How can I do this with D&D? And if it can't be done with D&D, then please explain it veeeeeeery slowly in code, I'm trash at code, I don't know the first thing about it, thanks...

Also, the game is isometric, so I would need him to be able to jump in all 8 directions as well...

NEW: Here is the beta of my game so far, for a first hand look at what I'm working with.


-Iceman

Here is the objects info too (my char)

Information about object: Sonic Idle Right

Sprite: Sonic Idle Right
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent: <no parent>
Mask: Char Mask

Step Event:
execute script Diagnal 2? with arguments (0,0,0,0,0)

End Step Event:
set variable depth to -y

Collision Event with object **** Ben Inc.:
start moving in directions 000010000 with speed set to 0

Collision Event with object BORDER:
start moving in directions 000010000 with speed set to 0

Collision Event with object Rec Block:
start moving in directions 000010000 with speed set to 0

Key Press Event for <Left> Key:
set the sprite to Sonic Run Left with subimage 0 and speed 1
start moving in directions 000100000 with speed set to 5

Key Press Event for <Up> Key:
set the sprite to Sonic Run Right with subimage 0 and speed 1
start moving in directions 000000010 with speed set to 1

Key Press Event for <Right> Key:
set the sprite to Sonic Run Right with subimage 0 and speed 1
start moving in directions 000001000 with speed set to 5

Key Press Event for <Down> Key:
start moving in directions 010000000 with speed set to 1
set the sprite to Sonic Run Right with subimage 0 and speed 1

Key Release Event for <Left> Key:
start moving in directions 000010000 with speed set to 0
set the sprite to Sonic Idle Left with subimage 0 and speed 1

Key Release Event for <Up> Key:
set the sprite to Sonic Idle Right with subimage 0 and speed 1
start moving in directions 000010000 with speed set to 0

Key Release Event for <Right> Key:
start moving in directions 000010000 with speed set to 0
set the sprite to Sonic Idle Right with subimage 0 and speed 1

Key Release Event for <Down> Key:
set the sprite to Sonic Idle Right with subimage 0 and speed 1
start moving in directions 000010000 with speed set to 0

Edited by Iceman Etika, 11 August 2008 - 02:59 PM.

  • 0

#2 Iceman Etika

Iceman Etika

    GMC Member

  • New Member
  • 31 posts

Posted 11 August 2008 - 03:02 PM

Better explaination added, and am willing to accept very detailed script explainations, but be gentle, gml is foreign to me X_X
  • 0

#3 Iceman Etika

Iceman Etika

    GMC Member

  • New Member
  • 31 posts

Posted 12 August 2008 - 09:01 PM

Does no one know how? =(
  • 0

#4 pyrotek7x7

pyrotek7x7

    GMC Member

  • New Member
  • 961 posts

Posted 12 August 2008 - 09:14 PM

There have been lots of questions exactly like this one. Try searching.

The basic idea is to make a variable that replaces your conventional "y" variable, making a fake vertical coordinate.
  • 0

#5 Iceman Etika

Iceman Etika

    GMC Member

  • New Member
  • 31 posts

Posted 12 August 2008 - 10:12 PM

Yeah that explanation was reeeeeeeeal helpful. I have searched for the two days of not having my question answered, and I could not find anything that detailed jumping on an isometric field. Maybe someone can point me to an example or a tutorial perhaps. And I checked out the ones on the YoYo site, especially number five, they only detail jumping for sidescrollers, I found nothing that helps with isometric style. Thanks.

-Iceman
  • 0

#6 fegge

fegge

    GMC Member

  • New Member
  • 169 posts

Posted 12 August 2008 - 10:15 PM

wouldn't that be exactly the same as jumping in any other platform game? :whistle: or am i stupid now? ;)

make a "z" var or something.. maybe...
  • 0

#7 8-BitTonberry

8-BitTonberry

    GMC Member

  • GMC Member
  • 646 posts
  • Version:GM:Studio

Posted 12 August 2008 - 10:26 PM

What he means by making a variable to replace the 'Y'...

If you look at isometric as if it is 3D, 'Y' would be vertical, like, in the air, and 'Z' would pretty much be how far back the player is.

So, you would need to make a variable that defines what would normally be 'Y'. For example...

'height' could be your variable. 'height' could be 10 at his max height, 0 at ground level.

So, back to the 2D world...
'Y' is vertical, so to make the character appear to be jumping, you would have to subtract your 'height' variable from 'Y', and maybe add a shadow or something to give a greater sense of depth.

Umm, you would have to do the same sort of thing with the 'height' variable as you would for gravity in a platform game.
  • 0

#8 coolsmile

coolsmile

    Programmer

  • New Member
  • 1346 posts

Posted 12 August 2008 - 10:33 PM

Put the two together ;)
Make a "z" var as fegge said an add that to your y variable when you draw the sprite :)

Try this:
In the create event:
Make a variable named z
Make a variable named zspeed

In the step event:
Add gravity to the zspeed variable
Then chech if the z variable is less then zero set the z variable to 0 & the zspeed variable to 0
Add the zspeed to z

In the draw event:
Use the draw sprite dnd object and set the x to x and y to y-z

I would reccomend trying to learn code, it can be much faster :whistle:
  • 0

#9 Katuko

Katuko

    GMC Member

  • GMC Member
  • 5687 posts

Posted 12 August 2008 - 10:37 PM

What I would do is that whenever you move, your "ground coordinates" (at least the Y), are stored. When you jump, add a certain amount to Z. 0 means you're on the ground. The object should be placed at (X,Y+Z), so if you move while jumping, the position will be updated accordingly. Make platforms by giving them a Z variable too, and if your Y+Z is larger than their Z, subtract their Z from your Y and Z.

EDIT: Beaten. Twice. I need to read the topics more...

Edited by Katuko, 12 August 2008 - 10:38 PM.

  • 0

#10 Iceman Etika

Iceman Etika

    GMC Member

  • New Member
  • 31 posts

Posted 12 August 2008 - 11:08 PM

Man... I'm sorry but I'm just not getting this one bit at all... But, i've seen it done plenty of times from other examples, and it always seemed like code made everything smoother as well, so I am going to attempt to learn it, thank you all for your help on this issue though, but I guess D&D can't be used for everything.

-Iceman
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users