2D: SpritePixelCollision with transparent Sprite
Posted: Fri Jul 16, 2010 5:18 pm
Hi,
in wanna check if the crosshair is above a visible pixel of a sprite.
I load 2 sprites:
I place the building (with some transparent windows) on the screen:
Now i want to check the collision:
Are the parameters for the building correct? Because it's on a fixed place... or should i put there the values of it's position (300,150) in instead of the mouse positions?
Thanks,
PHP
in wanna check if the crosshair is above a visible pixel of a sprite.
I load 2 sprites:
Code: Select all
CatchSprite(#Sprite_Crosshair,?Image2):DataSection:Image2:IncludeBinary "gfx\crosshair.bmp":EndDataSection
CatchSprite(#Sprite_Building,?Image6):DataSection:Image6:IncludeBinary "gfx\building.bmp":EndDataSection
Code: Select all
DisplayTransparentSprite(#Sprite_Building,300,150)Code: Select all
If SpritePixelCollision(#Sprite_Crosshair,MouseX(),MouseY(),#Sprite_Building,MouseX(),MouseY()) And MouseButton(1)
; do something
EndIfThanks,
PHP