Discuss Scratch

UnfrostedTart
Scratcher
11 posts

How To Make Enemies You Can Jump On?

I'm making a simple platformer game, and I need help making enemies you can jump on, but you can also be damaged by. Think of the enemies from the Mario games for example. I'll be grateful for any help!
scratch978654
Scratcher
100+ posts

How To Make Enemies You Can Jump On?

You can create an enemy that's white on top and black at the bottom. Then check if you're touching black(you get damaged) or touching white(enemy dead) make sure you're touching the sprite if there are other white/black sprites in your game.
UnfrostedTart
Scratcher
11 posts

How To Make Enemies You Can Jump On?

For some reason, the code ignores the sprite Thanks for trying though.
SpideyPlaysMC
Scratcher
500+ posts

How To Make Enemies You Can Jump On?

Make a “bottom sensor” sprite. It should be a small black rectangle. It should follow the player using this:
whenclickedalso make sure the sensor is just below the playerforevergotoPlayer
Then make the enemy sense if it is touching the bottom sensor:
whenclickedif using clones, replace with the "when I start as a clone" block.foreveriftouchingBottom Sensor?thenstopother scripts in spritehidestopthis scriptif using clones, replace with the "delete this clone" block.

Last edited by SpideyPlaysMC (May 18, 2020 19:11:08)

maestrogeicho
Scratcher
98 posts

How To Make Enemies You Can Jump On?

This is a more advanced method that is more efficient than a sensor sprite. I assumed a few things, such as the enemy being a clone.

When I start as a clone

Forever(
If <touching player> and <player y position is more than my y position> and <abs( my x position- player x position) is less than (width of enemy):
delete this clone/ take damage
)

Sorry I didn't use actual scratch blocks, they're almost impossible to use on my computer
UnfrostedTart
Scratcher
11 posts

How To Make Enemies You Can Jump On?

I made the game public, so you can help by commenting on it!

https://scratch.mit.edu/projects/395920958/
SpideyPlaysMC
Scratcher
500+ posts

How To Make Enemies You Can Jump On?

maestrogeicho wrote:

This is a more advanced method that is more efficient than a sensor sprite. I assumed a few things, such as the enemy being a clone.

When I start as a clone

Forever(
If <touching player> and <player y position is more than my y position> and <abs( my x position- player x position) is less than (width of enemy):
delete this clone/ take damage
)

Sorry I didn't use actual scratch blocks, they're almost impossible to use on my computer
Yes, that is more efficent and compact that way.
UnfrostedTart
Scratcher
11 posts

How To Make Enemies You Can Jump On?

The code isn't responding to my game, though. Seriously, the code is ignoring everything I put in.

Last edited by UnfrostedTart (May 19, 2020 13:16:08)

Powered by DjangoBB