off screen follow

SingleSparqSingleSparq Member Posts: 1,339
edited November -1 in Working with GS (Mac)
in this demo:
http://gamesalad.com/game/play/27651
You click the triangle actor then click a screen position to have it follow to your and works well in this 480 x 320 scene size.

But if I were to increase the width of the scene to 1000 and introduce an actor that the camera follows with left/right key movement then try the "click triangle/click to a position" outside the original 480 x 320 scene it will not follow. It seems establish that 480 x 320 it starts with is only where the X/Y co-ordinates can work and not 1000 x 320 - is there a way to do this?

Comments

  • Fafnir312Fafnir312 Member Posts: 161
    Oh, you know why? Because it's going to the mouse position. I bet the mouse position is always between 0 and the screen width or height. Try constraining an actor to the mouse and using that actor's coordinates as the destination x and y for the triangle. I don't know if this'll work and I'm working on papers for finals so I can't check it myself. But I think it'll work.

    EDIT: Though if mouse positioning works in that way then you shouldn't be able to constrain an actor to it outside of the default scene bounds... so I don't know.
  • SingleSparqSingleSparq Member Posts: 1,339
    Tried that - what happens is the actor set as the destination stays in the constrained area. The mouse cursor can move along the width but the actor stays behind (moves up and down in parallel with cursor) - unless of course I'm doing it wrong.
  • Fafnir312Fafnir312 Member Posts: 161
    Yeah, I don't know right off the bat. I'll probably not have time to figure it out until tomorrow night so if someone else knows the answer to this then chime in. I know it's doable. Keep experimenting and researching on the wiki to see how things work. You might just figure it out yourself :)
  • SingleSparqSingleSparq Member Posts: 1,339
    Thanks - I'll keep trying. I think it has to do with the fact that although the scene is set to 1000 wide - the game width is still 480 which the game.Mouse.Position.X is basing it's position on (I think). If I change that to a new game attribute of real 1000 the triangle will move across the width - but of course the full width each time so not a solution but getting close.

    I will chime in tomorrow if I find a solution or not. Thanks again.
  • SingleSparqSingleSparq Member Posts: 1,339
    okay tried a few thing but still no luck - anyone else want to take a stab at it (using the game demo above as the basis)? The end result of this would be to use the accelerometer (left/right keys for now) and move the game Scene to scroll left or right, while keeping the 'click on the actor and click again to move the actor' past the initial 480 screen width.
  • Fafnir312Fafnir312 Member Posts: 161
    Back from finals and have started working on it to see if I can get it to work. I have a couple ideas.
  • Fafnir312Fafnir312 Member Posts: 161
    Ok. I got it working. Basically I got the camera origin and added the mouse coordinates to it.

    http://gamesalad.com/game/play/30323
  • SingleSparqSingleSparq Member Posts: 1,339
    Oh you magical genius! I was close when I had added a camX type attribute onto game but missed that you can add the game and mouse position to the constraint. You get a cred if I finish this game - which is looking more promising now. Thanks!
  • Fafnir312Fafnir312 Member Posts: 161
    Glad I could help :D
Sign In or Register to comment.