dthrasher90 Posted February 28, 2017 Share Posted February 28, 2017 Hey guys, Im still having trouble moving objects. If I have a dot resting at (500,200) and I want to move him aloing the x axis for 50px and then up the Y axis for 50 px, how does one accomplish this? I want to use increments and not coordinates, basically say, you go that way for 50 px and then this way for 50 px. Link to comment Share on other sites More sharing options...
dthrasher90 Posted February 28, 2017 Author Share Posted February 28, 2017 The other caveat is that this will be automated, not on key press Link to comment Share on other sites More sharing options...
samme Posted February 28, 2017 Share Posted February 28, 2017 3 hours ago, dthrasher90 said: I want to use increments and not coordinates examples/v2/tweens/tween-relative Link to comment Share on other sites More sharing options...
dthrasher90 Posted February 28, 2017 Author Share Posted February 28, 2017 Yes, just what I was looking for! is there a way to chain tweens? like tween.to(here). then tween.to(here)? Link to comment Share on other sites More sharing options...
dthrasher90 Posted February 28, 2017 Author Share Posted February 28, 2017 I have chaining figured out. Thanks again Link to comment Share on other sites More sharing options...
samme Posted March 1, 2017 Share Posted March 1, 2017 You can call to/from consecutively to add to the timeline: var tween = game.add.tween(/*…*/) .to(/*…*/) .to(/*…*/) .to(/*…*/) .start() This is actually different from chaining tweens (I didn't know this at first!), which is var tween = game.add.tween(/*…*/) .chain( game.add.tween(/*…*/) ) Link to comment Share on other sites More sharing options...
dthrasher90 Posted March 1, 2017 Author Share Posted March 1, 2017 Thanks! This is what I had come up with: var tweenA = game.add.tween(wr1) .to({ x: '-200'}, 2000); var tweenB = game.add.tween(wr1) .to({ y: '+200' }, 2000); then in the function: tweenA.chain(tweenB); tweenA.start(); Link to comment Share on other sites More sharing options...
dirtyNoob09 Posted March 25, 2017 Share Posted March 25, 2017 what is the function of wr1? is it a variable? i want to chain my 2 character will you pls.. do me a favor creat me a code like chaining to characters pls... Link to comment Share on other sites More sharing options...
Recommended Posts