# I need some help

So, I made a game on Makecode. It’s called Philip the flathead, and everything seems to be going smoothly, all except for the enemies. I tried making something simple in creating them, but it doesn’t seem to spawn where I need them to. In fact they don’t spawn whatsoever. Can somebody please look it over and tell me what I did wrong?

2 Likes

Nice platformer game. I will try to see what is going on.

Also you never put walls here at the bottom of level 3. No wonder why I kept falling there.

You never made any enemies so why would they pop up in a game

Now, I have a new problem. I made some code for the enemies to change direction when a wall is in front of them, but all they do is continue to go left.

What could I do to make them change direction?

Oh, I see. Thanks, man. Also, the grey tiles you keep falling through are meant for you to fall through. I did that on purpose as a kind trick for the player. You can tell the difference between these tiles and the other brick tiles based off the bottom.

Ahhhh. That makes sense. The game is really cool. I like the animations and stuff. Too cool. Your farmer guy is cool. I forgot his name though… Nevermind found it. His name is philip. Well I’m here if you need any help soooooo. COOL

1 Like

Nice raining tacos enemy. I gotta eat some dinner but the enemies might need to do some more work. Make it follow and maybe use projectiles or overlaps to destroy your tacos too.

1 Like
``````when hitting a well (when hitting a *wall*)
``````

Since you referred to the speed of the enemies multiple times (-30), I also just created a variable called ‘enemySpeed’. You’ll notice that when an enemy hits a wall on the left, the vx is set to ‘absolute of’ (which just takes the negative speed (-30) and makes it positive).

Hi Nico,

I changed your code so that the enemies move in the other direction when hitting a well. You had written a for each loop that changed the direction, but that was only occurring within the ‘StartLevel’ method (which is called once). So I removed that code and placed in within the ‘on sprite of kind ‘Enemy’ hits wall at location’ event (you can find it under ‘Scene’ menu).

There is one enemy all the way to the right that is stuck, but the rest move

1 Like

Thank you man, you really saved my behind

3 Likes

actually, hold up.

I copied what you did onto my original game, and made sure that I understood it of course, but when I tested it, it did the same thing as before. What did I do wrong?

Change the ‘kind’ of spite from Player to Enemy.

So far. I have this.

I feel like an idiot now.

1 Like

I am glad you got the game working. I noticed a few issues with the player overlap enemy event:

You need to use the variables ‘sprite’ and ‘otherSprite’ that are given at the top of the event. To use those variables, click and drag the variable to other sprite placeholders (i.e. sprite to Philip and otherSprite to small_blob). Although you are correct to assume that the only player is ‘Philip’ (which is the variable sprite), and the enemies you create are assigned to ‘small_blob’; the problem occurs when you create multiple enemies. The last enemy created may be further to the right of the game, but it does not refer to the first one you created. Long story, I know.

This is what I changed in the event block

Philip => sprite
small_blob => otherSprite

Also, you were checking if the bottom of Philip was less than the y of small_blob (well ‘otherSprite’, an enemy); which suggests you are checking if the player jumps on top of the enemy. It would be better to specify ‘player bottom’ is less than or equal to the ‘enemy top’. However, your enemies were 16 pixels in height, but only 7 pixels tall. The top measurement takes into account the transparent pixels (i.e the pixels not having any color) that are above the enemy. I changed the height of the enemies to 7 pixels.

1. Select the boundary of the sprite
2. Drag it to the top
3. Change the height from 16 to 7

Even when I changed that, I noticed that the overlap event was not working as expected, so I changed the condition to be:

if (sprite.vy > 0) (the player sprite is falling down), then the player landed on top of the enemy. I also placed the destroy at the bottom of the if statement.

2 Likes

I was expecting to do it myself, but I never even considered any of this. Thank you so much @cosmoscowboy. You must be from Microsoft cause you seem to know every problem and how to fix it.

1 Like

I don’t work at Microsoft, and don’t know everything, but enough to help you out.