How do I make a teleprt

Get help using Construct 2

Post » Mon Jan 25, 2016 11:19 pm

I'm trying to make a mechanic where the character moves to a tapped spot and only when its a tap, does any enemy in the way get hurt. kind of like dark slash
B
21
S
5
G
4
Posts: 162
Reputation: 3,680

Post » Mon Jan 25, 2016 11:32 pm

I guess you'd only have to change the moveto example shipped with construct a little bit to get the basics of this..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Tue Jan 26, 2016 11:34 am

Ayolabi12345 wrote:I'm trying to make a mechanic where the character moves to a tapped spot and only when its a tap, does any enemy in the way get hurt. kind of like dark slash


Set the player's position to Touch.X and Touch.Y in the "on tap" condition. Then create a sprite between the player's old position and his new position, rotate it accordingly, then check for collisions with each enemy and apply damage to them.

First time I hear about Dark Slash, seems like a nice game. Thanks.
ImageImage
B
36
S
13
G
10
Posts: 161
Reputation: 7,469

Post » Thu Feb 18, 2016 12:13 am

@Zed2100 what if I want my player to speed to where I touch? Is there a ways to do it using the Bullet behavior
B
21
S
5
G
4
Posts: 162
Reputation: 3,680

Post » Thu Feb 18, 2016 12:05 pm

Rather than using the Bullet behavior, you can do that more easily IMO using the event sheet :

Set your player's angle toward the touch position, then use the "move forward" action. Set the distance to the speed times dt.

This will move the player at constant speed, if you want an accelerated movement I would implement it using the mathematical formula for acceleration and deceleration, or you can use the CustomMovement behavior to achieve that.

In my implementation, I would create a sprite for the player character and pin it to my (invisible) player object (which will be rotated). It is usually a good idea to do this separation, however, you can avoid rotation by using something like "move at angle" where the angle is computed between the touch position and your player's position (use the angle system expression to get the angle between two points).
ImageImage
B
36
S
13
G
10
Posts: 161
Reputation: 7,469


Return to How do I....?

Who is online

Users browsing this forum: justintime0185, oddreal, TRMG, twomonocles, wmsgva and 9 guests