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 / CreatePhysicsForce - Repel and Attrack

Author
Message
Mamute
22
Years of Service
User Offline
Joined: 16th Oct 2002
Location:
Posted: 17th May 2013 13:08
Hello guys !

Do any of you have examples with CreatePhysicsForce attracting and repelling sprites from some x,y coordinates ?

Also DeletePhysicsForce doesn't seem to work... any ideas how to use it ?

force = CreatePhysicsForce( 200, 200, 100, 0, 0, 0 )

DeletePhysicsForce(force) -> not working

Thanks !!

|MaMUtE|
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 17th May 2013 17:05
What version of AppGameKit are you using?

How is the DeletePhysicsForce command not working? Do you mean that the force still exists after you've deleted it?

Are you seeing this in only Windows or when testing on iOS or Android devices (either with Player or stand alone)?

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
Mamute
22
Years of Service
User Offline
Joined: 16th Oct 2002
Location:
Posted: 18th May 2013 20:31
Thanks for the help Ancient Lady !

Anyway this was my bad. DeletePhysicsForce is working.

I was creating several instances of CreatePhysicsForce within a FOR NEXT loop..like :

for i = 1 to 3
force = CreatePhysicsForce(.......)
next i
DeletePhysicsForce(force)


The above doesn't work as I am creating the force (assigned always to the variable force) 3 times. So I put the command beforce the FOR loop.

Nevertheless the DeletePhysicsCommand should work as well assuming only when i=3 the force variable is created again.

I dunno why AppGameKit doesn't have CreatePhysicsForce with a first parameter being the Index..like: CreatePhysicsForce(forceIndex,...) like other sprite parameters and others have.

Best Regards !

|MaMUtE|
basjak
14
Years of Service
User Offline
Joined: 16th Apr 2010
Location: feel like signing up for mars
Posted: 19th May 2013 13:45
here is a good example of global forces. ignore a bit the code as I was trying different stuff but concentrate on the global forces.

press the left mouse button for forced to move away from the center.

Attachments

Login to view attachments

Login to post a reply

Server time is: 2024-11-24 14:28:51
Your offset time is: 2024-11-24 14:28:51