Alternative to collision polygon?

  • Hi guys im making an orthographic citybulder kinda.

    My problem is that for each building i have collision polygon at the base of the building to use for pathfinding.

    But when the building is taller it doesnt feel better, cant easily select the building.

    So is there a way to select that building by, for example, the visible pixels or something?

    The only thing i came up with was to attach emty object with another collision polygon, but as i plan to have many of that objects, im worried for the performance.

    Here is an example of what i mean.

    So guys, any ideas?

  • You could use single tiles for pathfinding and collisions, and seperate sprites for buildings on top of them.

  • Thanks for the reply

    Though im not quite sure i do understand you.

    I think you mean to have 2 objects right?

    Im concern about the object count in later stages of the project, because i plan to have quite. But still it sounds as the only way...

  • Yes, or you can have collision checks that test if the player is higher than a certain y value of the building and if so move the building up or down a layer depending on if you need it in front or behind the player. Someone posted a system for doing this in the forums I just don't have the link handy.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Yeah nice approach

    Dont thing will work for me because for z order i use a plugin, so all stuff should be on 1 layer. But anyways that is good trick to learn

    Thanks

  • Disable collision for visible sprites, you should create another sprite or tile background as "helper" fill the sprites that you would adjust the collsion and it must be invisible, it would work.

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