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 / Changing Sprite Physics in game dosent work

Author
Message
haliop
User Banned
Posted: 8th Oct 2014 11:30
i have a ball sprite with physics set to 2
it falls down until hitting a surface
when it hits the surface
i change its
SetSpritePhysicsOn(sprite,1) to static so it would stay there.

this dosent work.

Settting the sprite physics Off and then On dosent work also...

any suggestions ?

Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 8th Oct 2014 13:11 Edited at: 8th Oct 2014 13:12
hmm, can u make a example from it?
suggestions :try set velocity to 0

AGK 108 (B)19 + AppGameKit V2 Alpha .. : Windows 8.1 Pro 64 Bit : AMD Radeon R7 265
Funnell7
13
Years of Service
User Offline
Joined: 8th Sep 2011
Location: UK, England
Posted: 8th Oct 2014 13:42
Haliop, which version of AppGameKit are you using? I do this alot and it works fine for me (using AppGameKit V108)...

I know you have mentioned that you already tried this, but are you sure you are first turning off the physics for the sprite, before turning it back on, i.e.

baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 8th Oct 2014 15:42 Edited at: 8th Oct 2014 15:45
Funnell7's suggestion is nearly right it should be:
SetSpritePhysicsDelete(spr)
SetSpritePhysicsOn(spr, 1)

EDIT: I'll clarify further. SetSpritePhysicsOff should only be used to temporarily turn the current physics settings off, SetSpritePhysicsDelete can be used to remove all physics so that you can change a sprite from static to dynamic to kinematic. Hope that makes sense!
Funnell7
13
Years of Service
User Offline
Joined: 8th Sep 2011
Location: UK, England
Posted: 8th Oct 2014 16:56
Quote: "SetSpritePhysicsOff should only be used to temporarily turn the current physics settings off"


Damn! You are absolutely correct! I was working from memory, didn't actually have my project in front of me...
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 8th Oct 2014 17:12
I had to double check
haliop
User Banned
Posted: 9th Oct 2014 00:58

Login to post a reply

Server time is: 2024-11-25 10:58:57
Your offset time is: 2024-11-25 10:58:57