How to push... a line?

Get help using Construct 2

Post » Mon May 13, 2013 3:53 pm

Hello everyone,

I'm new here and I have a little problem. I've searched through forums and tutorial but havn't found the right thing for me.

To put it simple, I need to set up something like this:

1. user swipe his touch screen/swipe with mouse button held down starting from over (or under) a line crossing the screen
2. at the moment the finger/mouse collide with the line, the line get pushed up with a determinated impulse, or one determined by the movement's velocity

This is what I've done:
-I've set up the line with one little square stretched from one point on the left to one on the right, concealed off screen, and all the number needed for calculations refer to those two points.
-I created a little square, a sort of cursor(shoould be invisible in the end) wich follows the mouse till the user hold down the button.
-I have a variable to establish every tick if the cursor is over or under the line.
-One of the points determining the line is set to projectile behavior, with zero velocity and some deceleration.
-The cursor will be destroyed on button released or on collision with the line. The collision event will set the angle of the line's point to 90 with cursor over the line (270 with cursor under),and give it the constant velocity prepared.

This is what I get:
in the better case, the line will respond correctly when "pushed" from below, but from the other direction it will more often than not push the line's point to the left, especially when the cursor hit the line at a low angle. This behavior showed itself pushing from below only rarely.
In the worst scenario, i get consistently the line's point moving lef or rigth, without any glitchy response (and I've figured "I've done it, now only to change the angles... but nothing happend changing those).

I've honed the collision point to different values, including margins of safety (with too speedy a swipe, the cursors jump the line), collision with the object or with the bbox, modifing the bbox, setting the moving angle from bullet behavior or the angle but with "keep angle" on, etc, but I can't figure out what's happening...

Could be the collision problematic, with the single little pixel stretched out so much?

Any help will be apreciated, thanks
B
4
Posts: 2
Reputation: 229

Post » Mon May 13, 2013 6:22 pm

hi @ilBarbogio

Could you send a capx, please?
B
14
S
4
G
2
Posts: 190
Reputation: 3,938

Post » Mon May 13, 2013 6:29 pm

Ok, just when someone offered help... so it goes.

I've solved the mistery: changing the orders of action solved it.

Just destroy cursor first, then set the line's point spedd and only then the moving angle... maybe "moving angle" went unchanged (or glitchly changed) beacause there was any speed? Or it has something to do with actions hierarchy/order/whatisit.

So, thanks beufreecasse!

If you still want the capx I could provide it... but it's substantially empty, I was working on those three elements only and the only intersting thing was they weren't working
B
4
Posts: 2
Reputation: 229

Post » Mon May 13, 2013 8:49 pm

@ilBarbogio
Thank you it was just to help you ;)
B
14
S
4
G
2
Posts: 190
Reputation: 3,938


Return to How do I....?

Who is online

Users browsing this forum: fredriksthlm, MPPlantOfficial and 25 guests