Discuss Scratch

copper8q
Scratcher
14 posts

how to make enemies in top down adventure game

Hi,
so i'm making an adventure game that involves enemies. It's top down and not a scroller, similar to the first legend of Zelda in which you don't see what
's on the other parts of the map until you go there. I used the code from @warframe ‘s tutorial. Here’s the link so you can see what i'm talking about. https://scratch.mit.edu/projects/235944386/ Anyway, I'm making an enemy, and creating multiple using clones, but I can't get them to work on more than 1 screen. My code is at the bottom. Anyway, does anyone know a better way to do this so I can get it on multiple screens?




code:
whenclickedhideforeverwaituntillocation=-20showgotox:-190y:125pointindirection90createcloneof myselfgotox:180y:-125pointindirection-90createcloneof myselfhidewaituntilnotlocation=-20














whenIstartasacloneforevermove5stepsiftouching foreground?ortouching edge?thenturn180degreesifnotlocation=20thendeletethisclone

oh and location is always a quote

Last edited by copper8q (June 7, 2024 20:32:20)

Koamodo975
Scratcher
1000+ posts

how to make enemies in top down adventure game

Well, unless that was a typo on your part, it looks like you're checking to see if the enemy's location is equal to 20, when they're spawning at negative 20.
copper8q
Scratcher
14 posts

how to make enemies in top down adventure game

oh no, -20 is the name of the foreground sprite's costume. Check the project I linked and go in the code to see what i'm talking about. What I'm doing is the same thing, just expanded out a bit.

Powered by DjangoBB