[Solved] How to create magnet-like effect between two actors

Zoyberk

  • Posts: 15
Hi,

Is there a way to make two actor attract each other in magnet-like way?
Preferably without using code-mode :D

I cant think of any >.<

« Last Edit: July 09, 2011, 07:36:10 am by Zoyberk »

Epic428

  • Posts: 1118
Off the top of my head, I would think that you might want to create a region with a specific radius. Have the center of the region be located at the center of one of the two actors. Then whenever you detect the other actor in the region, push both actors toward each other at a certain speed.

There may be a better way to do this, and I could see this becoming somewhat problematic if both actors are the same type given that both will be performing the same actions.
James Moore - Official Support & Documentation.
We cannot and will not respond to PM's asking questions. Please make a new thread in the forums if you have any questions, Thank you.
For better support and faster response times, please post your logs regarding any Stencyl related issues. Debug > Logs > Generate Logs

Mkk-Bote

  • Posts: 16
Maybe the attachment will help.
Attach it to your scene where you like to use it. The attributes are the actors which you like to use, the distance with the range of the magnet and the speed which the magnet should use (Warning: I didn't test it ;))

« Last Edit: July 08, 2011, 11:04:50 am by Mkk-Bote »

Alexin

  • *
  • Posts: 3130
Check out the behavior Magnet on StencylForge. Don't forget to read the descriptions.

Basically, you attach it to two actor and they attract each other. You can configure or modify it to suit your needs.

EDIT: Place your actors on a scene and enable Actor Customization to set the Target Magnet attribute.
"Find the fun"
alexin@stencyl.com

Zoyberk

  • Posts: 15
awesome, thanks =)

NinoRules91

  • Posts: 12
Hmmm and how can I do if I have an actor type " Coin " which appears every 0.4 seconds in the scene ( so the actor isn't in the scene, it appears with code blocks ) and when I take a magnet in the game, the " Coin " actors are going to the player during 5 seconds ? Because with the Magnet Behavior it only works with actors who are already in the scene ???

tophatgames

  • Posts: 4
Download the demo game "infinite space shooter" and the magnetic effect on the coin from there is useful.