****SOLVED****
Hello all!
Im having a little trouble with setting up a sprite for collision. Why? Because I have added an X offset and update the angle every render to make the sprite orbit the center of the screen. Problem is, that AppGameKit thinks that the sprite literally is at a specific X and Y value which doesn't change. Therefore traditional collision checking won't work
integer GetSpriteCollision( iSprite1, iSprite2 )
So I thought that maybe physics was going to help me... nope. haha
I've been messing around with several different methods and I've managed to create the collision "sphere" that I want... Problem is, because the X and Y coordinates aren't changing... The sprite's collision "sphere" isn't moving...
Setting up my moving sprites:
For i = 1 to 4
Enemies[i].Sprite = CreateSprite ( LoadImage ( Enemies[i].Image ) )
SetSpriteSize ( Enemies[i].Sprite , Enemies[i].SizeX , Enemies[i].SizeY )
SetSpriteVisible ( Enemies[i].Sprite , 0 )
SetSpriteOffset ( Enemies[i].Sprite , -1250 , 0 )
SetSpriteAnimation ( Enemies[i].Sprite , Enemies[i].SizeX , Enemies[i].SizeY , 32 )
SetSpritePosition ( Enemies[i].Sprite , 100 , 100 )
SetSpritePhysicsOn ( Enemies[i].Sprite , 3 )
SetSpriteShapeCircle ( Enemies[i].Sprite , GetSpriteXByOffset ( Enemies[i].Sprite ) , GetSpriteYByOffset ( Enemies[i].Sprite ) , 64 )
Next i
Setting up my "center of screen sprite":
//World
World = CreateSprite ( LoadImage ( "world.png" ) )
SetSpriteSize ( World , 256 , 256 )
SetSpritePosition ( World , 832 , 412 )
SetSpriteAnimation ( World , 512 , 512 , 32 )
SetSpriteColorAlpha ( World , 0 )
SetSpritePhysicsOn ( World , 1 )
SetSpriteShapeCircle ( World , 0 , 0 , 100 )
Updating the Moving sprite's position:
Inc Enemy_Offset_1 , 2
If GetSpritePlaying ( Enemies[Enemies_Random[1].Sprite].Sprite ) = 0 Then PlaySprite ( Enemies[Enemies_Random[1].Sprite].Sprite , 30 , 1 )
SetSpriteVisible ( Enemies[Enemies_Random[1].Sprite].Sprite , 1 )
SetSpritePositionByOffset ( Enemies[Enemies_Random[1].Sprite].Sprite , GetSpriteX ( World ) + GetSpriteWidth ( World ) / 2 , GetSpriteY ( World ) + GetSpriteHeight ( World ) / 2 )
SetSpriteAngle ( Enemies[Enemies_Random[1].Sprite].Sprite , timer ( ) * Player_Speed# + 30 )
SetSpriteOffset ( Enemies[Enemies_Random[1].Sprite].Sprite , Enemy_Offset_1 , 0 )
Checking for collision:
//Check Collision
_Check_Collision:
For i = 1 to 4
If GetSpriteInCircle ( Enemies[i].Sprite , 1920/2 , 1080/2 , 128 ) = 1
print ( "AAAAAAAAAAAAAAAAAAAAAAAAAAAAA")
Endif
Next i
Return
Here is a picture of what I mean:
http://imgur.com/bRI30Es
All help is appreciated!
nope.