CollideImage and Objects not Integers

BlitzMax Forums/BlitzMax Programming/CollideImage and Objects not Integers

Grey Alien(Posted 2007) [#1]
Hiya, CollideImage() is cool, and I use it quite a lot. The only limitation I've found is that quite often I want to return a simple Integer indicating the index of the image that has collided. However, the ID:Object parameter won't accept a simple Integer so I've wrapped it in a Type like this:

Type TCollideObject
Field Value%
End Type

This obviously works fine, but am I missing something more simple? Thanks


tonyg(Posted 2007) [#2]
Convert the index to a string?


Dreamora(Posted 2007) [#3]
If you never put in strings, you could simply use a string.

But I would actually advice to use a collision object that has an eventHandler function you call when it collides.
This lets you simplify your code design drastically without sacrificing anything.

(you would just need to think of the eventHandlers parameters. I normally have this, other, collisionData. This is only needed until we get delegates or a similar mechanism)


Grey Alien(Posted 2007) [#4]
TonyG: Ah yes, I guess that would work, thanks It's the reason you can't make TLists of Integers, only Ints converted into Strings.

Dreamora: Yeah objects certainly have something going for them in that respect, but at the moment my objects that I'm colliding are just Integer storage.