Image Array?

BlitzMax Forums/BlitzMax Beginners Area/Image Array?

Jebbs(Posted 2008) [#1]
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.


MGE(Posted 2008) [#2]
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. ;)


GfK(Posted 2008) [#3]
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



MGE(Posted 2008) [#4]
GFK - Ok.


Czar Flavius(Posted 2008) [#5]
No New[] required?


grable(Posted 2008) [#6]
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)]



Czar Flavius(Posted 2008) [#7]
For Types you must do, though?


AltanilConard(Posted 2008) [#8]
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.


CS_TBL(Posted 2008) [#9]
if images have the same size, e.g. tiles, just use loadanimimage, and then drawimage bla,0,0,index


tonyg(Posted 2008) [#10]
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.


The_Nici(Posted 2011) [#11]
<ignore this post, problem on my side>

Last edited 2011