Help with variables and list positions.

DELETED_117713

  • Posts: 771
So I want to make a list that tracks the X and Y position of a player, then delay it a bit, so it tracks a bit behind, so that the actor being applied to those positions is following. I have tried doing a following script many times, but they were buggy.

My logic of this was:


  • Set the lists to add the x and y positions on every frame.
  • The actor would snap to an older part of the said lists, so that it's position is lagged behind.

But when I do this, it instead isn't lagging behind, but is doing a perfect sync.

Here's a snippit of code of what I did.



EDIT: Ignore the obvious true/false question. Didn't see that I redid the code while screencapping.

« Last Edit: September 20, 2016, 07:56:18 pm by fillergames »

LIBERADO

  • *
  • Posts: 2720
Too easy.
Use this code in the Follower actor:
   

« Last Edit: September 20, 2016, 10:55:10 pm by LIBERADO »
I'm spanish, excuse me for my bad English.
I'm not a private teacher. Please, post your questions in the public forum.

DELETED_117713

  • Posts: 771
Yes. This worked with a bit of tweaking.

Another thing, is it possible to determine via true/false if the player is colliding with anything? Because that would seem to be the next logic step, and I was stumped.

LIBERADO

  • *
  • Posts: 2720
Another thing, is it possible to determine via true/false if the player is colliding with anything?

I'm spanish, excuse me for my bad English.
I'm not a private teacher. Please, post your questions in the public forum.

chrizt

  • Posts: 345
is there any special reason why you set colliding to collision and check colliding instead of checking collision directly but put set to false after checking?
need help with behavior? game design? graphic design? just contact me
skype : christian.atin
email : christianatin27@gmail.com

LIBERADO

  • *
  • Posts: 2720
is there any special reason why you set colliding to collision and check colliding instead of checking collision directly but put set to false after checking?
Yes, there is an important and convenient reason.
If you check the boolean directly and set it to false after checking, then it will always be false if you check it again in any other event. However, if you check the boolean, then you will be able to check it again in any other events where you could need to know if the actor is currently colliding or not.

In summary:
   
If you check the boolean, you can check the actor collision state in one event only.
If you check the boolean, you will be able to check the actor collision state in multiple events.

So, checking the boolean is much more reliable and useful.

(Try to check both booleans in more than one event and you will quickly understand what I mean.)

« Last Edit: September 21, 2016, 03:18:10 pm by LIBERADO »
I'm spanish, excuse me for my bad English.
I'm not a private teacher. Please, post your questions in the public forum.