i need help please with constraining actor position to touch position .

i don't know why is not working but this is the problem , my game are is 480 wide x 320 high and say i have some tiles in this area, so when i touch one of them my hero actors changes position where i touch, but my complete game are is 960x640 so i have some arrows to move the camera and when the camera is outside i guess of 480x320 the touch no longer works :( any idea why?

Comments

  • guillefaceguilleface Member Posts: 1,014
    thanks i will check this tomorrow.
  • guillefaceguilleface Member Posts: 1,014
    i think i need hep with this as i have a little different. i hope i can explain this well, my game will be 960 wide and 640 high, in all my area i will have like a grid made of actors, each 50x50, now when i click on one actor i want my "hero" actor to change position to the grid i touched,using the video i got this working,
    when grid is touched
    change game.herox. to mouse.position.x+camx
    change game.heroy. to mouse.position.y+camy
    the problem is that i can click at any edge of my grid actor and the hero is not in the center of the grid.
    so this is how my game rules was setup first..
    first i create a self attribute on my grid actor, "distance"
    now when grid is touch
    change self.distance to magnitude(self.positon.x-mouse.position.x,self.position.y-mouse.position.y) then second rule
    when self.distance is <20
    game.herox to self.position.x
    game.heroy to self.position.y
    the magnetite is to prevent for touching two grids or to make my hero to be always in the center of the grid.
    so i try to add the +camx in the magnitude rule after mouse.position but is not working , i tried many options but nothing.
  • guillefaceguilleface Member Posts: 1,014
    here are some pictures, i want to keep this same rules,i just need to find out where to add the +camx and +camy , i try many combinations with no luck, thanks

    grid rules
    https://dl.dropbox.com/u/46439975/Screen Shot 2012-11-02 at 4.19.07 PM.png

    heror rules
    https://dl.dropbox.com/u/46439975/Screen Shot 2012-11-02 at 4.21.13 PM.png
  • guillefaceguilleface Member Posts: 1,014
    bump,i need to fix this or icant finish my game
Sign In or Register to comment.