Jump to content

Tween vs Velocity: Is there a difference in performance?


terencechow
 Share

Recommended Posts

I am making a flappy bird type game right now where the player only moves up and down and the background moves right to left. Visually this looks like the player is flying through the different backgrounds

 

I have 8 backgrounds in total but only 3 ever alive at a given time. 1 shown, 2 offscreen.

 

Right now I've added physics arcade to the backgrounds and simply set the velocity in the x direction to a number. This moves the background from right to left.

 

However since my game is lagging, I'm wondering how significant is tweening vs using velocity. That is, if I don't use physics on these background images, and simply tween it from right to left, will I gain a lot in performance? Or not much at all?

 

 

Link to comment
Share on other sites

Intuition tells me that using a physics engine for moving an object at a single direction and constant speed will consume more resources.

Also, if background images don't have any impact on the actual gameplay, putting physics on them seems like a waste.

Link to comment
Share on other sites

A tween is pretty much the highest performance way to move an object next to manually incrementing/decrementing its x/y position in the update loop, though the actual velocity integration code in Arcade physics is pretty lightweight; intersection/collision is by far the heaviest thing you'll deal with in the physics code.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...