Jump to content

Make Particles collide with floor in a Topdown-Game


Deesr
 Share

Recommended Posts

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

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

Uh my bad, I wasn't aware of the term "topdown game".

I thought it was a vertical platformer :ph34r:.

 

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...