Jump to content


Photo

Ledge grabbing help


  • Please log in to reply
6 replies to this topic

#1 argenisxd

argenisxd

    GMC Member

  • New Member
  • 18 posts

Posted 07 August 2011 - 04:47 PM

so basically im making a metroid fan game (yay!) any way im having problems with samus(the player) hanging from the edge of a block? like and edge or a corner idk how to explain something like this
http://metroid.retropixel.net/metroidzm/review_sprite_05.gif
i couldnt really find any other picture anyway ive tried position_meeting,place_meeting, making an object that stays on samus arm and if it collides with another object it does the hanging procedures. so far the last one has worked BUT the sprite still goes down everything and i switched off gravity and the vspeed, i even tried making samus 'Y' value equal the edge 'Y' value

things ive tried:

player step event:
if (global.ledgeGrab = 1)
{
gravity = 0
vspeed = 0
mJump
sprite_index = spr_hangR
}



method #2

obj_hangBlock collision event.
obj_samus.gravity = 0
obj_samus.vspeed = 0
obj_samus.y = obj_hangBlock.y
obj_samus.sprite_index = spr_hangR

method #3

obj_samus step event
if (position_meeting(x+11,y-4,obj_hangBlock)
{
obj_samus.gravity = 0
obj_samus.vspeed = 0
obj_samus.y = obj_hangBlock.y
obj_samus.sprite_index = spr_hangR
}


please help me ive tried lots of things and only one has partially worked...any help will be appreciated maybe even ur name will be in credits :)
  • 0

#2 argenisxd

argenisxd

    GMC Member

  • New Member
  • 18 posts

Posted 07 August 2011 - 04:49 PM

anddd i forgot to mention i looked on youtube and the forums and still no luck
  • 0

#3 Ruririn

Ruririn

    GMC Member

  • New Member
  • 9 posts

Posted 07 August 2011 - 05:04 PM

Hi Argenisxd,

You may want to consider printing the value of your "ledgegrab" / samus vspeed etc. variables to the screen or otherwise tracing them so you can make sure the game is actually attempting the grab. (Do you see your samus sprite change to "spr_hangR"?)

Where in this sequence does natural gravity / vspeed changes affect Samus? Even if the grab is taking place, you may be changing Samus' vspeed back to a state of falling each step.
  • 0

#4 argenisxd

argenisxd

    GMC Member

  • New Member
  • 18 posts

Posted 07 August 2011 - 06:54 PM

Hi Argenisxd,

You may want to consider printing the value of your "ledgegrab" / samus vspeed etc. variables to the screen or otherwise tracing them so you can make sure the game is actually attempting the grab. (Do you see your samus sprite change to "spr_hangR"?)

Where in this sequence does natural gravity / vspeed changes affect Samus? Even if the grab is taking place, you may be changing Samus' vspeed back to a state of falling each step.

well i see samus sprite change "sometimes" only if it hits the box origin? which is 0,0 but it doesnt get stuck there it falls down to the ground and i cant do nothing at all not even move
  • 0

#5 Ruririn

Ruririn

    GMC Member

  • New Member
  • 9 posts

Posted 07 August 2011 - 10:40 PM


Hi Argenisxd,

You may want to consider printing the value of your "ledgegrab" / samus vspeed etc. variables to the screen or otherwise tracing them so you can make sure the game is actually attempting the grab. (Do you see your samus sprite change to "spr_hangR"?)

Where in this sequence does natural gravity / vspeed changes affect Samus? Even if the grab is taking place, you may be changing Samus' vspeed back to a state of falling each step.

well i see samus sprite change "sometimes" only if it hits the box origin? which is 0,0 but it doesnt get stuck there it falls down to the ground and i cant do nothing at all not even move




What about my other question, where in your script is "natural gravity" taking place? You could consider enclosing that in a conditional statement so the normal downward movement of objects doesn't apply if ledgegrab is true.
  • 0

#6 argenisxd

argenisxd

    GMC Member

  • New Member
  • 18 posts

Posted 09 August 2011 - 06:01 PM

Gravity takes place in the step event.
If (place_free(x,y+1) and ledgeGrab == 0))
{gravity = 0.5}
Else
{Gravity = 0}
I have the player press down so ledgeGrab would equal 0 but no luck either the hanging doesn't work or when it does pressing down wnt work at alll
  • 0

#7 dark_half

dark_half

    GMC Member

  • New Member
  • 8 posts

Posted 02 March 2012 - 01:53 PM

Ledge Hang Tutorial
This video may help, or at least get you started, worked for me
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users