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

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

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