Thank you! But where should I put these parts? Main, init part or smwhr?
Now all I have is "Runtime error 501
Image number 96000"
And should I do anything with global.lua? Now if I remove --[[]]-- at the end of file I get "You're calling GetPlayerDistance but this thing is nil".
Could you please show me how must this script be written with sprites?
function eatallee_init(e)
CharacterControlUnarmed(e)
LoadImages("8_15",0)
end
function eatallee_main(e)
PlayerDist = GetPlayerDistance(e)
if PlayerDist > 100 and PlayerDist < 200 then
HideImage(105)
end
if PlayerDist < 100 and g_KeyPressE == 0 then
RotateToPlayer(e)
SetImagePosition(50, 80)
ShowImage(105)
if g_KeyPressE == 1 then
HideImage(105)
Destroy(e)
end
end
end
I rewrite it, but this is fail -
eatally = 0
img = {}
function eatally_init(e)
CharacterControlUnarmed(e)
end
function eatally_main(e)
for a = 1, 200 do
img[a] = CreateSprite(LoadImage("scriptbank\\images\\8_15\\"..a..".png"))
end
if GetPlayerDistance(e) < 150 and eatally == 0 then
RotateToPlayer(e)
SetSpritePosition(img[105],50,80)
if g_KeyPressE == 1 and eatally == 0 then
DeleteSprite ( img[105] )
eatally = 1
end
end
if GetPlayerDistance(e) < 150 and eatally == 1 then
Destroy(e)
end
end