Ok, this is a lot so I might do this in multiple posts so that the first ones get approved and sent faster (hopefully). The first problem is that there is an On Game Update Every (5000) Ms block that constantly spawns new enemies. I… don’t know why this exists. In the “Enemies Bounce on a invisible wall” function, you are already spawning all the enemies and you are replacing all the Red tiles with empty ones, so the “place (da enemy) on top of (value)” block in the On Game Update code literally does nothing because there are no Red tiles in the level anymore. Then, after that bit of code that does nothing, you call the Enemy Spawner function, which also has the same code that does nothing. The “place (da enemy) on top of random (Red tile)” block also does nothing for the same reason. (I will note that your variable names are hilarious!
) Moving right along, the next bit in the “on game update” code spawns a new enemy. For a different reason this time, that being that the “place (da enemy) on top of random (Red tile)” code runs before you create the new enemy, this enemy is never re-located from the default spawning position, only being slightly moved by the “X pick random” bit, so this is why an enemy randomly spawns in the sky every once in a while. Once again, if you moved the “place sprite on tile” bit to after you create said sprite, it would still do nothing because there still aren’t any Red tiles left in the level. Basically, what I’m saying, is that you don’t need that bit of code at all, unless you are trying to get enemies to respawn every once in a while, which you would have to do some other way. You should also remove the “For” loop at the top of “Enemy Spawner” as well as the “place (da enemy) on random (Red tile)” code at the top of the “for element” block in the same function.
Uhh… yeah… so, doing all that in a copy of your project seems to fix a lot, but now enemies don’t move because the “Enemy Spawner” function is never called. Moving all that into a Forever loop fixes that. The whole thing with Enemies floating over the big holes to get to you is because you never gave them gravity when they were created, only in the On Game Update code. Moving the “Gravityexists lol” code to directly after the “Set (da enemy) to (Sprite { } of kind (Enemy))” in the “Enemies bounce…” function fixes that, but now it’s incredibly laggy?!?
Uhhhh ok, I found it: there is a block detecting if an enemy overlaps the “lava” tile and it runs the same “place (da enemy) on top of random (Red tile)” code that, once again, still does nothing because there aren’t any red tiles in the level, but what it does instead is create a lot of lag because it is trying to find a red tile, probably by looping through the whole tilemap, and it’s doing that every single frame because the enemies are never moved out of the lava. So I removed that of course and everything works again!
One more thing is that “Play Sound” blocks, when you leave them on “play (sound) [until done]”, pause everything until they are done playing, so changing that to “[in background]” will fix that future issue. You did that in the “B button” code but not in the “projectile hits enemy sprite” code.
Umm… there’s some other stuff with, like, the player constantly bouncing up and down, which is just a slight problem with character images being offset weird so when the character hits the ground and their image changes, they aren’t touching the ground anymore or they are clipped into it or something so they change to the falling image and then back again when they hit the ground, creating an odd looking loop.
Uhh… there is the issue of the enemies bouncing on the ground, which can be fixed by making your own code to detect only when they are hitting walls and not the ground, because the “Sprite bounce on walls” code also checks for ground collisions. I removed that block, but didn’t write the extra code because I don’t want to do any code writing for you because that wouldn’t let you learn anything and what’s the fun in that??
Sorry for the massive paragraph! So much for making it short to get it approved quickly. Because this was a lot, I’ll post the link to my “corrected” copy somewhere soon in this post.
You might notice that I changed the name of the project. That’s because it’s not dumb, it’s really cool, and it’s only kinda jank because you’re still learning and don’t know everything yet (no one does!). Feel free to copy what I did in there, or just use that project (depends on what the rules are for what you’re doing, but it’s all still your code, I just moved some stuff around, so it should be fine).
You should be able to click it, go to “show code” at the top right, and then click the little button with the export (square-with-an-arrow-pointing-to-the-top-right) logo on it to make your own copy and take a closer look. Good luck with the rest of your project! I don’t think I will help you with the enemy edge-bounce stuff because i’ve already written a lot, but I will note that there is a way to check what tile is below a sprite and make two new tiles that go on the corners of platforms so that when a sprite walks on top of them you can code them to turn around or something. Idk though, what you have so far is probably a perfectly fine way of doing it
, Once again, good luck and happy coding!!!
