Lag time by using the global variable when moving blocks.
Hi,
I am making two blocks. One on bottom and the other on top. I also make a global x coordinate equal to the x coordinate of the bottom block. Then make the x coordinate of the upper block equal to the global x variable.
They move together according to the X coordinate, but there is still some lag time. How I can solve it. Many Thanks.
K.C.
I am making two blocks. One on bottom and the other on top. I also make a global x coordinate equal to the x coordinate of the bottom block. Then make the x coordinate of the upper block equal to the global x variable.
They move together according to the X coordinate, but there is still some lag time. How I can solve it. Many Thanks.
K.C.
Comments
2. You can tell us how you are moving the bottom block (e.g. Move behavior, drag and drop via constrain to mouse position, etc.) and how quickly (e.g. speed=50, speed=600, etc.).
3. You can post a video showing an example of the lag.
4. You can post your rules for the two blocks.
Hi @kentcheung2000@yahoo.com
Good advice from @tatiang, @Socks and @FryingBaconStudios
To add: whatever the cause of the lag, the possibility that it's caused by using a global attribute instead of a scene or self attribute is practically nil.
@FryingBaconStudios Interesting tests, Dave. :-)
I'm certain you know the third way to ensure a "no lag drag"; – I'll mention it for anyone else's info:
put the following Rule in one actor (nothing in the other):
Rule: When Touch is pressed
Constrain Attribute self.Position.X to game.Touches.Touch 1.X
Constrain Attribute self.Position.Y to game.Touches.Touch 1.Y
Constrain Attribute scene.Background.Actor 2.Position.X to self.Position.X
Constrain Attribute scene.Background.Actor 2.Position.Y to self.Position.Y
@gyroscope... isn't that cheating? Cool idea, I hadn't thought of that.
Try it yourself, change the order of the 'handle' and the 'head':
http://www.mediafire.com/?9181p3ea2tjf9bx
@FryingBaconStudios Very true, Dave! :-) Hi @tatiang Not sure if you meant this "tongue-in-cheek" or not.... ;-) If not, I'm interested to know in what way you think it might be cheating?
-------
Edit: ah, I think I'm understanding: there IS a lag time using intermediary attributes in this case, but for the record, @kentcheung2000@yahoo.com , there will still be a lag whether it's an extra set of scene, self or global attributes used; the reason being that you're adding an extra "layer" of processing which isn't needed.
So I guess, @tatiang, you mean my solution I gave, although it works, doesn't involve any intermediary attributes... so it's sort of cheating (?!)... don't know still... anyhow, time I had a cup of tea.... :-) ~O)
I called it "cheating" because I've never though to constrain another actor's attributes to an unlocked actor that way. As in, "you can do that?!"