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.
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:
Sample run:
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
Today, we are all living in the future, if you are looking at us from the past.
@ABG
Thank you for that most informative answer.
What I really wanted was to know how to save a series of blocks (not the whole lot) and not singularly.
You can save procedure definitions and events as png files, which can be dragged onto a Blocks Editor workspace from your file system.
I do that for all my reusable code.
Is that what you wanted?
(Canned Reply: ABG - Download those blocks and post them here)
Please download and post each of those event block(s)/procedures here ...
P.S. These blocks can be dragged directly into your Blocks Editor workspace.
See
for how to download individual draggable block images.