How do I

Get help using Construct 2

Post » Mon Apr 10, 2017 11:52 am

hello friends
i made a game where the player follows touch as following
set x to lerp (player.X, Touch.X, 0.1)
set Y to lerp (player.Y, touch.Y, 0.1)
this made my sprite successfully follow touch with a little bit space and was cool

and when i made a fire button where sprite can shoot but it also followed touch and gone under button which was not cool
i want game to support multi touch and prevent sprite to follow touch when i press on fire button and on the screen at the same time

p.s
i decided to make the sprite move by simulating touch on a small circle
but i don't know how to simulate a sprite movement through pressing or dragging another one ( virtual keys )
any help or capx if available already in forums

thanks in advance
B
22
S
8
G
2
Posts: 78
Reputation: 2,701

Post » Mon Apr 10, 2017 5:34 pm

but i don't know how to simulate a sprite movement through pressing or dragging another one ( virtual keys )


Concerning this part:

Though I do not fully understand your setup, you probably can use this:
  • Get the angle of drag (when dragging a virtual key) by using the system expression angle(x1,y1,x2,y2).
    Replace x1,y2 by the coordinates of the start location of the button, and x2,y2 by the coordinates of the current touch position
  • Now, move the sprite by using the Sprite action Move at Angle. For the angle parameter, use the previously returned angle of drag

This should work for you.

[EDIT] Here is a .capx for you: Download
"We can't solve problems by using the same kind of thinking we used when we created them."
- Albert Einstein
B
27
S
11
G
8
Posts: 528
Reputation: 7,091

Post » Wed Apr 12, 2017 4:15 pm

@randomly i will try this thanks very much
B
22
S
8
G
2
Posts: 78
Reputation: 2,701


Return to How do I....?

Who is online

Users browsing this forum: lukewasthefish and 15 guests