Krotox Engine › Docs › Start Here › Welcome & Setup

Your first project: from empty scene to Android

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).


Step 1: Create the project

  1. Launch Krotox. The Project Hub opens.
  2. Choose to create a new project and name it FirstGame.
  3. Pick the 2D game type.

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.


Step 2: Find your way around

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.


Step 3: Add a sprite texture

  1. Copy your PNG into FirstGame/Assets/Textures/.
  2. Switch to the editor. It appears in the Content Browser, and the engine writes a small .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.

Step 4: Create two entities

  1. Right-click in the Scene Hierarchy and add a 2D Sprite. Rename it Player.
  2. Add another 2D Sprite and rename it Ground.
  3. Select Ground. In the Inspector, set its Transform2D position to about (0, -3) and its Scale to about (10, 1). Its units are meters.
  4. Drag your PNG from the Content Browser onto each entity to give it a texture. A flat colour works too: set Color on the 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.

Step 5: Add physics

Physics is just components.

  1. Select Player, press Add Component and add a Rigidbody2D and a BoxCollider2D.
  2. On the Rigidbody2D, set Type to Dynamic and turn on FixedRotation so the box does not tip over.
  3. Select Ground, add a Rigidbody2D set to Static, and a BoxCollider2D.
Body typeUse it for
StaticThings that never move: floors, walls
KinematicThings you move yourself, such as moving platforms
DynamicThings physics moves: the player, crates, balls

Step 6: Press Play

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.


Step 7: Write your first script

  1. Create the file FirstGame/Assets/Scripts/PlayerController.cs and open it in VS Code or Rider (double-click it in the Content Browser).
  2. Paste this:
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));
        }
    }
}
  1. Back in the editor, attach PlayerController to the Player entity. MoveSpeed and JumpForce appear in the Inspector.
  2. Press Play. 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.


Step 8: Read the Console

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.


Step 9: Save your work

Make saving a habit before you press Play.


Step 10: Test phone controls on your desktop

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.


Step 11: Run it on an Android phone

  1. Turn on USB debugging on the phone and connect it (setup steps).
  2. Open File ▸ Build Settings (Ctrl + Shift + B), choose Android, add your scene, pick the phone under Target Device and press Build and Run.

The engine then:

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.


Step 12: Before you publish

Open your project's settings and check:

Then export a signed APK or AAB. Remember that you are responsible for your Google Play developer account and signing keys. See Terms & Conditions.


What you learned

Next steps