Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]

Moving arrow down and up
Started by tima.xxxyyy Sep 14 2019 08:48 AM

1 reply to this topic
animation sprites
[TOPIC: post.html]


[GLOBAL: userInfoPane.html]
  • Observer

  • 7 posts
  • Corona SDK

So, I'm making a training to my game, where shows basics og my game. And I need arrow that pointing at something and moving(like this:)Attached File  Forum_corona2.png   30.09KB   0 downloads


P.S And "animate" text like that too

[TOPIC: post.html]

XeduR @Spyric

[GLOBAL: userInfoPane.html]
XeduR @Spyric
  • Contributor

  • 944 posts
  • Corona SDK

There are quite a few ways of accomplishing this.


The most visually stylish way would probably be to create a sprite animation. That way, you could make the arrow bounce and/or rotate as it goes up and down. That's how I'd go about doing this.


Another way would be to create two sets of transitions. First, you'd create a transition that brings the arrow up (or down). You can use one of Corona's easing functions to make the arrow move at different speeds at different points in time (https://docs.coronalabs.com/api/library/easing/index.html). Then, add an onComplete to the first transition that starts the second transition. This time, use a different easing and move the arrow in the opposite direction. Again, add an onComplete that starts the first transition all over again.


Here's some pseudo code.

local arrowTransition

function transition1()
	arrowTransition = transition.to( target, { time=1000, y=Y1, transition=easing.SOMETHING, onComplete=transition2 } )

function transition2()
	arrowTransition = transition.to( target, { time=1000, y=Y2, transition=easing.SOMETHING_ELSE, onComplete=transition1 } )

  • sporkfin likes this


Also tagged with one or more of these keywords: animation, sprites