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 / SetSpriteShape doubt

Author
Message
pamercomov
FPSC Reloaded TGC Backer
9
Years of Service
User Offline
Joined: 2nd Jan 2015
Location: palma de mallorca
Posted: 29th Dec 2015 06:37
hi alls
i have a doubt abaut this command "SetSpriteShape"

when i have an animated sprite and need poligon shape create, how i can create this if i load the image of sprite of a atlas?
or how i can make this if load the images one to one ?

no for phisycs collisions

very thx.

this community is wonderfull
using AppGameKit V2 tier 1
BraindeaD
16
Years of Service
User Offline
Joined: 30th Mar 2008
Location:
Posted: 29th Dec 2015 08:18
Hi Pamercomov,

I use this to assign a polygonal shape to an animated sprite and it works for me:

myspr=createsprite(img) //create sprite with the atlas image
SetSpriteAnimation(myspr, 68, 152, 20 ) //set the animation frames width = 68, height=152 and 20 frames
SetSpriteShape(myspr,3) //set the sprite shape

If you want to be sure that the shape is correct, you can use the SetPhysicsDebugOn() statement to see how the shape is built.
Hope it helps!

Regards.
pamercomov
FPSC Reloaded TGC Backer
9
Years of Service
User Offline
Joined: 2nd Jan 2015
Location: palma de mallorca
Posted: 29th Dec 2015 12:02
hi brain. u have a PM .
using AppGameKit V2 tier 1
BraindeaD
16
Years of Service
User Offline
Joined: 30th Mar 2008
Location:
Posted: 29th Dec 2015 15:17
Hi Pamerco, PM answered!
JLMoondog
Moderator
15
Years of Service
User Offline
Joined: 18th Jan 2009
Location: Paradox
Posted: 29th Dec 2015 18:06
A trick I've come up with is to have the first frame in my atlas be a simplified solid shape of my character, make sure the sprite is on the first frame after loading, than use the set polygon shape command. This allows you to control the shape and simplify the boundaries so it takes on the bulk of the object instead of creating a wacky, irregular polygon shape.
BraindeaD
16
Years of Service
User Offline
Joined: 30th Mar 2008
Location:
Posted: 30th Dec 2015 08:14
It is a good trick, JLMoondog. Thanks for sharing.
pamercomov
FPSC Reloaded TGC Backer
9
Years of Service
User Offline
Joined: 2nd Jan 2015
Location: palma de mallorca
Posted: 30th Dec 2015 17:27
yes... good trick, jlmoondog.
using AppGameKit V2 tier 1

Login to post a reply

Server time is: 2024-09-29 09:21:31
Your offset time is: 2024-09-29 09:21:31