Posted: 16th Aug 2011 18:00
Hi,
I'm turning crazy trying to apply a simple force to a sprite..
All is setup ok as I've started with the example of restitution from AppGameKit, but I'm not capable of doing something more aplying forces to the balls...
somebody could help me please?
Posted: 16th Aug 2011 18:02
This example covers forces: http://www.appgamekit.com/documentation/examples/physics/3_simple.htm
Posted: 2nd Dec 2011 7:18
I don't see that example as being one of applying a force to the sprite... rather just assigning a velocity to it.

Is there some place/command/example, where we could see how to apply a *force* to a sprite? (the velocity would be a result of the force over time)
Posted: 2nd Dec 2011 10:20
Here's an example of how to add forces to sprites:
+ Code Snippet
rem Landscape App
SetDisplayAspect( 4.0/3.0 )

setPrintSize(3)

createSprite(1,0)
setSpriteSize(1,4,-1)
setSpriteOffset(1,2,getSpriteHeight(1)/2)
setSpritePosition(1,50,50)
setSpritePhysicsOn(1,2)

rem A Wizard Did It!
do
    Print("Left Click to apply a vertical force on the sprite")
    Print("Right Click to apply a pointer based force")
    if getRawMouseLeftState()=1
        setSpritePhysicsImpulse(1,getSpriteXbyOffset(1),getSpriteYbyOffset(1),0,-10)
    endif
    if getRawMouseRightState()=1
        dx# = getSpriteXbyOffset(1)-getPointerX()
        dy# = getSpriteYbyOffset(1)-getPointerY()
        fx# = 142-dx#
        fy# = 142-dy#
        setSpritePhysicsImpulse(1,getPointerX(),getPointerY(),dx#,dy#)
    endif
    
    Sync()
loop