3D - An Alien Dance Party (Difficulty: 1)
CreatiCode last edited by info-creaticode
- Initializing 3D scenes
- Using avatars
- Avatar animations
- Camera configuration
- Copying Objects
- Playing drums
- Updating object color
In this tutorial, we’ll have some fun playing with dancing aliens:
Please create a new project, and remove the dog sprite. In the “Empty1” sprite, add the green-flag block, the “initialize 3D scene” block, and the “add 3D axis” block. Note that you need to click the input box and choose the “Grass Land” scene. This is a lightweight scene with a large grassland and a blue sky.
As shown, the X-axis points to the right, the Y-axis points forward (into the screen), and the Z-axis points up. You can drag your mouse on the stage to rotate the camera around it:
Avatars are human-like models that can perform various kinds of animations. Here is how to add an alien avatar:
The alien avatar only knows how to “idle”. We need to “teach” it how to do some dancing animations by “adding animations” to it. Here is how to browse through the animations and add the “Breakdance Ready Dance” animation.
Now after adding the dance animation, we can start the animation at any time. By default, the animation will restart after it completes one round, so it will keep going repeatedly.
Since the alien is facing forward and it is quite small, we can move the camera to watch in front of the alien. We can set the distance and angle of the camera using this block:
Next, let’s add another alien avatar. We can make a copy of it, and choose to share the data between these 2 avatars. This will make your program run faster, since all the avatars will reuse the same color and animation data.
We also need to move the copied avatar to a different position, otherwise, it will overlap with the original avatar.
Now we have 2 avatars that are dancing side by side:
Next, can you try to add another alien like this?
Here is one way to do it. We just need to set its X to -100 instead of 100.
Our dance party is still missing some dancing beats. We can add some drum beats to match the alien’s movement:
Lastly, let’s make the aliens blink with red eyes:
To make the eyes change color, you need to use the “update color” block, and select the “second” area, which represents the eyes of the avatars.
In the forever loop, we can switch the eye color between black and red in between the drum beats:
Here is the final program for your reference.
There are many ways you can extend this project. Here are some ideas for your inspiration:
Changing Body Colors: you can try to change the alien’s body color randomly on each step.
More Aliens: you can try to add much more avatars, and move/rotate them to form an interesting formation.