fath11 YouTube channel: https://www.youtube.com/@fath11encoded/featured
fath11 Cocrea: https://cocrea.world/@Fath11
fath11 Scratch account: https://scratch.mit.edu/users/fath11/
What is G-Kamera?
G-Kamera is a shorthand for Gandi Camera.
G-Kamera was supposed to make it easier for users to develop scrolling games, open-world games and more. It lets you move a camera that is in front of the stage, so you don't have to code a scrolling engine hard.
Why do you need G-Kamera?
- Making scrolling map will become much simpler and easier.
In the past, achieving a large map required setting up a camera and then calculating the positions of all sprites on the stage in reverse for painting. Large map games were usually considered advanced techniques that only experienced Scratchers could handle, but now, with G-Kamera, they can be quickly implemented.
- Outstanding performance that you'll love.
The camera engine implemented in Scratch calculates the position of all sprites in reverse through the camera, which can significantly affect performance in painting. However, with G-Kamera, things are different. It uses a method of directly adjusting the projection matrix in the renderer to create images, so there's no need to re-render all sprites.
- Enjoy the flexibility and variety of moving effects.
With the help of auxiliary functions, you can achieve various camera movement effects. Whether it's non-linear movement or camera movement effects, they can all be easily implemented with G-Kamera. Say goodbye to limitations and hello to endless possibilities.
What Can it be used for?
Chaos card is a game about deck building where you must fight an AI trying to take over the world. It uses G-Kamera to allow you to scroll around your deck and organize it to your liking.
Who The Sequal is a scrolling platformer game about Who who lives in a universe where he is the version of Putera. This game is a great example of how far G-Kamera can take you in making a scrolling game.
Here is a blueprint made by Fath11. You can remix this project to see how to use this extension.
How is the camera laid out?
You need to know this so the quirkiness of this extension stays on track with you.
Generally, the stage can be considered entirely separate, as shown below.
It's important to note that anything about the mouse is bound to the stage, meaning the “Touching the mouse pointer” or “Go to mouse pointer” block will NOT work correctly. A simple workaround is to make a custom mouse.
How to use G-Kamera?
Modules
Modules | Description |
📐 Position | Set, move, change and report the camera position |
🕒 Direction | Turn, set, and report the camera direction |
🔎 Zoom | Set, transform and report the camera zoom |
🎥 Movement | - Animate the camera movement
- Make the camera follow a sprite
- Stop all camera movement, including zoom |
🌀 Sprite Motion | Animate the sprite movement |
📁 Folder Utils | Change the properties of sprites inside a folder |
Functions and definition
📐 Position
Control the position of the camera. There is relative motion between the camera and the sprites in the stage area. For example, when the camera moves to the right by 10, the effect in the stage area is that all the sprites move to the left by 10.
Move forward 10 steps according to the direction of the camera.
Set the x and y position of the camera.
Change the x and y position of the camera by an amount.
These blocks will tell you the camera's current x and y position.
🕒 Direction
Turn the camera clockwise by an amount. The amount can be negative to turn counter-clockwise.
Sets the camera direction.
This block will tell you the current direction the camera is facing.
🔎 Zoom
Sets the camera zoom to a certain percentage.
Change the camera zoom by an amount. If the camera is at 100%, changing the zoom by 10 will make the camera zoom at 110%.
Tells you the current zoom of the camera.
🎥 Movement
The block in this module can control the camera to complete a series of actions.
Smoothly glide the camera to a new position and change the zoom over a specified time. The smoothness of the glide depends on the curve you choose.
For example, you want the camera to go across the level and zoom on the finish line, and the cutscene needs to be 10 seconds long.
There are 32 different curves you can choose from, which will be explained in more detail later. You can experiment with different curves and find what's best for you by trial and error.
Make the camera follow a sprite. This block also allows you to set a specific offset, which might be helpful in a platformer game where you want the player to be somewhat centred.
You can also do so in 3 different algorithms:
- Hard - Snaps the camera to the sprite.
- Non-Linear - Smoothly glide the camera to the sprite.
- Non-linear soft - Glides to the sprite and slowly picks up pace and will slow down its movement as it approaches the sprite.
Stop all movement of the camera, including zoom. It is needed because the stop button won't stop any camera movement.
🌀 Sprite Motion
Smoothly glide a sprite to a new position and change the camera zoom over a specified time. The smoothness of the glide depends on the curve you choose.
This block will also wait until the sprite is finished moving. There are 32 different curves you can select from, which will be explained in more detail later. You can experiment with different curves and find what's best for you by trial and error.
If you want to control the movement of a clone, you can use Dolly to get the ID of the clone and make the specified clone move.
📁 Folder Utils
This module provides a series of blocks for batch controlling sprites. You can make a group of sprites follow the camera and stay fixed in the stage area (commonly seen in games as a HUD), or you can simultaneously change the appearance and position of a batch of sprites.
You can learn how to create a folder in this blog.
Make a folder unfollow/follow the camera.
Useful if you are making a HUD, custom mouse, etc.
This block is used if you want to change the position of sprites at the same time. You may have a horde of zombies, and you want them to march forward; this block can move all the sprite that is in the Enemies folder at the same time.
Used to show and hide a folder. Let's say you have a lot of jumpscare sprites. This block can show and hide them simultaneously without using a broadcast.
Set and clear the effect property of a folder. This is the same as the “set effect” block in regular Scratch, but this block does that to every sprite in a folder.
Curves
As pointed out before, there are 32 different curves that you can use to move the camera and sprites with G-Kamera. You can see the video showcasing each one of them here:
Custom mouse pointer
Due to the limitations of G-Kamera, you will be 100% required to have a custom mouse pointer. Here is how to do so:
Step 1: Make a simple square or any shape you want at any size
Step 2: Then name your sprite mouse and put it inside its own folder
Step 3: Add this script to the Mouse sprite
From now on, anything that requires the mouse pointer will use this Mouse sprite instead.
There are many ways to do this, and there are tutorials on the Gandi IDE Discord server, which you can check out.