cybernescence, mate you are great!, now it works, diamond appears and dissapears wueh hit "E" key as expected.
Thanks a lot dude.
Now the complete idea is run a gif file I had made.
Firts I made diamond model (Max)>animated it>make a video>make gif file from video.
Now I've all the 60 PNG images stored in right folder, and named such as "000.png/059.png", all they are the animation frames, and transparent background.
Unfortunatelly GG load the prompt but not the images, even the firts one either, just the prompt, and does not crash.
The script:
--local imgcounter
local imgWildcard
local myImage = {}
function load_bmp_init(e)
--imgcounter = 0
imgWildcard = "00"
--myImage = ""
g_imgBackdrop = LoadImage("scriptbank\\images\\Diamonds\\diamond.png")
g_sprBackdrop = CreateSprite(g_imgBackdrop)
SetSpritePosition(g_sprBackdrop,200,200)
for i = 1, 58 do
if i<10 then imgWildcard = "00" .. i .. ".png"
else
imgWildcard = "0" .. i .. ".png"
end
myImage[i] = LoadImage("scriptbank\\images\\Diamond\\" .. imgWildcard)
img=myImage[i]
end
end -- load_bmp_init
function load_bmp_main(e)
PlayerDist = GetPlayerDistance(e)
Prompt("img: " ..img) -- for testing, return numeric value
if PlayerDist < 200 then
--JumpToLevelIfUsed(e)
SetSpritePosition(g_sprBackdrop,50,50)
SetSpriteOffset(g_sprBackdrop,5,5)
--FreezePlayer()
for h = 1,#myImage do
SetSpriteImage(g_sprBackdrop,tostring(myImage[h]))
img=myImage[h]
end
--Prompt(img) -- for testing , return numeric value too
--Prompt("Well done!, level completed, you get diamonds")
if g_KeyPressE == 1 then
DeleteSprite(g_sprBackdrop)
--UnFreezePlayer()
end
end
end
Note: "img" variable are returning numeric values when testing, so teorically "MyImage" array are getting all the paths, anyway I was expecting string values (the image paths), instead of numeric values, even besides I'm using "tostring".
Ignore if this make the difference?
Thanks again guys, for the feedback.
3com
Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz
OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics