Discord
Login
Community
DARK THEME

Enemy help

i progamed a story game and i progamed the first enemy today for that i watched the tutorial "Strike and interact". and the code works so far but if the player or the sword touch the enemy the game frezzes. my game is public. the name is "lost in school"

file >> enemies

function >> spawnEnemy

    enemy.x = help.randRange(-175,175)
    enemy.y = help.randRange(75,-75)

R in name function '''randRange'''

Remove the errors you see in the console.

thanks loginus but that make that i cant kill the enemy

the position of the enemy change every milisecond

and the enemies duplicating if i click on my mouse

and the enemies duplicating if i click on my mouse

Because you keep calling the spawn function.

file > main

function > update

     spawnEnemy()

The line above is an error

  • there is npc2.chattin()
  • should be npc2.chatting()

how i can make that the spawn function is not keep calling

The game class/object should be responsible for the entire gameplay.

Creating characters, enemies, their spawning. Most of the main >> update() functions should be in game.update()

Remember in a variable that there was already a spwn at a given level and don't do it again.

i know the last time i write here is long ago but i remeber it not all i tried not working

maybe someone can give me the code thats make the enemys not changing postisions times and not spawning all time

Post a reply

Progress

Status

Preview
Cancel
Post
Validate your e-mail address to participate in the community