EkBass
Silver Coder
Hi.
I have a set of images i want to load on array. Kind of sprite stuff.
or something like that depending of character.
Filename itself is form "Run0.png", "Run1.png" etc.
So, to not to write couple hundreds of lines i thought to use loop.
And it does not work. I tried with concat, but when using multiple strings and integer on its call, i got error message that right bracket was expected.
In basic languages and C# using string + int + string results a string but i guess im bit lost with JS now.
What is the proper way to do this? Im working with p5.js here if that counts.
I have a set of images i want to load on array. Kind of sprite stuff.
Code:
path = img/plr/
path = img/zombie/
or something like that depending of character.
Filename itself is form "Run0.png", "Run1.png" etc.
So, to not to write couple hundreds of lines i thought to use loop.
Code:
imgFile = path + 'Run' + i.toString + '.png'
imgFile = path + 'Jump' + i.toString + '.png'
And it does not work. I tried with concat, but when using multiple strings and integer on its call, i got error message that right bracket was expected.
In basic languages and C# using string + int + string results a string but i guess im bit lost with JS now.
What is the proper way to do this? Im working with p5.js here if that counts.