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 / Can you extend a sprite's collision shape beyond the boundaries of the sprite?

Author
Message
DavidAGK
AGK Developer
10
Years of Service
User Offline
Joined: 1st Jan 2014
Location:
Posted: 23rd Dec 2014 16:48
As per the title, I'd like to have a sprite with for example dimensions 64px by 64px but have it's sprite shape (collision shape) extend so say 64px by 128px so that it extends past the sprites dimensions. Is this possible or does the sprite collision shape have to be within the bounds of the sprite image?

I'm just doing some planning and don't have access to my AGK.
Yodaman Jer
User Banned
Posted: 23rd Dec 2014 18:06
I'm not sure, but if it isn't possible would this work?
Attach two sprites together and hide the large one and use that for the collision shape, and it should work just fine. Kind of like the character controllers in Unity.


7+ years and counting!
DavidAGK
AGK Developer
10
Years of Service
User Offline
Joined: 1st Jan 2014
Location:
Posted: 23rd Dec 2014 18:17
Yes, I thought about that and there's a command that allows for you to detect sprite collisions with an arbitrary box….but trying for a simple solution. I've got my main player split into body and legs, so hoping to be able to extend the body hit box down to encompass the legs too.
Funnell7
13
Years of Service
User Offline
Joined: 8th Sep 2011
Location: UK, England
Posted: 23rd Dec 2014 19:06
I haven't tried it, but I imagine you can do this with SetSpriteShapeBox( iSpriteIndex, x, y, x2, y2, angle )...
smallg
Valued Member
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location: steam
Posted: 23rd Dec 2014 21:39
yes use the setspriteshape commands

life's one big game
spec= 2.6ghz, 1gb ram, 512mb gpu, directx 9.0c, dbpro and classic
DavidAGK
AGK Developer
10
Years of Service
User Offline
Joined: 1st Jan 2014
Location:
Posted: 23rd Dec 2014 21:40
Cool cheers guys.

Login to post a reply

Server time is: 2024-11-25 14:51:06
Your offset time is: 2024-11-25 14:51:06