0
\$\begingroup\$

My jsFiddle:

// START -- MOVE CAMERA var p = new b2Vec2(); p = (ball.body.GetWorldCenter().x) * physics.scale; pos.push(p); var length = pos.length; var s = (pos[length - 1] - pos[length - 2]); //in pixels if ((halfwidth < (dw - p)) && (p > halfwidth)) { ctx.translate(-s, 0); } 

I followed this tutorial, but the ball rendering is acting weird and slow.

I can't figure out how this example did it. He used 3 variables (stage,x, y) that are undefined in the code he wrote. Also check out how the camera moves with the player in this ImpactJS demo. I'd like to have that.

How can I do this?

\$\endgroup\$
3
  • \$\begingroup\$ please anyone give me a hint or anything !!! \$\endgroup\$ Commented Apr 23, 2014 at 9:56
  • \$\begingroup\$ I don't understand what you want. Which bit of those tutorials in these links are you looking to incorporate? What have you tried to isolate the problem you're having? \$\endgroup\$ Commented Apr 25, 2014 at 18:14
  • \$\begingroup\$ those tutorials are just demos for how i want the scene to be shifting i want just someone to provide me a simple example for how i can achieve that same functionality in my code in impact.js example and emanueleferonato u see when the player move the camera move with it so smoothly but in my code u see the weird slow behavior (at some point the whole scene start shaking ) \$\endgroup\$ Commented Apr 26, 2014 at 6:38

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.