How do you make vertical background parallax effects?

I’m making a game similar to Doodle Jump, and my problem is how to create a vertical parallax background for it. If you know how, please share some ideas.

Like this idea — while the player goes up, the background moves down.

Copied from defunct Scott Ferguson Developer's Library:

to App Inventor Developers Library

This project uses perspective to give the illusion of flying past the planets in our solar system one-by-one.

The relative sizes of the planets in this simulation to each other is correct.

The project is based on the Coding Math tutorial '3D - Postcards in Space'.

For added effect, I animated the rotations of the planets as well.

This was developed with the use of a 10" ASUS TF-101 tablet, so it may not work on your device.

But you can study the blocks, if nothing else.

In a nutshell, you can apply perspective to Text or balls drawn on the canvas, or sprites by using this simple formula

perspective = focal length / (focal length + z)

Multiply that by some where might be an x or y which would move an object toward a vanishing point

or might be width, height or radius where the effect would be to shrink an object

Combine both of these and you get this planet simulation with shrinking text that follows the planet into the distance.

If the z value is zero, then the perspective value is one so has no effect.

The larger z is, the smaller the object will be.

So a loop that increases the value of z from 0 to a large number would shrink the object down to a pixel.

A screen shot from a fly-by of Saturn.

The blocks saved with the new Blocks Viewer save as image feature:


PlanetsFlyBy.aia (3.0 MB)

Sample run:
sample run

1 Like

Also see

https://groups.google.com/g/app-inventor-developers-library/c/nVOmpGCkpAA/m/WDNeXzvBAwAJ

(defunct and read-only)

What an excellent link.

I can get lost in there for days :smiley:

2 Likes

8 posts were split to a new topic: Export Selected Blocks?

Gone seriously off topic...