Real problems with class.
I don't know why but have a problem in my enemy class, and i read and re-read, the problem is(i think so), i make a class for the enemies and i used the tool for random generetion, and i tried to call the class is the principal main but doesn't worked, so plis, HELP ME I TRIED TO DO MY BETTER
link of my game: https://microstudio.io/rianstar/ghosthunt/
THANKS FOR THE HELP.
main file
init = function()
.....
enemies = []
for i=1 to 10 by 1
enemies.push( new Enemy())
end
end
update = function()
......
for e in enemies
e.update()
end
......
draw = function()
......
for e in enemies
e.draw()
end
......
enemies file
Enemy = class
constructor = function()
this.x = random.intInRange(-152,152)
this.y = random.intInRange(-80,80)
this.speed = 1.8
this.facing = ghost.facing
this.width = 16
this.heigth = 16
this.health = 2
end
Movement = function()
if ghost.x > this.x then
this.x += 0.8
end
if ghost.x < this.x then
this.x -= 0.8
end
if ghost.y > this.y then
this.y += 0.8
end
if ghost.y < this.y then
this.y -= 0.8
end
end
update = function()
Movement()
end
draw = function()
screen.drawSprite("red",x,y,16,16)
end
end
@Loginus thank you too much