How to detect surface type

Get help using Construct 2

Post » Mon May 18, 2015 2:25 pm

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?

Image
working on Rally Racing
B
8
S
1
G
2
Posts: 48
Reputation: 1,076

Post » Mon May 18, 2015 3:20 pm

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.
B
103
S
38
G
19
Posts: 962
Reputation: 17,986

Post » Mon May 18, 2015 4:12 pm

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.
working on Rally Racing
B
8
S
1
G
2
Posts: 48
Reputation: 1,076


Return to How do I....?

Who is online

Users browsing this forum: stevenode and 8 guests