@Coolgaven101 , soo you want to make a goomba… EH?
Pretty simple. First, go in the object settings and set it to movable AND solid. Then, go into the code editor and drag in a once. To the once, attach a number (make sure the once is connected to the GET of the number), and set the number to anything you like, but it has to be negative (if you want to get into the accuracy of mario games, at least). This is your speed, and can be adjusted later. Next find another number. Attach your previous number to the SET of this one. Get an always. Attach it to the GET of this number.
So, what’s happening? Nothing much. On creation, the goomba is just taking a number that doesn’t equal zero, and uses that to change the number in front of it, while the goomba is always fetching that number… but doesn’t have a use yet.
Next steps:
Connect the number attached to the always to a velocity. PUT IT ON THE X!!!
So now what happens is all the stuff I mentioned before, but the always is actually using the number to make the sprite move.
Next steps:
Next, drag out two collisions. Set one to only be RIGHT, and the other to only be LEFT. Let’s set up the left first. Drag out a number and make it the other number that’s connected to the Once, but make it positive. Connect it to the SET of the number connect to the Always.
Same thing with the right collision, just make your number positive.
So… what happens now?
Well, on start it gets a number to set the speed. The always is always getting that speed and propelling the goomba at that value. On collision with the block (we’ll make this later) on the goomba’s right side, it’ll set the value to a positive, making it head direction. On collision with the block on the goomba’s right side, it’ll set the speed negative again, and vise versa.
Please tell me if you need a picture of this code.
TO SET UP THE BLOCKS:
Make a block. Let’s name it Change. Set it to NONSOLID, but enable collisions. Set collision to a box.
In the code editor, drag out a once, a number, and an alpha (from the properties). Connect the once to the GET of the number (keep the number zero), and the number to the Alpha.
So… what happens?
Well, on creation, this block gets a zero, and sets it’s alpha (transparency), to that zero, making it invisible. Feel free to experiment with different numbers besides zero in your other games, but here we’ll have to keep it zero.
Back to the goomba.
In the collisions, go to the dropdown that says Any Type, select it, and select your Change block.
Now, set your goomba on ground (that isn’t the Change block), put it between two Change blocks (give it some room to move, please ), press play, and let it roll!
Please tell me if you need a picture of any of the code I just mentioned. Next, I’ll be teaching you how to make the goomba and the player die, and then your goomba will be complete!