How do I Create a 3d movement effect using sine?

0 favourites
  • 7 posts
From the Asset Store
Fully commented source code/event sheet & sprites to create a space shooter game
  • We are trying to make an object change based upon it Y coordinates. So far we have been using Compare Y at different points and set scale to .1 difference if closer or further but this makes it look somewhat clunky and the transition isn't as smooth as it could be. I feel if there was a way to get absolute Y and increase/decrease scale automatically it would be much better. IE for ever 1 past Y 550 increase scale .01 for every 1 549 and before decrease scale .01 with magnitudes set likely max 1 and min .2 or something. I like how Sine resizes but also can figure out how to make that based on the Y axis location.

    Sorry I am a construct 2 virgin and I know my 10 events to do this using compare y and set scale is likely a bad use of the events. I do ask if you have a better/easier way if you would explain to me how you figured it out and not just spit out a line of code I want to learn not be spoon fed.

    Thank You

    ecoay

  • You can do that with an equation

    Every tick

    ---sprite: set scale to lerp(0.2, 1, sprite.y/480)

    That will set the scale to 0.2 if y is 0 and set the scale to 1 if y is 480. All other y positions will set the scale smoothly from the y position. You can play with the numbers until you get the look you want.

  • oh awesome! I didn't know you can set equations in set scale. Thank you! This is very useful. Running into some issues with this now where the ball freezes after two bounces in mid air. Maybe I didn't enter something correctly and will test further after 8 hours asleep.... Ben a long long day.

  • Playing with it again today can't quite figure out why this stops after one bounce and becomes frozen mid bounce even when hit with a immovable physics object.

  • Is this a bug or is scaling not meant to be done on the fly? To replicate this can create 4 walls and make them immovable and then make a quick platform to kick the ball you will see after bounce the ball freezes in mid air every time. Unless again I am doing something wrong

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Perhaps a .capx or at the very least a screenshot of your events will get you the answers you seek.

  • Sorry been busy with Christmas stuff. Here is the capx. I know it is terrible lol. This is just testing fucntionality,

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)