Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Creating a 2D platformer engine

  • 25-05-2013 12:27pm
    #1
    Moderators, Category Moderators, Computer Games Moderators Posts: 52,383 CMod ✭✭✭✭


    So I'm thinking about making a 2D platformer engine and I just need a little help in the logic involved. It's going to be smooth scrolling and tile based.

    What I'm getting is that for each step in the program I should be checking an array of all created objects, including the platform tiles, for collisions with the players bounding box. Now as these tiles are moved off screen they will be deleted out of memory and the array will need to be updated while new tiles will be created and added to the array.

    Am I going about this the right way, seems like an awful lot of collision checks to make and also how do I go about updating the array of objects that are in paly as they say?


Comments

  • Registered Users, Registered Users 2 Posts: 7,814 ✭✭✭TPD


    I haven't made an engine in code, so bear with me. If it's tile based, couldn't you keep a reference to each tile in a 2d array, then only check collisions with the tiles in a one or two tile area around the player?


  • Registered Users, Registered Users 2 Posts: 3,945 ✭✭✭Anima


    You could use Box2D to manage that for you no?


  • Moderators, Category Moderators, Computer Games Moderators Posts: 52,383 CMod ✭✭✭✭Retr0gamer


    I'm trying to avoid box2D. I find it really slow and it has some annoying quirks in Corona.


  • Registered Users, Registered Users 2 Posts: 1,481 ✭✭✭satchmo


    Sounds like a good candidate for a quadtree or other similar hierarchical space partitioning structure. Quite simple to implement and will reduce the number of object/tile intersection tests by an order or magnitude. Since it's tile-based it should be even easier, as you wouldn't have to deal with tiles straddling borders and belonging to more than one cell.


  • Registered Users, Registered Users 2 Posts: 3 paulmcgg




  • Advertisement
  • Moderators, Category Moderators, Computer Games Moderators Posts: 52,383 CMod ✭✭✭✭Retr0gamer


    Thanks, going to have a look at these today.


Advertisement