basically I am making a terraria remake and I want to have opponents and the first one being slimes. but I cant get them to consistently go left to right after another clone spawns
please, send the link to the game, so we can check it & help you.
explain further and i can help!
maybe even a link
You should use the Sprite Utility extention → https://github.com/jwunderl/arcade-sprite-util
This extension makes it easy for “clones” of a given sprite to operate autonomously from the variable they were originally set. (Without the use of slimeSprite) You can use the “on sprite update” block to run code inside it for a sprite over an interval. This might be confusing so here is an example → https://arcade.makecode.com/S04085-55422-76309-15306. (Press B to summon slimes) (You can summon as many as you want)
If this is not what you are talking about feel free to elaborate.
Wow this is very helpful thank you! I appreciate this so much! thank you for your help I have never been able to make games with clones.
Does this have an extension directly on Makecode? I would like for my students to be able to use some of these. Great way to get multiple sprites to do the same thing. Thank you!
Have your students search the github url in the extensions search bar
Sort of… You can get an outdated version it in a bundle of extensions labeled “arcade-carnival”.
This will add the sprite utility toolbox. Due to it being outdated version of the extension it does not have certain blocks like “sprite move to x, y” but the “on sprite update” blocks will be there. Other extensions this bundle will add include “text sprites,” “status bars.” And “carnival.” All makecode approved extensions.
If you are worried about the GitHub link being unsafe, do not worry because the extension was created by @jwunderl, a makecode employee.
Hope this helps!
This is perfect! Thank you. This community is great!
@Bifrosty you seem to know what you are doing with these clones. could you make the slimes have HP bars and you can damage them? Thank you. That is all I need for this.
Sure, It’s pretty simple! Here is one way to do it:
First Create a status bar every time you creat your enemy (slime). Ensure you attach it to your slime with this block (statusbar extension)
Now make sure you have an attack. I made a little blue circle appear around the play for this but it can be anything.
After you have done this make an overlap for the player’s attack and the enemy. In here you are going to put code that subtracts from the enemy’s health bar. The code should look something like this:
Note the changing of the player’s attack to “prop.” A prop sprite has no overlaps and is essentially a way to make the attack not hit the slime more than once. There are different ways to do this—better ones, but this is simple.
The slime can now take damage from your player’s attack, but they can’t die. Add one finial “on sprite update loop” to your slime. Make sure this triggers very fast. I used 10 in my example but anywhere from 5-50 should do. Here you are going to check if your enemy’s health bar is at zero. If it is destroy the sprite. It’s worth noting that this will terminate all “on sprite update loops.” Stoping them from repeating. Your finial loop should look like this.
I think that the statusbar extension should be bundled with the sprite utility extension because they work together well. Here is my example → https://arcade.makecode.com/S86076-81887-13211-42119 (Attack mapped to A button) (Jump re-maped to up button)
Hope this helps! If you have any further questions ask me.
@Bifrosty This has to be the last time I will ask you for help on this (probably) if I have a tile how van I make one clone for each tile their is?
Sorry for the late reply. Here’s how to do it:
1.Create a new tile unused anywhere else. I like to draw a little small imperfect picture of what it does and label it with some text like this → (SS for Slime Spawn)
You don’t have to make it look good as nobody will see this tile. Now place this tile anywhere you want your enemy to be.
2.Grab a “for element loop.” This loop executes the code in it for every item in an array.
The “value” part is what that item in the array will be. Put this in a function that is called in your on start block after loading your tile map. You can call the function “populateTiles” Now go to the scene drawer and get an “array of all locations” block.–>
This instantly makes an array for all the locations of any tile without extra code. Put this where your element loop says “list” and change its input from the default blank tile to your tile that you created earlier.
3.Call your cloneEnemy spawn function within the loop. Drag the value part of the element loop and place your enemy top of it. (similarly to what you would do with the “on sprite update loop”)
4.If you did all of that this will put your enemy on the tile but the placeholder tile will still be there. Set the value of the tile to a blank tile or a background wall. Your final function should look something like this. →
Here is my example link → https://arcade.makecode.com/S66752-85999-46767-05855
If you need any more help just ask. Also I can’t wait to play your game!
thank you, this is all I need.
(sentence)
@Bifrosty this is really sad, but I am an unexperienced coder and I couldn’t get anyone to help me with this project after I finished the terraria one. so I am kind of posting on this old one that already had some attention. basically my problem is players move by 16 pixels per tile. but they go through walls too. I already tried adding walls but they just walk through them. could you help? here is the project link: https://makecode.com/_TYoWVFKok7yY
What I believe you are trying to do is make grid based movement. Here is an explanation of why it isn’t working →
When you ask a sprite to move say 10 pixels to the right. You are telling it to do all of this in one big step and are basically teleporting the sprite 10 pixels to the right opposed to moving it over there. Because of this your sprite will not account for walls during this, “movement.” (teleportation)
Solution 1 (simple)
You can scrap all the move y or x blocks and rely on the built in tilemap system. Fist make a function called “player move to [col] [row].” Make sure col and row are numerical inputs.
Now we want to check if the tile the player is moving to is a wall or not. We can do this with this block in the scene drawer:

Make sure to add a “not conjunction” so that the player doesn’t move on only walls. Now we just place the player at the specified location with the col and row inputs.
We still have to call the function when the player wants to move though. We do this when the player presses a direction, we get their column and row to find out where they should end up. Add 1 to the coloum to move right and subtract 1 to move left. Do the same with row to move up and down. Looks like this:
This should work in function but the player jerks around when moving and it looks weird so if you want to change its look visually see solution 2
example → https://makecode.com/_fm58KH6PaLfM
Solution 2 (complex but looks better)
You could move the sprite 10 pixels to right by setting its velocity to 10 and waiting one second before stopping it (velocity in makecode is pixels traveled per second) This would tell the sprite to take much smaller steps in movement rather than taking all 10 pixels at once. This would account for walls. You can scale this any way you want to eg. 100 velocity and stoping after 0.1 seconds, 50 velocity and stoping after 0.2 seconds ect. All of these scenarios would yield the same result but the sprite would move quicker or slower to get there.
Now we can apply this to make smooth looking grid based movement. Add the “timer” extension to your project, its under the default extensions tab so no special link. To do this we will modify some code from solution 1. First we turn the if statment from solution one into a return function.
If you are not familiar with these they basically give you an output variable when you put something in. Its like a very special variable. This return function will check if the tile is eligible for the player to move to. (not a wall) If you did this right a new block should show up in your functions drawer:
We can use this new block as a boolean output. (true or false things in the logic drawer)
Now we add our smooth movement code. Because we want the player to move 16 pixels we should set their velocity to 16 and wait one second to stop them. But this is too slow so I’m going to do this at 5x speed. 16 x 5 = 80 (velocity) and 1 ÷ 5 = 0.2 (stop time seconds). If we input this we can get some smooth movement. Your code should look something like this:
Of course we don’t want the player to move again while they are already moving because it might offset them. So we want to disable their movement controls during this period:
Repeat this process for each of the four directions and make sure you set “can move” to true at the beginning. Now it should be done, and you have smooth grid movement.
Example → https://makecode.com/_Pqj72j56EaYD
Hope this helps!
WOW! Thank you so much, this is really helpful and motivated me to keep coding now that I have walls. (Never thought I would say that…) thanks!