[solved] some help with local and images
Posted: Sun Apr 27, 2014 7:22 pm
howdy howdy howdy,
well ive been a damn busy bunny lately learning lua/love2d further [even bought the book and made a donation for a shirt], i always learn better when 'just doing shit' with a language. but ive come under a bit of a head scratcher concerning images and local, mixed with other matters. i have done some searching and did get far with what i did find, but now need to ask for some help.
so, what i have started using pretty early is 'local', which makes sense to me since coming from other backgrounds of code, its seems better to me having a 'local' and then call it in something you need rather than it floating around binary space.
so i have them down, some-what, but with images its a different matter.
so i have been going through some online tutorials, which have been great, always better to hear and see someone coding something, but they dont work in 'local', or use it to to any degree. so when working on some sprite movement have ran into an annoyance of using 'local' with images, or at least a series of images using say something like 'player.left[1] = etc...'
instead of using anim8 or something similar, im using separate png sprites and cycling through them, using [1],[2],[3] etc...
but using these in local become troublesome.
also, on seeing the '[]', it reminds me of arrays in c/c++, which im guessing im right that its true for lua/love2d? i still need to do more reading
to explain it further i have provided the 2 ways i have done, one complete, one not so complete. the one that doesnt start is actually the one im trying to do, since it works in 'local', which i prefer using.
i am going to possibly change up and use either AnAL or anim8, but for now fancy learning this method just now, since i know exactly whatimages are loaded, if you get me?
one thing as well, shoudnt AnAL be renamed AAL, or something similar, rather than what instantly comes to my mind once i see that
anyhow, here are the files. use 'left' & 'right' to move the sprite.
well ive been a damn busy bunny lately learning lua/love2d further [even bought the book and made a donation for a shirt], i always learn better when 'just doing shit' with a language. but ive come under a bit of a head scratcher concerning images and local, mixed with other matters. i have done some searching and did get far with what i did find, but now need to ask for some help.
so, what i have started using pretty early is 'local', which makes sense to me since coming from other backgrounds of code, its seems better to me having a 'local' and then call it in something you need rather than it floating around binary space.
so i have them down, some-what, but with images its a different matter.
so i have been going through some online tutorials, which have been great, always better to hear and see someone coding something, but they dont work in 'local', or use it to to any degree. so when working on some sprite movement have ran into an annoyance of using 'local' with images, or at least a series of images using say something like 'player.left[1] = etc...'
instead of using anim8 or something similar, im using separate png sprites and cycling through them, using [1],[2],[3] etc...
but using these in local become troublesome.
also, on seeing the '[]', it reminds me of arrays in c/c++, which im guessing im right that its true for lua/love2d? i still need to do more reading
to explain it further i have provided the 2 ways i have done, one complete, one not so complete. the one that doesnt start is actually the one im trying to do, since it works in 'local', which i prefer using.
i am going to possibly change up and use either AnAL or anim8, but for now fancy learning this method just now, since i know exactly whatimages are loaded, if you get me?
one thing as well, shoudnt AnAL be renamed AAL, or something similar, rather than what instantly comes to my mind once i see that
anyhow, here are the files. use 'left' & 'right' to move the sprite.