Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I just started using Gamemaker Studio and so far it seems fairly intuitive. However, I set a room to "Room is Physics World" and set gravity to 10. I then enabled physics on my player object and created a block object to match a platform on my background sprite.

I set up a Collision Detection event for the player and the block objects that sets the gravity to 0 (and even sets the vspeed to 0). I also put a notification in the collision event and I don't get that either. I have my key down and key up events working well, moving the player left and right and changing the sprites appropriately, so I think I understand the event system.

I must just be missing something simple with the physics. I've tried making both and neither of the objects "solid". Pretty frustrating since it looks so easy.

The player starting point is directly above the block object in the grid and the player does fall through the block. I even made the block sprite solid red so I could see it (initially it was invisible, obviously).

share|improve this question
    
I disabled the room graphics and with the block set to solid he does fall until he hits it and stops. However, he is a couple pixels above the block and movement no longer works. –  Scott Beeson Oct 16 '12 at 4:35
    
I have not used Gamemaker in a long time, so I'll just comment about what I think might be happening. You mention that the player end up a couple pixels (let's say 5) above the block he should be colliding with. This is likely because the physics system is trying to move your character more than 5 pixels downward, and when it realizes it's colliding with the block, it simply moves it back to its previous position. This may also be causing it to ignore any other movement commands. I wouldn't know where to go from there in Gamemaker, but it's worth investigating. Hope that helps :) –  ktodisco Oct 16 '12 at 5:00
    
I reduced the gravity so that the player falls very slowly (has to be 1 pixel at a time) and I still see the same results. It was a good idea though :) –  Scott Beeson Oct 16 '12 at 15:52
    
Maybe the player isn't blocked 5 pixels above, but he is 'bumped' there, after collision? –  Markus von Broady Oct 16 '12 at 17:39
add comment

1 Answer

up vote 1 down vote accepted

Okay I technically answered the original question. I had to create a collision detection event for the block as well as the player. I didn't put any action in other than a comment. Now he falls and lands as you would expect.

In short, you need the following: 1. Room Physics enabled 2. Player and Block object physics enabled 3. Collision events for BOTH player > block and block > player.

The only problem is, once the player lands the left/right movement doesn't work, but that's for another question...

share|improve this answer
    
Can you tell me what had to be done to allow movement? –  carny666 Nov 13 '12 at 0:43
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.