I am brand new to Scratch (and animation in general) and have been playing around with various techniques I feel will probably come in handy. My project in question can be viewed here. It started as a basic, infinitely scrolling background and a sprite (in this case a dragon) with a fixed position. The scrolling of the background gives the illusion that it is the dragon that is moving. This proved to be relatively simple so I attempted to add in the complexity of increasing and decreasing (more accurately, reverting) the velocity of the dragon. This was done through adjusting the speed at which the background is scrolled as well as adjusting the dragon's position along the X axis.

My intent for both the background and the dragon itself was to control the "speed" with the number of units (pixels, I would imagine) while its position was adjusted by at a time.

I wanted to simulate an an exponential rate of acceleration and deceleration, as opposed speeding up and slowing down uniformly, so my goal was to start with a base number of units and increment or decrement accordingly. This is where I think I went wrong... or maybe I didn't.

The 2 image below (sorry, no way to convert to "code" that I'm aware of) represents my methods for controlling the velocity for the background scrolling as well as the dragon with the same technique used for each. I feel like there should be a cleaner set of numbers/calculations that can be used to determine and set the number of pixels to adjust each by, but I'm finding myself at a loss. Am I on the right track?

enter image description here




Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.