Suggestions on how I should code these crosshairs?

BackUpAndDownBackUpAndDown Member Posts: 685
edited November -1 in Working with GS (Mac)
I'm currently working on a basic click-to-shoot game but i'm having trouble with the crosshairs...

http://gamesalad.com/game/play/83778

The crosshairs are pretty much just for show, it's the actual clicking on the enemy that destroys them. But I want the crosshairs at least close to the alien when he's killed. =P

It also seems if you do a kind of dragging motion the crosshairs will fly off the screen... Coding suggestions would be appreciated.

On a totally separate note, what do you think of the graphics? I made the game on the Iphone landscape template so when it was enlarged for web they kinda got blurry.

Comments

  • scitunesscitunes Member, Sous Chef Posts: 4,047
    constrain the x and y to touch1x and touch1y
  • BackUpAndDownBackUpAndDown Member Posts: 685
    I did that. In order for the crosshairs to move fast enough to reach the enemy before he vanishes I had to set the speed to 800. That seems the cause the target to fly off the stage randomly... But if i set the speed to the recommended 500 they are killed before it reaches them. =/
  • StusAppsStusApps Member, PRO Posts: 1,352
    Constrain doesn't have a speed setting. I think you are using the 'move to' behaviour and not the 'constrain attribute'. With constrain attribute it will appear instantly wherever you click. If you want it to actually move to the new place and remain on the screen then use interpolate with a very very short time.
  • beefy_clyrobeefy_clyro Member Posts: 5,394
    Hi. Im not on a mac so cant test what you are showing, it sounds like this might help though;

    http://gamesalad.com/game/play/39007
  • BackUpAndDownBackUpAndDown Member Posts: 685
    It sounds like "Interpolate" is more of what I had in mind, but I wouldn't mind learning how I would use the "constrain" as well... Could you possibly go into a more in-depth discretion how I would use them? I don't quite understand what attribute data needs to go in witch box in order for it to work.
  • StusAppsStusApps Member, PRO Posts: 1,352
    inside the crosshair actor

    Constrain attribute self.position.x to game.touch1x
    Constrain attribute self.position.y to game.touch1y

    The touch1x and 1y are located in the devices bit of the drop down.

    That's it, it'll appear wherever you touch now.
  • BackUpAndDownBackUpAndDown Member Posts: 685
    Thanks, thats opened a whole new realm of possibilities. ^_^
Sign In or Register to comment.