Move objects on larger than screen scene

DrGlickertDrGlickert Member Posts: 1,135
edited November -1 in Working with GS (Mac)
I have a game where a character throws a grenade.

I have a scene that is about 1000x1000 (this allows the player to explore the game/scene more.

I'd like for the player to walk around and when he wants to throw a grenade he can click on the screen and throw it to that position. I have it set up to do that and I don't have any problem if the player doesn't move.

BUT, if the player moves around and explores and tries to throw a grenade, it seems that the player clicks on the screen and he'll throw to that coordinate (which is something between 0-480 and 0-320). My scene is 1000x1000, how can I get the player to throw to a point like 780x560 (or whereever he wants).

Does this question make sense?

Comments

  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    If im understanding right, you can have a actor called screen, stetch it over the whole size of your screen, and uncheck visibily under graphics.

    Make 3 attributes. Targetx and targety (those should be real) and throw that can be interger

    in the screen actor have when touch is pressed change throw to 1 and change targetx to mouse positionx and targety to mouse position y.

    Then in the grenade have a rule when throw=1, move or interpolate self positionx to tragetx and self positiony to targety

    then anothrt rule in the grenade when self positionx= targetx and when self position y=target y, change attribute throw to 0.
  • DrGlickertDrGlickert Member Posts: 1,135
    Nope, that didn't work. They player actor is still 'throwing' the grenades at the X,Y coordinate of the actual screen, not at where the player touches on the scene.

    But it seems like you know what I'm asking JP. Any other idears?
  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    You can prob make an offset of some sort. Say a couple real attributes called player.x and player.y

    then constrain game.player.x to self.position.x
    and constrain game.player.y to self.position.y and then in your thrown rule add

    game.player.x to game.target.x and game.player.y to game.target.y
  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    ahh forgot the offset
  • DrGlickertDrGlickert Member Posts: 1,135
    I've tried that. In fact, I already have that set up as it is. The problem is that where ever the player touches, the game registers it as someplace between 0,480 and 0,320. So when the player throws the grenade he throws it to someplace between 0,480 and 0,320; even if I'm all the way in the top right corner at 980,980.

    Hmm. This is frustrating...
  • DrGlickertDrGlickert Member Posts: 1,135
    WWWWWAIIIIIIT, this might be it...

    http://www.youtube.com/user/GameSaladCookbook#p/u/42/bfKYqsuNgXY

    I'll watch it and let you know.
  • DrGlickertDrGlickert Member Posts: 1,135
    That was it. Sweet!!!
  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    great :) sorry forgot to mention the offset at first
Sign In or Register to comment.