Image Array?
BlitzMax Forums/BlitzMax Beginners Area/Image Array?
| ||
I've tried to make an array that could hold images, but it just won't accept it. Is there a special way to do this? Many thanks to whomever replies. |
| ||
Hi Jebbs. Looks like you're trying to write a platform game? You might have better luck getting responses by making one thread "Help Writing My Platform Game" or something like that, and then ask various questions all in one thread. That way you and others can see all the responses in one thread rather than go through several threads that basically relate to each other. So go ahead and start a new thread and perhaps ask the mods to remove the others. Just a thought. ;) |
| ||
JGOWare - I disagree. Its better for future searching to have separate issues in their own thread. Anyway: Global myImages:TImage[5] For N = 0 to 4 myImages[N] = LoadImage("image" + N + ".png") Next |
| ||
GFK - Ok. |
| ||
No New[] required? |
| ||
No New[] required? Not realy, specifying the size directly or using New does the same thing. An array is always a reference. You can even do this =) Local a:Int[Rand(64)] |
| ||
For Types you must do, though? |
| ||
Using Local array:YourType[5]is the same as Local array:YourType[] array = New YourType[5]In both cases every element in the array is Null. Gfk assigns an object to them by looping trough the array and use LoadImage() for every element. |
| ||
if images have the same size, e.g. tiles, just use loadanimimage, and then drawimage bla,0,0,index |
| ||
I've tried to make an array that could hold images, but it just won't accept it. I'm pretty sure you have your answer by now but, for the future, its really useful to post some small code showing the problem and the error you are getting. |
| ||
<ignore this post, problem on my side> Last edited 2011 |