# How do I get a sine wave to stop halfway through?

Get help using Construct 2

### » Mon Nov 10, 2014 9:02 pm

And then re-set it, so the next time it is called it will start from the beginning?
Some games: https://play.google.com/store/search?q= ... s&hl=en_GB Feel free to show the panda some support, he would appreciate it :)
B
19
S
5
G
1
Posts: 155
Reputation: 1,619

### » Mon Nov 10, 2014 9:14 pm

From the manual :

Sine expressions
CyclePosition
Return a value from 0 to 1 representing the progress through the current cycle. For example, exactly half way through a cycle this returns 0.5.

You can use that expression when you're calling it and play around with it at 0.5
B
37
S
9
G
3
Posts: 493
Reputation: 4,142

### » Mon Nov 10, 2014 9:31 pm

Two way to do that, one is as alvarop mentionned, use expressions to get the current CyclePosition and do some action when it reaches >= 0.5
expressionCyclePos.PNG

The other method, is to use Sine with "value only" and use abs() for a one sided cycle.
manualValue.PNG

First method is easiest, but second method has the best precision (i.e. the Sine value is truly one sided)
You do not have the required permissions to view the files attached to this post.
B
80
S
33
G
27
Posts: 1,027
Reputation: 21,114

### » Tue Nov 11, 2014 8:52 am

Thanks. I was using Value in a similar way to cyclePosition but had a problem in not being able to reset before I made the sine active again.

What i am trying to do is when an object reaches a certain point I want it to activate sine to make it look like it has wobbled on stopping, then stop the sine (ideally after a certain amount of times, but halfway through the cycle is fine, if that's the only way)

What I then want to do is to re start the sine as if it is the first time I have called it, but at the moment its keeping its values so I can't get it to act the way I would like.
Some games: https://play.google.com/store/search?q= ... s&hl=en_GB Feel free to show the panda some support, he would appreciate it :)
B
19
S
5
G
1
Posts: 155
Reputation: 1,619