Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Alternative to using transition.* and delterPerFrame on the same object.
Started by elifares Jul 09 2018 08:08 PM

3 replies to this topic
transition deltaperframe enterframe move

Best Answer remiduchalard , 10 July 2018 - 06:11 AM

Hello,

Transition and enterframe work quite bad together but that's normal.

Transition are only an easy way to move an object.

Enterframe let you do everything.

 

I think you need only enterframe where you do everything.

 

For x moving it's not changing (you add always the same value).

For y it's changing when the player fall or move.

When the player go up, you have to move like this function   ( easing.inOutQuad ) to do that you don't need transition you can use normal math :)

When the player fall you have already the answer

 

If you want to do with only transition.

Have many transitions who don't interact with the same parameter of the object

When the player go up or fall. Cancel some transitions and create new one.

 

I really don't know what is the best solution for you because, transition are sometime smoother than enterframe (I don't know why)

[TOPIC CONTROLS]
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

elifares

[GLOBAL: userInfoPane.html]
elifares
  • Enthusiast

  • 66 posts
  • Corona SDK

I don't want to post duplicate threads and even though some of this content was covered here, this is somewhat of a different problem regarding the same issue.

 

Here I have a player object that moves up/down using deltaPerFrame and then moves back using transition. when they collide with another object. I decided to use deltaPerFrame in the up/down movement because I want that movement to be constant (no acceleration) however for the backward (left) directional movement, I was to use easing to create a "burst" motion and then slowing down at the end.

 

The problem I am running into is players cannot move up/down while they are moving backwards and it looks like lag or a glitch when it really isn't. I just found out recently that transition. and enterFrame don't play nice together. Does anyone have any ideas for some alternatives that can get this same behaviour? I thought I'd ask for some bright ideas before I deep dive into any code changes. Thanks.

 

Attached File  playerMovement.png   74.51KB   0 downloads



[TOPIC: post.html]
#2

remiduchalard

[GLOBAL: userInfoPane.html]
remiduchalard
  • Contributor

  • 298 posts
  • Corona SDK

  Best Answer

Hello,

Transition and enterframe work quite bad together but that's normal.

Transition are only an easy way to move an object.

Enterframe let you do everything.

 

I think you need only enterframe where you do everything.

 

For x moving it's not changing (you add always the same value).

For y it's changing when the player fall or move.

When the player go up, you have to move like this function   ( easing.inOutQuad ) to do that you don't need transition you can use normal math :)

When the player fall you have already the answer

 

If you want to do with only transition.

Have many transitions who don't interact with the same parameter of the object

When the player go up or fall. Cancel some transitions and create new one.

 

I really don't know what is the best solution for you because, transition are sometime smoother than enterframe (I don't know why)


  • elifares likes this

[TOPIC: post.html]
#3

ldurniat

[GLOBAL: userInfoPane.html]
ldurniat
  • Contributor

  • 325 posts
  • Corona SDK

Hi elifares,

 

I agree with @remiduchalard. Try reproduce calculations done by transition function using easing functions from EmmanuelOga/easing project on github or build your own. 

 

Have a nice day:)

 

ldurniat 


  • elifares likes this

[TOPIC: post.html]
#4

elifares

[GLOBAL: userInfoPane.html]
elifares
  • Enthusiast

  • 66 posts
  • Corona SDK

Thanks for your suggestion guys! Looks like I'll be using only enterFrame to do everything :)

Cheers!




[topic_controls]
[/topic_controls]

Also tagged with one or more of these keywords: transition, deltaperframe, enterframe, move