How to detect surface type

0 favourites
  • 3 posts
From the Asset Store
Change delay, create new lines, "backspace" the text
  • Best design practice.

    I need to set different surface types for a track. So i can check if spriteCar is overlapping Tarmac/ Dirt/ out of track etc

    Best way to make it? Do i have to:

    a. Have an invisible tilemap and paint it over the track for each type of surface?

    b. Divide the track by segments and draw each collision polygon individually?

    Or is there another way?

  • It depends on how you're building your levels. If that is one static image, that's more difficult. If it's multiple objects placed on top of each other, it's quite simple. In my game, I just group the different objects in families that change a variable to let me know what surface the player is on. Then events are just modified based on that variable. So I just check it all against the family they're in.

    If your maps is a solid image, you'll need to do some sort of invisible object. It could be a tilemap or just some tiled backgrounds stretched and rotated to fit.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I can draw a "solid color" sprite for each surface and put it on top of the track (set to invisible). That would be ideal assuming construct will discard the transparent pixels in the sprite. I thought it could only use the collision polygon.

    Are you saying it can?

    EDIT

    Just tested and No. It only detects the collision polygon.

    So the best way seems to be; import the track segments and hand draw the collision polygon for each.

    PS: Multiple collision polygons per sprite (like adding image points) would be a nice feature. Even better if the collision mask could be drawn with a "block" brush (4x4, 8x8, ...)

    EDIT2:

    And its nagging me that i shouldnt go over 8 collision points per sprite, bummer.

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