I am a teacher and using microsoft arcade to build a game with my class.
I would love to be able to make the enemies move side to side ‘Mario mushroom’ style which the player sprite can jump on to destroy but I can’t work out how to do it or find a video that does.
Thanks for your help!
Hi, Mr. Groom! That’s super cool here’s a program with the “jumping on enemies” behavior:
The main things are:
- Using a “bounce on walls = true” flag on the mushroom enemies so they’ll bounce between the walls.
- Checking when a sprite of kind Player overlaps a sprite of kind Enemy - if the player has a positive Y (falling), and its bottom is higher than the enemy’s y, then I count that as a valid stomp. Otherwise the player loses health
I also have the mushroom flipping its image when it hits a wall! There are definitely things that aren’t there, so if you have more questions please let me know! or if this wasn’t the behavior you were looking for
Hi - so I think I have added gravity but the enemy just bounces around off the walls. How can I ensure that it stays on a wall after falling off a ledge?
Thanks so much for getting back to us quickly with the information. This is perfect - I was making it much more complicated than necessary!
PS - We (the teachers) are enjoying watching the livestreams you have all made to get tips and the children are loving using Microsoft make code. By the end we would have made a total of 100 games driven by narratives that have been written.
Thanks for your help!
The bounce on walls behaviour will bounce on any wall so when you fall off a platform some of that velocity is flipped and you end up with bouncy enemies.
Here’s an image from another thread that talked about how to program this behaviour
credit to @shakao
haha yup totally forgot bounce on walls will bounce them in every direction.
here’s my program again with SPerkins’ solution, but also with a hacky way to keep the enemies on the same platform XD https://makecode.com/_VhEC4k12JUF3 I don’t remember what Goombas do!
and that’s awesome to hear about the livestreams we don’t get comments on the videos so it’s great get some feedback!
I made a guidebook that prints out nicely onto A4 for use with my own students. You can access it here Guidebook
Thanks for this. I can’t seem to make them stay on the platform even though I have copied the code exactly. I have found a way around it by building some extra walls in though.
I wish I had this at the start!
A good way to do it is to have two extra tiles for your floor. Make one tile a left edge and the other a right edge of the platform. Use these tiles to tell the enemies when to turn around when they are above these tiles by adding an or block to the condition posted above.
It’s essentially like using walls but you can have a bit more freedom in how you build your levels.
I managed to achieve that by just checking if the tile under the sprite was “transparent”, and if so, reverse the vx velocity). (In my case I have also ay=0, so the sprite isn’t falling anyway). It looks a bit awkward because the sprite starts to move beyond the platform until it realize that the tile below is transparent and then it turns around. But it works for me