Enemy spawning in wall

I’m making an island survival simulator game, and I made it so fish spawn randomly around the map.
However, sometimes the fish spawn in the walls(check game for tiles with walls)
I don’t want my fish to be in the walls(makes it impossible for the player to kill)

Here’s the code:

Any help is appreciated!

1 Like

Nvm, i fixed it
now I have a question,
how can i have different variety of fish
when my fish spawn, sometimes they have different images
I will post the updated code

1 Like

You Can Put Them In An Array Like This:

let FishImages = [
game.onUpdateInterval(2000, function(){
    let Fish = sprites.create(FishImages[randint(0,1)], SpriteKind.Enemy)

You basically just put them in an Array!

1 Like

Try making it where if it overlaps with the sand it despawns

1 Like

here you go

1 Like

Here is the updated code:

it adds a shark miniboss and a octopus boss
this adventure is only just the beginning…

P.S. (at score 25, the boss spawns.)

Here you go I added you solution if you don’t understand something specifically tell me what and I’ll try to help😁.