How do I create tiles with different properties?

0 favourites
From the Asset Store
Fully commented source code/event sheet & sprites to create a space shooter game
  • Hi fellas, I'm having some trouble with tilemap and collisions. Opened a new thread, but I'm still looking around for an answer, maybe you can help... The thing is, I have the following setup:

    white squares jumptrough tilemap z-index 0, black squares solid tilemap z-index 1, and a platform behavior sprite.

    I'd like to achieve that the black square on collision with sprite gets deleted so that white square tile gets revealed from underneath. I'm having trouble identifying the tile's x, y since the sprite's x, y is in respect to Cartesian coordinate system and the tile's x, y is in respect to tile's position in the tilemap... Here's a simple set up I've created so if anyone has a min or two to take a look:

    https: // dl.dropboxusercontent.com / u / 6116050 / tileeraseoncollision. capx

  • This is a working version of your .capx.

    I added an image point named "erase" and used that to test for tiles.

    [attachment=0:3k1omlxf][/attachment:3k1omlxf]

    Your version didn't work because you used the sprites X&Y which are in the centre and there will never be a tile at that position to check against.

  • thank you Minor, helped me a lot, never even heard of "image points" ! One more thing... How could I implement a "flash" of that tile lasting 0.5 s, and then deletion of it?

    Firstly, if I use flash behaviour on Tilemap, entire tilemap flashes, and if I use Wait 0.5 sec, then since the Sprite moves along in that 0,5, the "erase tile in respect to sprite x, y" will erase some other tile and not the one that was hit 0,5 sec ago...

    I'd like to achieve that player hits a tile, it flashes for 0,5 sec and then it gets "changed" (erased)...

    Anyhow, thanx for your help!

  • I would take a note of the tile positions and store them in Variables on collision so then you do not need to worry about it getting the wrong one after waiting .5 (unless it hits another one in that time).

  • yeah, no go... I think I found a solution, I just can't make it work (need some help)... So, collision with a tile erases the tile but spawns the sprite (same png) with flash behavior that flashes for 0,5 sec and gets destroyed when flashing ends... I just don't know how to spawn a sprite at exact same place the tile was

  • Not sure either sorry. Having real issues with collision detection on a jumpthru tilemap myself at the moment causing my player to fall through the floor if falling or jumping. Very odd and frustrating to say the least.

  • saf

    Here is the object placement. I had to change some stuff around from the last example I made and would probably do it slightly differently but might give you a start.

    [attachment=0:2bknusub][/attachment:2bknusub]

    I tried this yesterday and forgot to post it.

    jimwills

    I'll have another play with your problem later see if I can narrow the problem down

  • Thanks, do you want me to send the file over for you to look at that way you can see if its my coding causing the issue(s)?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanx man, it looks like a good start, however, it seems jimwills is right, even in this example, the player sprite will fall through the jumptrough tile (?!) when landing on it after a jump...

    Moreover, usage of the tilemap (in my case) was to reduce the number of object I use in the layout, to optimize my game for mobile, yet this setup is even more CPU consuming than just using individual objects... Not sure what object count is the threshold...

    The above tileeraseoncollision (2).capx uses 35% of my CPU and I get 50 FPS at most, and this one:

    https:// dl.dropboxusercontent.com/u/6116050/spawnoncollision .capx

    I get 60 FPS and 12% CPU usage... will test a bit more with more objects to see how it affects the CPU usage....

  • Minor thx for the capx, and nice blog, I will share the link with my friend in C2 Skype group

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