About 'Adding Hazards'!

In this video (objectives)…

  1. Import some spikes.
  2. Set up a "Hazards" tilemap.
  3. Build the behaviour of the "Hazards" tilemap so that it harms the player.

After watching (learning outcomes)…

Create hazards in your levels which harm the player.

(Unique Video Reference: 24_TV_CUD)

We would love to know…

  • What you found good about this lecture?
  • What we could do better?

Remember that you can reply to this topic, or create a new topic. The easiest way to create a new topic is to follow the link in Resources. That way the topic will…

  • Be in the correct forum (for the course).
  • Be in the right sub-forum (for the section)
  • Have the correct lecture tag.

Enjoy your stay in our thriving community!

1 Like

I can’t find spikes to import in available materials.

@Rick_Davidson, Looks like you’ve not attached the spikes to the lecture resources.

For anyone who is unsure of how to find them on GitHub, you should be able to copy them directly off this post or follow the link below.

Spikes
Spikes

Thanks for sharing Gary. The spikes are also now in the downloads against the lecture. I’m not sure what happened with them being omitted. User error I hope. :slight_smile:

1 Like

Is there a way to have more granular control over the tilemap colliders?

For instance, you mentioned about giving the player a little room for failure by decreasing the enemy collider—which is considered good game design—but how would you do that for spikes? I was considering lopping the two top pixels off the crest of the spike collider but wondered if that’s even possible?

Hi @Cam, I think Rick does go into this in one of the videos, perhaps a little ahead from where you are currently, but if you go to your “Sprites” folder and click on your “Spikes” sprite, you can change this in the Sprite Editor.

Once inside, on the top left of the Sprite Editor, select “Custom Physics Shape”.

image image

You will be presented with white squares in each corner of the sprite. You can click on one of these and drag it where you want your collider shape to be.

Clicking anywhere along the connecting lines will allow you to add another “node” that you can drag in to position the physics shape, which will in turn change the shape of the collider.
You can delete accidental or unwanted nodes by clicking on them and pressing the delete key on your keyboard.

image Here is mine, for example. :slight_smile:

Hope this was helpful!

3 Likes

Hey @ashcon, that’s amazing. Thank you so much for going to the effort of explaining it with all the screenshots, that works perfectly. There was one step missing, and that was after choosing Custom Physics Shape from the dropdown, I had to click Generate. Then the nodes and the outline showed up.

I can’t remember if it was mentioned yet, it probably was and I vagued out haha.

Thanks again, you’re a legend!

1 Like

I’ve noticed that after adjusting the pixels per unit to 31, it seems to cause composite collider issues where there are extra edges among a few of the tiles. This caused the player to be blocked while walking on the tiles. Deleting all Foreground (and re-adding it) seemed to fix it.

1 Like

The deathKick on death is cracking me up! I love it.
Having some issues with dying tho. The body seems to slide away and doesn’t stop until it hits a wall. Not sure what I am missing. Any clues as to where to look?

Privacy & Terms