Spawning actor based on mouse/finger position
TouchTiltGames
Member Posts: 1,162
I'm wondering what Attribute I'd use to spawn my blocks based on where I touch on the screen? Right now I just have them spawning from a block "container" that when touched spawns some blocks but I want to be able to touch anywhere on the screen.
I tried stretching this container to the full size of the screen and making invisible and stuff like mouse.positionX and Y...but it wasn't working, obviously missing something here.
Oh and my game scrolls up.
Thanks in advance if you can help.
I tried stretching this container to the full size of the screen and making invisible and stuff like mouse.positionX and Y...but it wasn't working, obviously missing something here.
Oh and my game scrolls up.
Thanks in advance if you can help.
Comments
Create a transparent actor and stretch it to fill the screen.
Create a rule on it so that when it is touched: spawn actor: character
for position X select devices.touch1.X (i think that is what it's called)
and for Y select devices.touch1.Y
As for the scrollable part, I would create a new layer and make it non scrollable. Place an actor in the middle of the screen, then constrain two attributes, say game.positionX and game.positionY to the actors X and Y coordinates. Then on the large touchable actor constrain it's X and Y to the game.positionX and game.positionY
I'm no pro with GS but hopefully that should do the trick.
cheers.
This Actor I place on the screen that I constrain, is this just a dummy/invisible actor?