Krotox Engine › Docs › Start Here › Welcome & Setup
A guided walkthrough: create a project, add sprites and physics, write a first C# script, press Play, and run on an Android phone.
In this tutorial you will build a tiny platformer scene: a box that falls onto the ground and that you move with the keyboard. Along the way you touch every part of the workflow.
Button and menu labels can differ slightly between builds of this early release. If something has a different name, look for the closest match, and check the Editor tour.
You need: the editor installed, a code editor, and any small PNG image to use as a sprite (a square is fine).
FirstGame.Krotox creates a folder with this layout:
FirstGame/
|-- Assets/ # your art, sounds, scripts and scenes
| |-- Textures/
| |-- Scripts/
| +-- Scenes/
|-- Binaries/ # compiled C# scripts
|-- Cache/ # shader cache, generated for you
+-- FirstGame.ktxproj # the project file
You will only touch Assets. The rest is managed by the engine. More detail: Project Hub & Scaffolding.
The editor is a set of dockable panels. You will use these five:
Click the Viewport, then press W for the Translate tool. Q selects, E rotates, R scales. Middle-mouse drag (or Space + drag) pans, the mouse wheel zooms. The full list is in Editor shortcuts.
FirstGame/Assets/Textures/..meta file next to it that gives the image a permanent ID.Move and rename assets inside the editor, not in your file explorer. The editor keeps every reference to the asset intact when you do.
Player.Ground.Ground. In the Inspector, set its Transform2D position to about (0, -3) and its Scale to about (10, 1). Its units are meters.SpriteRenderer.Both should now be visible in the Viewport.
Cannot see a sprite? Check that the entity has a texture or colour, that it sits inside the camera's view, and that nothing with a higher OrderInLayer covers it. See Troubleshooting.
Physics is just components.
Player, press Add Component and add a Rigidbody2D and a BoxCollider2D.Ground, add a Rigidbody2D set to Static, and a BoxCollider2D.| Body type | Use it for |
|---|---|
| Static | Things that never move: floors, walls |
| Kinematic | Things you move yourself, such as moving platforms |
| Dynamic | Things physics moves: the player, crates, balls |
Press Play on the toolbar (or F5). The player should drop and land on the ground. Press Stop (or F5 again) to return to editing. Pause and Step on the toolbar advance one frame at a time, which is handy for watching a collision.
Make edits with the game stopped. That is the safest habit in any editor with a Play mode.
FirstGame/Assets/Scripts/PlayerController.cs and open it in VS Code or Rider (double-click it in the Content Browser).using KrotoxEngine;
public class PlayerController : Entity
{
// Public fields show up in the Inspector, where you can tune them live
public float MoveSpeed = 6.0f;
public float JumpForce = 8.0f;
private Rigidbody2DComponent m_Body;
public override void OnAwake()
{
// Look up components once, at startup
m_Body = GetComponent<Rigidbody2DComponent>();
}
// OnCreate and OnUpdate are plain methods, not overrides: the engine finds them by name
void OnCreate()
{
Log.Info("Player is ready");
}
void OnUpdate(float ts)
{
Vector2 velocity = m_Body.LinearVelocity;
velocity.X = 0.0f;
if (Input.IsKeyDown(KeyCode.A)) velocity.X -= MoveSpeed;
if (Input.IsKeyDown(KeyCode.D)) velocity.X += MoveSpeed;
m_Body.LinearVelocity = velocity;
if (Input.IsKeyPressed(KeyCode.Space))
{
m_Body.ApplyLinearImpulse(new Vector2(0.0f, JumpForce));
}
}
}
PlayerController to the Player entity. MoveSpeed and JumpForce appear in the Inspector.A and D move the box, Space jumps.Scripts compile in the background when you save them. A change applies the next time you press Play; a reload asked for during Play waits until you stop.
How this script is structured, and what each method does, is in Entity Lifecycle.
Open the Console panel. You should see Player is ready. If your script has an error, the Console shows it: compile errors give the file and line, and run-time errors name the script, the entity and the method that failed. Filter by Info, Warning or Error to cut the noise.
Ctrl + S saves the current scene.Ctrl + Shift + S saves the scene under a new name.Make saving a habit before you press Play.
The Viewport has a Device Emulation toolbar. Choose a phone preset (16:9, 19.5:9, 20:9 or a foldable) to see how your scene fits different screens. Left-click acts as a single finger, and Alt + click simulates a two-finger pinch. Details: Mobile Touch & Gesture API.
Ctrl + Shift + B), choose Android, add your scene, pick the phone under Target Device and press Build and Run.The engine then:
data.pak,There is no hot reload on the phone: the C# is compiled ahead of time, so after a change you press Build and Run again.
Open your project's settings and check:
com.yourname.firstgame. Google Play will not let you change it later.Then export a signed APK or AAB. Remember that you are responsible for your Google Play developer account and signing keys. See Terms & Conditions.