• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

GameMaker Physics in room

D

Den_er_da_hvid

Guest
I was just quicly sketching out some game ideas.
One was a platform game and to speed up the progress I just wanted to use the inbuild physics engine to do gravity (for jumping and falling)... So I thought. I couldt get it to work.

I have swiched on physics in the room, the player object and the floor object. I moved the objects into same Layer. The floor Density is set to 0 so I will not fall. But my player cant move left/right at all when the physics engine in turned on.

Do anyone have a tutorial for this?
I found some youtube videos and followed but nope
 

Jezla

Member
The physics system is not ideal for making platformers, especially if you want to do a quick prototype, as it requires some careful setup and uses a completely different set of functions. It would probably be easier to plug in conventional platformer code; there are several examples out there, Shaun Spalding's being one of the best-known.

You neglect to mention how you are coding your player's movement. Are you applying a force or impulse, or are you trying to set the speed? The latter won't work with physics turned on. In addition, I've found that it's best to set up the physics system in GMS2 by defining the world and fixtures entirely in code, rather than ticking the check boxes in the object editor. I'm not sure why that is, but I've had better results that way.
 
M

Matt Hawkins

Guest
The box2d physics engine is one of the best features of game maker. Imo it's far easier to use than code for movement and collisions. You can most certainly make a good platform game using physics if you spend some time learning how it works. I'm making this with box2d physics
 
R

Rukiri

Guest
Game Maker Uses Box2D, however, I do not know if Game Maker uses kinematic body, rigid body, or static body types for objects and I'm not aware you can set them...
Every 2D platformer has been using simulated physics, so a wind effect would push the player back by 0.5 or 1-2 pixels making it appear as if he's being pushed back.

Sonic, on the other hand, I feel probably used some sort of physics, but there are Sonic Engines here that use simulated physics.

I haven't read the docs much on physics but it appears that access to all features of box2D might not be there or not easily accessible.
 

rIKmAN

Member
Game Maker Uses Box2D, however, I do not know if Game Maker uses kinematic body, rigid body, or static body types for objects and I'm not aware you can set them...
You can set an object as kinematic in the Physics section of the Object Properties
  • Kinematic: There will be certain instances in a physics based game which you want to move around but do not wish to be acted on by forces such as gravity, nor forces incurred by collisions with dynamic objects (think of moving platforms in a platform game, for example). For such objects simply setting the density of the fixture to 0 will mean that the physics will assume that the object is intended to be static and it will not react at all to anything. However, checking this box will make a static object kinematic and although it will be unaffected by collisions and gravity, it can still be moved around or rotated using the appropriate variables.
Sonic, on the other hand, I feel probably used some sort of physics, but there are Sonic Engines here that use simulated physics.
Check out this Sonic Physics Guide, it has some good info.
 

jms

Member
The box2d physics engine is one of the best features of game maker. Imo it's far easier to use than code for movement and collisions. You can most certainly make a good platform game using physics if you spend some time learning how it works. I'm making this with box2d physics
Yes Matt, i like physics too and awesome game you made, mario vibes !!
I was wondering what physics_world_update_speed you use.
I had 60 or 120, but now i am testing (240) <- check out that one 240!! yes since i will have FPS240 as FPS so automatically physics speed is set to minimum room_speed
 
Top