Jump to content


Photo

Where Do I Put This


  • Please log in to reply
7 replies to this topic

#1 NoPlay

NoPlay

    GMC Member

  • New Member
  • 177 posts

Posted 25 November 2009 - 06:40 AM

Hiya guys i have this code but i have no idea witch event to put it in



here is the code
if (keyboard_check_pressed(vk_up) and place_free(x,y+1)){	vspeed = -4;}

its ment for the Jumping part of Jumping code, i found it over the net but it dosent tell me witch event, I've tried Every event that it should be in but it dosnt work.
  • 0

#2 Marinerfan

Marinerfan

    GMC Member

  • New Member
  • 482 posts

Posted 25 November 2009 - 06:42 AM

Step event.
  • 0

#3 NoPlay

NoPlay

    GMC Member

  • New Member
  • 177 posts

Posted 25 November 2009 - 07:13 AM

Ok

I dont know what i did different but its working now, But one more question, I can continue jumping with out touching the ground first....why? and how do i fix it
  • 0

#4 Marinerfan

Marinerfan

    GMC Member

  • New Member
  • 482 posts

Posted 25 November 2009 - 07:18 AM

Because it will allow you to do so as long as place_free(x,y+1), Try it as !place_free(x,y+1) and see how it works (meaning, it will only jump if the place below you is NOT free, i.e. you are standing on a solid).
  • 0

#5 NoPlay

NoPlay

    GMC Member

  • New Member
  • 177 posts

Posted 25 November 2009 - 07:44 AM

THANKS IT WORKED

One more question, sorry for all the questions but

I have a moveing Platform and when the player gets on it the player should taval along with the platfor right

Well mine dosent it just falls off while the platform is moving side to side
  • 0

#6 Yal

Yal

    Gun Princess

  • Global Moderators
  • 5813 posts
  • Version:GM8.1

Posted 25 November 2009 - 11:23 AM

You should use some code doing this:

if (there's a platform below me){
   do the stuff preventing me from falling trough it;
   if that platform happen to be a moving platform{
	   jump to a position equal to the platform's horizontal speed.
   }
}

Edited by Yal, 25 November 2009 - 11:24 AM.

  • 0

#7 NoPlay

NoPlay

    GMC Member

  • New Member
  • 177 posts

Posted 25 November 2009 - 11:54 AM

i dont think that code will work
  • 0

#8 KittenMarie

KittenMarie

    GMC Member

  • New Member
  • 38 posts

Posted 25 November 2009 - 02:53 PM

It will depend on how you move your player. I don't know how your codes work but you have to make it so that when the player has the moving platform below them the platform moves the player at the same speed it's moving. I change the x position of the player....
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users