Can't go through invisible parts of a PNG?

justinodunnjustinodunn Member, PRO Posts: 226

I have one png file which are the walls of the game, and on 4 sides there are rectangle shapes to resemble walls in the PNG file, however nothing is in the middle. I made it so when main actor collides with wall (the png), but when the main actor walks into the PNG, even in the middle (empty part), it still collides with the PNG?

Comments

  • DoguzDoguz Member Posts: 500

    I believe what your asking is 'pixel collision' which isn't supported here. We have 2 options. square or circle. So a circle would effectively allow your corners to avoid collision.

  • HopscotchHopscotch Member, PRO Posts: 2,782

    @justinodunn, cut the png into seperate strips, so that each section or side can be placed on individual actors. Benefit is also that you can reuse those walls for different level designs.

  • justinodunnjustinodunn Member, PRO Posts: 226

    That could work, but what if my walls are curved/ has ups and downs on each side?

  • DoguzDoguz Member Posts: 500

    Forget colliding with that art. instead create an actor that is used for collisions. Change its alpha to 0 at runtime. Then just overlay it on your scene wherever you need collision.

  • HopscotchHopscotch Member, PRO Posts: 2,782

    @justinodunn, if your level layout is very intricate with smooth curves, etc, you can go with your first approach of making one big background actor with the image in which has no collision rules. Then make 1 seperate wall actor with alpha 0 which will act as your collider and repeate this actor appropriately on the scene .

  • justinodunnjustinodunn Member, PRO Posts: 226

    Good idea! However how do you think it will work if I were to make an endless runner? So the spawned walls are random. Will I need to collaborate with tables?

  • HopscotchHopscotch Member, PRO Posts: 2,782
    edited April 2014

    Sure, use tables to define the background image and corresponding collision actor placement.

    I would break the level up into predefined sections, then randomly choose the sequence during gameplay.

    Just make the ends of each section be able to match up to any othe section.

  • justinodunnjustinodunn Member, PRO Posts: 226

    Alright thanks!

  • justinodunnjustinodunn Member, PRO Posts: 226

    Do you have any ideas how though? I'm struggling a bit :p

Sign In or Register to comment.