Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Issue with agk::SetSpriteShapeBox

Author
Message
gsdblack
12
Years of Service
User Offline
Joined: 6th Dec 2011
Location:
Posted: 2nd Mar 2012 11:30
I'm trying to create a collision box around a sprites feet with agk::SetSpriteShapeBox but when I to set different sprite positions the collision box moves.
Greg_C
13
Years of Service
User Offline
Joined: 22nd May 2010
Location:
Posted: 2nd Mar 2012 21:54
Its because GetSpriteX returns the X coordinate of the sprite(its position). So if you position your sprite at 30,30 then GetSpriteX is going to return 30. I have tried the SetSpriteShapeBox and its pretty simple. If your sprite is 20x40 lets say and you wanted to draw its physics box at the bottom of your sprites feet the numbers would be close to this:

Top Left
X =0
Y =30//This puts it just above the bottom of the sprite

Bottom Right
X = 20
Y = 40//Will put the bottom of the physics box at the bottom of the sprite.

So:

gsdblack
12
Years of Service
User Offline
Joined: 6th Dec 2011
Location:
Posted: 3rd Mar 2012 06:24
Thanks so much!!!!!!!!! Now I'm stuck anymore and I can actually finish my game.
gsdblack
12
Years of Service
User Offline
Joined: 6th Dec 2011
Location:
Posted: 3rd Mar 2012 07:00
Now I'm not* stuck anymore and I can actually finish my game.

Login to post a reply

Server time is: 2024-05-02 11:31:07
Your offset time is: 2024-05-02 11:31:07