Deesr Posted January 21, 2014 Share Posted January 21, 2014 Hello,I'm working on a Top-Down Multiplayer Arena Shooter, and I ran into some issue with the emitter. Every time the player shoots, it drops a gun-shell. This gun-shell basicly falls out of the screen and thats it. But what i want is that the shell drops a few pixel and then bounces of the "floor" (which is hard to define, because its a Top-Down game). It also would be cool if the shell could stay there once it's done falling. The hard part for me is, that the "floor" isn't really a fixed Tile because it should get calculated from the players position (when fired). Is that possible without too much struggle? Link to comment Share on other sites More sharing options...
Pixelguy Posted January 22, 2014 Share Posted January 22, 2014 I don't understand what you intend to say here? the "floor" isn't really a fixed Tile because it should get calculated from the players position (when fired). Why don't you write:game.physics.collide(gunShellGroup, floorGroup); Link to comment Share on other sites More sharing options...
Pert Posted January 22, 2014 Share Posted January 22, 2014 It might need a bit of messing about, but here's how I would go about it (which probably is how Pixelguy was hinting you should do it ?).Every time you create or reuse a shell, because it's been fired, you save floor level Y coordinate using player position with it, it might be a bit higher or lower than that, depending on how your player is positioned.In update method, for every visible and active gun shell, if they drop below (or above, I think top left corner is 0:0, right?) said Y level, you multiply Y velocity with -1, and I think physics calculations should take care of the rest? Link to comment Share on other sites More sharing options...
Pixelguy Posted January 22, 2014 Share Posted January 22, 2014 Uh my bad, I wasn't aware of the term "topdown game".I thought it was a vertical platformer . I would emit an empty shell though the emitter and give it the players x & y velocity + some exrta y velocity to make the shell "drop".Set the shellEmitter.gravity = 0; to prevent the shell from falling out of the world.Maybe add a "bouncing/sping" animation and collide it with every wall/obstace you have on the map. I hope it helps but it's always easier if you post some code to work with or a screenshot of your map. I could provide a simple example when I'm home if you need one. Link to comment Share on other sites More sharing options...
Recommended Posts