solved: timers, camera offset and spawning

jonmulcahyjonmulcahy Member, Sous Chef Posts: 10,408
edited September 2012 in Working with GS (Mac)
so, I'm using Orbz's great drawing template to add some line drawing into a new app I'm creating. However, I've run into a snag. In the template, there is a timer that spawns the segment every 0 seconds. However, that timer seems to break any sort of camera offset code I implement.

If I have code that looks like this:

touch is pressed
spawn actor
xposition: mouse.position.x + camera.origin.x

it works fine

but if i wrap that in a timer, it ignores the camera.origin.x part.

I've tried putting just an attribute in that area and updating it outside of the timer, but nothing seems to work.

has anyone gotten that line drawing template to work on a scene outside of the default camera origin?

Comments

  • jonmulcahyjonmulcahy Member, Sous Chef Posts: 10,408
    another piece to the puzzle, This is combined with a moveable camera, so the origin of X is adjustable. that seems to be the killer. even with a constrained x value
  • jonmulcahyjonmulcahy Member, Sous Chef Posts: 10,408
    i figured it out, the problem was in the line segment actor, it was calculating some values based on mouse.position, which did not take into consideration the camera offset. I updated the formulas and replaced mouse.position.x with mouse.position.x+game.camX and everything is working again.

    it's always 3 hours worth of work and a 30 second fix it seems.
Sign In or Register to comment.