uneven ground

Get help using Construct 2

Post » Mon Dec 31, 2012 2:50 am

[QUOTE=Astrosus] The problem is that when I create a tiledbackground with a ground graphic for the whole level (4000x768 for example) and I change its behavior to solid. The player sprite collides with the transparent, empty space of the tiledbackground. The engine should be able to recognize if the part of the tiledbackgrund is transparent or has actual graphics.[/QUOTE]

Exactly. I was hoping I wasn't the only one scratching their heads at this.

@Space Ape - Tiles are as effective as using dozens of the same sprite- the blank space of the png still causes a collision.
Everybody got to come out of the closet... does that mean I'm allowed to come out of the corner? Is that even funny anymore? Do parents still make their kids stand in corners when they mouth off?? These are the questions that keep me out of the really good schools.

havenisle.net
B
11
S
3
G
3
Posts: 27
Reputation: 2,695

Post » Mon Dec 31, 2012 12:01 pm

Double click the landscape sprite to go to the image editor.
Select the polygon collision tool (under hotspot tool).
You should see a bounding box with 4 vertices.
Right click the image and a popup menu will appear.
Select guess polygon shape (it won't match exactly but it's a start).
Right click the vertices and select "add point" from the popup menu.
Move the points to fit the terrain.

From the looks of things, the collision polygon isn't editable for TiledBackground.

Here's a little capx for you.
https://dl.dropbox.com/u/666574/uneven%20landscape%20collisions.capx
B
15
S
5
G
7
Posts: 877
Reputation: 5,650

Post » Mon Dec 31, 2012 2:16 pm

[QUOTE=Astrosus] I hope uneven grounds will be implemented in future releases. The problem is that when I create a tiledbackground with a ground graphic for the whole level (4000x768 for example) and I change its behavior to solid. The player sprite collides with the transparent, empty space of the tiledbackground. The engine should be able to recognize if the part of the tiledbackgrund is transparent or has actual graphics.[/QUOTE]

From what I understand this would mean wrapping every repeated tile (possibly thousands) in their own bounding box - somewhat defeating the purpose of using tiles in the first place. Imagine you had a circle bounding box on a tile - It would be very hard if not impossible for C2 to keep one large circle bounding box over all the tiles once they have been stretched over an area into a rectangle. If you are detecting based on transparency, now you are doing per-pixel checking every frame - much more resource intensive than the bounding boxes C2 uses.

I suggest creating two layers - A collision layer using sprites (giving you access to any weird shapes, plus sprites can be stretched to cover any area) and then a second layer with all your graphics/scenery on top.boolean2012-12-31 14:19:11
B
24
S
4
G
1
Posts: 244
Reputation: 3,462

Post » Mon Dec 31, 2012 3:31 pm

[QUOTE=boolean]
I suggest creating two layers - A collision layer using sprites (giving you access to any weird shapes, plus sprites can be stretched to cover any area) and then a second layer with all your graphics/scenery on top.[/QUOTE]

This might work for little games, but for a "real" game (no short arcade game) with 100 Levels (each 20000x768 pixels) and complex terrain it will drop your fps to zero. Atleast I think it will, because sprites need more resources than tiledbackgrounds.
B
8
S
2
Posts: 110
Reputation: 1,463

Post » Mon Dec 31, 2012 3:42 pm

If you placed 20000x768 sprites, maybe, but scaling sprites incure no extra resources (see the reply by Ashley) so you can just take one sprite and stretch is halfway across the level. Then you can place your individual odd shaped sprites where needed.

boolean2012-12-31 15:46:19
B
24
S
4
G
1
Posts: 244
Reputation: 3,462

Post » Mon Dec 31, 2012 4:30 pm

What is the better way to accomplish uneven ground?

Create many little sprites with a maximum of 8 collision points (recommended by Scirra)

Create one large sprite with much more than 8 collision points
B
8
S
2
Posts: 110
Reputation: 1,463

Previous

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 21 guests