• 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!

How do you make enemy objects fly in a physics enabled room?

N

Noah J Dunbar

Guest
Hey guys and gals, My game is a very basic 2d 2 player fighting game, where if a player's health is dropped bellow 40 flying enemies spawn and attack the player. With the object not physics enabled, i got it to spawn and rotate, except a lot spawned on top of each other and it never actually moved towards the player, and when physics was enabled the enemy object would just stay still and suspended in the air, not rotating.
I was wandering if you lot can help, this is my first game so I'm basically just doing trial and error to fix a problem and it's taking ages. Thanks in advance

best
Noah
 
M

Mr Ed

Guest
If you're using physics, you have to make things work in a (more or less) physically correct way.

That means you shouldn't (generally) move things around by changing their positions or rotations. Rather, you change their position by applying forces or impulses to them, and you change their rotation by applying torques to them. Just like in real life.

So, in your game, if you want to make things fly, you'll need to apply forces to keep them up in the air.

But, if this is a very basic 2d fighter then you probably don't need to use the actual physics engine, just moving things around manually would be fine. And much much simpler!
 
R

Ryusui

Guest
Yeah, like, if your goal is to make a game like Street Fighter 2, the built-in physics engine will be more a hindrance than a help. You'll be actively fighting it to make it do what you want, and I speak from personal experience.

Turn the physics off, and move your objects manually. You'll have a much easier time of things.
 
N

Noah J Dunbar

Guest
thanks guys, i just created a path and lowered the enemy object density to 0. Thank you though for all these answers, will use them in the future, so thanks!
 
Top