[behavior] rex_LJpotential (attracting or rejecting objects)

  • rexrainbow

    Interesting plugin, i am trying to understand it but im stuck... i am trying to edit your crowd with 2 sources and 2 targets to see how they interact:

    https://dl.dropboxusercontent.com/u/169 ... rowd2.capx

    But i just cant get it to work... for ones to go from left to right and for others from right to left... <img src="{SMILIES_PATH}/icon_e_sad.gif" alt=":(" title="Sad">

    Help!?

    TNX!

    PS:

    when i stop units by bullet disable, they still rotate under other units forces ...

    How do i just dead stop units to be like solid?

  • irina

    Disable event 4, event 6 to stop them. You might add more conditions to pick disabled instances.

    Edit

    Rotating or other movement are controlled in event sheet by designer. So they could be disable very easily. This rex_LJpotential will not affect sprite.

  • Are the cars driving with constant speed, even in a turn? I'm asking, because I'm racking my brain how to simulate a race. The cars have differen engines with different speedups, some have better brakes some better tires which all effect there way of driving and in the end there result. Well, and in a real car race, there have to be a brakeingpoint (the last/best moment where the driver hits the brake). This is very important, because some drivers (or cars) will brake later then others, which will give them an edge (in case they don't brake to late). I'm trying to simulate that action in a way. I searched the web but evertime I thougt I found something, the cars were never hitting the brake....it looks kind of automatic for me....not like a real race. Even though this is by far the best race-example for construct2 I have seen. Maybe someone has an idea, how to combine the "AI of Race car v2" example with my request. Or maybe a totaly different solution. It would really help me a lot, even the smallest hint, because I'm nearly giving up on this.

  • rexrainbow I tried cloning all of the events and objects into a new project for playing with, but the cars don't start. What's missing that should make them move? https://www.dropbox.com/s/kpyvn92j9poln ... .capx?dl=0

  • This behavior only provide a "leading angle", the car controlling by using this leading angle is another issue.

    Sorry I could not help you.

  • Zebbi

    Check the setting of this rex_LJpotential behavior in family CarF, sprite waypint, sprite blocker. You could copy from my sample capx.

  • Zebbi

    Check the setting of this rex_LJpotential behavior in family CarF, sprite waypint, sprite blocker. You could copy from my sample capx.

    Aww, I'm sorry for bothering you with this, it was my fault, I forgot to setup the objects the same, really apologize for not checking that first. Can I just take the opportunity to say what an amazing plugin this is, so many useful applications to it, so many of your plugins are invaluable!!

  • Zebbi

    Check the setting of this rex_LJpotential behavior in family CarF, sprite waypint, sprite blocker. You could copy from my sample capx.

    Two questions, how many instances o a waypoint can you have? I've made 10, and the 11th is causing the car to drive down towards the bottom of the screen. If I delete it so there's 11, it's okay. Also, what are blockers for? I would assume to top the car from going to waypoints behind walls, but I'm finding it's not really doing that?

    https://www.dropbox.com/s/0177n4jbck3gr ... .capx?dl=0

    EDIT: Fixed it by changing the indexes of each waypoint <img src="{SMILIES_PATH}/icon_e_biggrin.gif" alt=":D" title="Very Happy">

  • Zebbi

    Yes, the order of waypoint is set in private variable, you might replace it by your picking method.

  • Zebbi

    Yes, the order of waypoint is set in private variable, you might replace it by your picking method.

    rexrainbow So, you could pick, say, nearest waypoint instead of using fixed indexes?

    Finally, what's the best way of doing laps with the car? Currently, the goal function runs when it reaches the last way point, how can I make the car go round again to the first waypoint?

  • Zebbi

    Sine I uses private variable to sort waypoint in instance group object, and pick them in order. I could put them back and sort them again while the group is empty, i.e. car had hit the last waypoint.

  • Zebbi

    Sine I uses private variable to sort waypoint in instance group object, and pick them in order. I could put them back and sort them again while the group is empty, i.e. car had hit the last waypoint.

    I'm trying to see if there's a way to call the initial function that clears and orders the waypoint instances when the car hits the last waypoint, is this possible? And how?

  • Zebbi

    Call function "Waypoints.Init" (Guide event sheet) to reset the waypoints. Checking if the car had hit the last waypoint is in event 9, event sheet Car AI.

  • Zebbi

    Call function "Waypoints.Init" (Guide event sheet) to reset the waypoints. Checking if the car had hit the last waypoint is in event 9, event sheet Car AI.

    Thanks, that's working, the cars do a kinda cute little loop-the-loop and then they set off again <img src="{SMILIES_PATH}/icon_lol.gif" alt=":lol:" title="Laughing"> Do I need to reset the way point earlier to avoid this? https://www.dropbox.com/s/nl57zl4k2c4yx ... .capx?dl=0

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Zebbi

    I fixed in this capx, see event 9.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)