0 Favourites

uneven ground

  • Hello,

    I got a quick question.

    How do I accomplish uneven ground or hills? When I place a tiledbackground, it is a square and 100% perfect even.

    thanks for your help!

  • Could you please expand on that. Are you refering to a 2d platformer? a top down map? isometric?

    For such things an example image is always a fantastic reference to use :)

  • <img src="http://s1.directupload.net/images/121226/e798fmal.png" border="0" />

    It is a 2D Platformer.

    How to create uneven ground. And how to avoid crappy graphic look, when the Player is going up the hill?

  • something tell me you must use a canvas colision per pixel

  • Tricky issue. In my game I used lots of stretched and rotated rectangles to make up the ground. Then I put the aesthetic features on top of that.

    As for uphill graphics, that's hard to answer as the player's walking animation dictates how 'crappy' it will look.

  • Good question... I'm thinking using invisible collision masks (invisible sprites?) with the collision polygon set to your desired shape and then, as sqiddster indicated, put the pretty stuff on top.

  • Good question... I'm thinking using invisible collision masks (invisible sprites?) with the collision polygon set to your desired shape and then, as sqiddster indicated, put the pretty stuff on top.

    I too am up against this problem. So far, I've only been able to solve it using tons of sprites whose Opacity is set to zero.

    The ideal solution would be to make a png of a hill or wall or whatever, and use that- except when I bring the png in, the player collides with the whole image. I tried going into the animation editor and changing the collision area, but it only gives you 9 vertices to play with.

    I'll keep searching, but if anybody has discovered how to make the png collision map work, I would love to hear about it!

  • havenrocket: I played around with an idea last night and it seemed to work. If you use tiled backgrounds, which are less resource-intensive I think, and put them into a family then set a family behavior as "solid", the moving object will treat the tiled background as a solid surface.

    I was able to make a maze with tiled background wall pieces set with solid behavior and the moving object stopped on collision. It wasn't precise sometimes, but it could work with some tinkering.

  • 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.

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • 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.

    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.

  • 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.

    dl.dropbox.com/u/666574/uneven%20landscape%20collisions.capx

  • 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.

    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.

  • 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.

    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.

  • 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.

  • 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

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)
Similar Topics Posts Views Last Post
Unread hot topic
0 Favourites
[plugin] New grounds api v3
41 7,902
Picoti's avatar
Picoti
Topic
15 397
chadorireborn's avatar
chadorireborn
Topic
0 Favourites
Ground Control
17 1,246
czar's avatar
czar