Jump to content


Photo

Block Collision + Character Problem


  • Please log in to reply
3 replies to this topic

#1 PepChwartz

PepChwartz

    GMC Member

  • New Member
  • 2 posts
  • Version:GM8

Posted 31 May 2012 - 12:00 AM

Hello,

I'm a very new programmer, as well as an inexperienced user in game maker (just a heads-up). In my game, blocks are controlled by certain keyboard keys, and once pressed that block moves to a new location. A problem I've encountered is: I've set the blocks to be solid so that my character cannot pass through them. With that setting I also made it so that collision with the block and character sets the the character's horizontal speed to 0. When, for instance, I press the DEL key to raise a block, and once I press it again (so it comes back to its original location) the block is able to land on the character's head, but because of the previous collision setting I created, the character is not able to get out from beneath the block.

Is there anything I can do to fix this?
Hopefully I was descriptive enough.

Thanks!
  • 0

#2 Lemon Flavor

Lemon Flavor

    The Helpful Lemon

  • GMC Member
  • 135 posts
  • Version:GM8

Posted 31 May 2012 - 12:11 AM

So do you want to check to see if the player is in the location the block is going to move and if it is, stop the movement?

if place_free(newlocation_X,newlocation_Y)
{
x=newlocation_X
y=newlocation_Y
}

Is that what you want?
  • 0

#3 PepChwartz

PepChwartz

    GMC Member

  • New Member
  • 2 posts
  • Version:GM8

Posted 31 May 2012 - 05:45 AM

So do you want to check to see if the player is in the location the block is going to move and if it is, stop the movement?

if place_free(newlocation_X,newlocation_Y)
{
x=newlocation_X
y=newlocation_Y
}

Is that what you want?


Is that supposed to go under a step event in a character?

I think what I need is for the game to check if the character is beneath the block, and if so, somehow allow the character to continue moving.
  • 0

#4 Lemon Flavor

Lemon Flavor

    The Helpful Lemon

  • GMC Member
  • 135 posts
  • Version:GM8

Posted 31 May 2012 - 06:41 PM

The original code I meant for you to use in the block in the delete key, the code will stop the block from moving back if it will land on the character.
  • 1




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users