Posted: 16th Mar 2007 17:06
Is there an EASY way to do a mouseclick() and sprite collision? Or do i have to do the If the mouse is in the coords of the sprite? I want to click on a sprite with the mouse and have it do something.

Thank You
Lord SilverStone
PS Sorry if this is already covered in another post but i find the searching a little difficult to get exactly what i want.
Posted: 16th Mar 2007 17:35
Take a look at SPRITE HIT() and SPRITE COLLISION()
Posted: 16th Mar 2007 17:46
From the way I read it, I need to turn my mouse pointer into a sprite. And it should work perfectly. That shouldn't be to difficult to do.

Thank you very much.
Posted: 16th Mar 2007 17:47
I position a 1x1 sprite at the mouse coordinates each loop, then build a collision queue with all of my on screen sprites using the Sprite Collision() command. Pixel perfect sprite collision is very fast done that way, especially if you build all of your collision memblocks first.
Posted: 16th Mar 2007 17:50
So you are saying if i make a sprite that is 1x1 and color it black so the user cannot see it and link it to where the mouse moves it would work. I will def try that. Thanks for the info.

Lord SilverStone
Posted: 16th Mar 2007 23:31
The only problem with this method, though, is potential lag on slower computers (or fast computers running intensive programs). In other words, the sprite doesn't always keep up with the mouse, especially when the mouse is moving around very quickly. So if you move the mouse quickly and click - the recorded click position can be a little behind where you meant it to be.

For this reason, where possible, I use the coordinate checking method. This is very easy for non rotated rectangular sprites - it gets more complicated for rotated rectangular sprites - but for irregular shaped sprites I would imagine close to impossible.

Use the method which suits your needs the best.
Posted: 17th Mar 2007 0:23
That is true Ric, when the framerate is very low it does lag behind a big. Not terribly, really, and it is an absolute must for detecting collisions with irregular sprites. I have irregular packs and bags in Geisha House, and dragging them around with pixel perfect collision is a must.

@Lord SilverStone -
You can hide the sprite and collisions will still work properly. You've got to remember this though, any hidden sprites will still collide. You've got to test whether or not it is visible for the collision to be valid.
Posted: 14th Jul 2007 22:49
I will have to test it out with using the coordinates way and see how well it works on a slower machine. For right now I got the sprite collisions working perfectly and everything is nice. I just don't like the lag at the beginning when everything is loading up. Takes about 10 to 20 seconds to load the game up. I am assuming this is due to the size of some of my images. One of my images is just under 600k(my background). It is a PNG and needs to be a PNG due to the transparency. I have found that the transparency works best with PNG than using JPG or BMP. The only solution I can think of is break up the image and load it up as a few seperate images.

What do you guys think?

Tom Maine.