Collsion best practices?

0 favourites
  • 4 posts
From the Asset Store
Best car suspension with spring effect and very cool terrain generation.
  • Hi,

    Searched through the tutorials and How To forums but couldnt find exactly what I was looking for.

    Is there an existing post, or could someone add to this one as to best practices for collision masks.

    I have created a platform game that has 100 odd platforms all on one layer as a background image. For this I have created a white block, and then on its own layer continually resized the block to form all the stage collisions, and set it to invisible on start. Is this a good way to do collisions? Is there a more runtime freindly way? What about overlapping collision blocks, is this an issue and what should I be weary of?

    Thanks in advance

  • It sounds like what you have done is fine. The less objects you use and the less points in the collision polygon, the better performance will be, but that's about it.

  • I've used the method you describe without problems.

    If your background image gets too big, you might want to break it apart. The tiled background is more efficient than sprites, so use it if you can.

    Don't forget about parallax effects. You might want your background broken into several layers so that you can take advantage of it.

    You do have to be careful of putting moving objects, like a player or enemy with platform behavior, in positions where they can get stuck inside of solid objects.

    For this reason, the platformer behavior works much better if it is applied to an invisible sprite object that has the animated sprite pinned to it (or moved along with it) rather than applying the platform behavior directly to the moving sprite, with its changing collision masks that could get stuck inside a platform.

    Ashley's How to make a platform game tutorial is a useful resource.

    Another awesome feature is the ability to change angle of gravity. Sqiddster takes this to the ultimate, as described in How to make a gravity-based platformer

    Just a start. I'm sure others can add to this.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Thanks for the replies, I had issues with sticking on sheer walls (using wall jump and sort of slide, not got it right yet), but realised it was because my blocking volumes werent at 90 degrees, so sorted now.

    Kittiewan I ran through that tutorial when starting, invaluable. I have as you said set up a seperat collision sprite for character, and also a seperate sprite with physics pinned for physics interactions, works great. I loved Sqiddsters game, will try and incorporate gravity shifts in, makes a uniquely fun element to the game.

    For my game I have created a 3d stage, and although complicated to work out which layer pieces of the scene should go on, it looks great! Looking forward to getting gameplay elements in to show it and see what people think.

    I have a question about tiling. I have put a background layer of stars (for paralax) Then 2 more layers for platforms (for 3d look). My stage is around 5000x5000 pixels. As you say this is too big to run well, and wont display in some browsers (mobile in particular). What is the best way to split into tiles? Would I just use photoshop (my mainstay app) to cut into say 1024x1024 tiles and then just line them up in Construct 2? If so what is the best way to get perfect alignment? And how will this effect how the level is displayed and accessed by resources?

    Thanks all

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)