How to do this calculation

Get help using Construct 2

Post » Mon Feb 06, 2017 1:46 pm

Hello, I have a sprite that moves in a scroll, there is a problem, if I direct the sprite down, then it is as if the sprite is stopped, since it advances at the same speed of the scroll.

I want to move the sprite in the right way, it's a bit confusing to explain.
Just run the capx and move the sprite down, then you will see that the sprite and the scroll move at the same speed and it seems that the sprite has simply stopped, that is the problem.

I must find the way for the sprite to advance in the correct way.
Do you understand what I mean?.

Just move the mouse so the sprite follows it.

https://dl.dropboxusercontent.com/u/60803633/testVelocidad.capx
B
29
S
12
G
21
Posts: 801
Reputation: 14,453

Post » Mon Feb 06, 2017 2:25 pm

A plugin dependencies prevent me to open the file. Easy access to open your file will make people willingly to help.
ImageImage
B
108
S
49
G
23
Posts: 783
Reputation: 22,611

Post » Mon Feb 06, 2017 3:01 pm

B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Mon Feb 06, 2017 3:14 pm

alextro wrote:A plugin dependencies prevent me to open the file. Easy access to open your file will make people willingly to help.


Hi, sorry I've already fixed it.


99Instances2Go wrote:Sine is your only friend.

https://www.dropbox.com/s/7w8v77qo85v2s ... .capx?dl=0


I see, you have made a calculation, although at the moment I do not understand correctly but ...
It looks like it's moving faster downwards now to than up, right?

I mean, the velocity to the bottom zone is greater than the upward velocity ?.
B
29
S
12
G
21
Posts: 801
Reputation: 14,453

Post » Mon Feb 06, 2017 3:26 pm

Just double.

Adjust this way
velSprite + ( ( ((1 + (sin (4ngle)))) / 2) * velTilemap)

Where velTilemap is the speed of the tilemap. Or, experiment with it to your liking.

Up will be always velSprite.
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Mon Feb 06, 2017 4:39 pm

Scrolling up supposed to has impression that player moving upward. Assume that the sprite player is a bus. So it won't make sense when the bus stop mean while the background still moving (scrolling). Try to put static object to get how the movement feeling is. In SHMUP case the only reason main ship moving down is slowing down the speed and not completely stop.
ImageImage
B
108
S
49
G
23
Posts: 783
Reputation: 22,611

Post » Mon Feb 06, 2017 5:21 pm

alextro wrote:Scrolling up supposed to has impression that player moving upward. Assume that the sprite player is a bus. So it won't make sense when the bus stop mean while the background still moving (scrolling). Try to put static object to get how the movement feeling is. In SHMUP case the only reason main ship moving down is slowing down the speed and not completely stop.


Oh i agree. When 'not moving' it should still act as it is pinned to the background.
But that brings 1 little annoying problem.
He/she moves 'the bus' toward the mouse/touch position. That is of course perfectly legit.
But, and that is the problem, the mouse/touch should also act 'as pinned to the background'.
And i have no darn idea how to accomplish that !
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Mon Feb 06, 2017 5:35 pm

Let's make the bus front headed down. Now we have front part of the bus heads down which is make the rear heads up mean while the background still scrolling up. We get our bus moving backwards! After all it's all about relative position and how we dealing or make use with it.
ImageImage
B
108
S
49
G
23
Posts: 783
Reputation: 22,611

Post » Mon Feb 06, 2017 7:30 pm

alextro wrote:Let's make the bus front headed down. Now we have front part of the bus heads down which is make the rear heads up mean while the background still scrolling up. We get our bus moving backwards! After all it's all about relative position and how we dealing or make use with it.


Cant do, says the devil on my right shoulder, that will change angle and/or distance towards the mouse/touch, and therefor make 'the bus' move.

Perfectly possible when using 8directions, or probably any other way that i can think off, just not when steering towards the mouse/touch. (i think ... means i am in doubt, means i dont see how)

Hey ? I am not arguing, not seeking you, not attacking, not interested in my own wrong or right. Rather seeking dialog.
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Mon Feb 06, 2017 10:09 pm

No I just play the scenario from current capx events exactly as it is. Probably unwanted one and would ruin entire gameplay. But I'll wait @The Mnk reply to understand what kind of gameplay He would like to achieve.
ImageImage
B
108
S
49
G
23
Posts: 783
Reputation: 22,611

Next

Return to How do I....?

Who is online

Users browsing this forum: AllanR, brunopalermo, ST314, TheRealDannyyy, tunepunk and 24 guests