Sine behavior question

Get help using Construct 2

Post » Wed Mar 22, 2017 2:57 pm

Hey everyone,

Is there a way to allow a sine behavior with SIZE movement to oscillate the object's size between, say, 20% to 60%?

In other terms, if I apply the behavior on an object of 100x100 pixels with magnitude to 40, I will always get a sine movement between 80 and 120% of the objects' standard size. I would like to make its size vary from 20 to 60 pixels without changing the size of my base object (which should remain 100x100 pixels).
Possible?

Thanks for your help !
B
29
S
6
G
1
Posts: 347
Reputation: 2,725

Post » Wed Mar 22, 2017 4:17 pm

Not fully understanding your issue, but try using an invisible helper object with the sine behavior/motion size you want, and pin the full size object to it.
Mistakes were made.
B
51
S
25
G
107
Posts: 1,581
Reputation: 60,458

Post » Wed Mar 22, 2017 8:34 pm

I am not sure how you can change the size without changing the size. I do believe we need a more clear example of your intended goal.
Check out my completed games on the Arcade! Capt. Doe Save the Universe! & Clicker Wizard!
B
66
S
17
G
8
Posts: 637
Reputation: 9,370

Post » Wed Mar 22, 2017 10:15 pm

It sounds like you are describing the bulge effect?

Look at that effect and you can set radius and use an event like every so many seconds to change the effect.

You can change size directly of any object but if you want it changed over time then you need to use a timer and every so many seconds or every tick.
Banned User
B
27
S
7
G
58
Posts: 1,229
Reputation: 34,780

Post » Thu Mar 23, 2017 2:25 am

It would be nice if you could modify the Sprite.Sine.Value, but the behavior doesn;'t allow for that.

you'd have to do it manually... I'm sure the math is here on the forums somewhere...
B
97
S
32
G
15
Posts: 1,183
Reputation: 16,148

Post » Thu Mar 23, 2017 5:02 am

I can imagine a double sine behavior.

Create a decoy sprite with sine behavior: NUMBER ONLY
Give you main object the SIZE SINE behavior and set magnitude to DECOY.Number

There you go!
Image Image Image
B
29
S
11
G
27
Posts: 730
Reputation: 17,002

Post » Fri Mar 24, 2017 10:50 am

Thanks everyone for your answers, and sorry if I've been unclear.

Here are some additional explanation about what I'm trying to achieve:
I have an object whose size is 100x100 pixels.
If I add a sine/size behavior with 20 magnitude, it's size will oscillate between 80 and 120 pixels (if I'm correct)
I want it to oscillate between 20 and 60 pixels.
Is there a way to achieve this using the sine behavior?

@MPPlantOfficial
I've been able to make it work with your solution! It's a bit complex to set up, though... ^^'

I think it's possible to give both sine behavior to the same object or use math to set size of object every tick to the value of the (value) sine behavior, so we use only one sine.
B
29
S
6
G
1
Posts: 347
Reputation: 2,725

Post » Fri Mar 24, 2017 11:15 am

Image
B
65
S
23
G
7
Posts: 1,502
Reputation: 10,890

Post » Fri Mar 24, 2017 11:29 am

@korbaach
Thank you for the elegant demonstration. ;)
B
29
S
6
G
1
Posts: 347
Reputation: 2,725


Return to How do I....?

Who is online

Users browsing this forum: luckyrawatlucky, nahima and 7 guests