Onerat Games
  • Home
  • Games
    • Elden: Path of the Forgotten
    • Outback
    • Itch.io
  • Learn
    • Onerat's C# Console Engine >
      • Getting Started
      • Scripting API >
        • GameObject
        • Rigidbody
        • Transfrom
        • Component
        • Input
        • Rect
        • Screen
        • Vector2
        • Console Engine Math
      • Lessions >
        • Lesson 1: Snake
        • Lesson 2: Particle Simulation
        • Lesson 3: Tetris
      • Donate
      • Download
  • Asset Store

Getting Started
with
​Onerat Console Engine

Getting Started with Onerat Console Engine

Getting Started with Onerat Console Engine


Installation

To use OneratConsoleEngine, you need to follow these steps:

  1. Download the OneratConsoleEngine library from the official website or GitHub repository.
  2. Add a reference to the OneratConsoleEngine.dll in your project.
  3. Import the OneratConsoleEngine namespace in your code file(s).

using OneratConsoleEngine;


Initializing the Engine

To initialize the engine and start your scene, you can use the following code:


using OneratConsoleEngine;

namespace YourNamespace
{
    public class Program
    {
        static void Main(string[] args)
        {
            ConsoleEngine.Initialize();
            ConsoleEngine.LoadScene(new YourScene());
            ConsoleEngine.Run();
        }
    }
}
  

Creating a Scene

In OneratConsoleEngine, a scene represents a specific game state or simulation. To create a scene, you need to create a new class that inherits from the Scene class. Here's an example:


using OneratConsoleEngine;

namespace YourNamespace
{
    public class YourScene : Scene
    {
        // Implement required methods and add your scene logic here
    }
}
  

Scene Methods

In your scene class, you can implement various methods to define your scene's behavior. Here are some common methods you can override:

  • Start(): This method is called when the scene starts. You can perform initialization logic here.
  • Update(): This method is called every frame. You can update your scene's logic here.
  • Active(): This method determines if the scene is active. Return true to keep the scene active and false to end it.


Adding GameObjects and Components

In OneratConsoleEngine, you can create GameObjects and attach Components to them to define their behavior. Here's an example:


using OneratConsoleEngine;

public class YourScene : Scene
{
    public void Start()
    {
        // Create a new GameObject
        GameObject gameObject = new GameObject();

        // Attach a Component to the GameObject
        Component component = gameObject.AddComponent<YourComponent>();

        // Add additional Components or configure the existing one
        // ...

        // Add the GameObject to the scene
        AddGameObject(gameObject);
    }
}
  

Input Handling

OneratConsoleEngine provides a convenient input handling system. You can use the Input class to check for keyboard input. Here's an example:


using OneratConsoleEngine;

public class YourScene : Scene
{
    public void Update()
    {
        if (Input.GetKey(KeyCode.Space))
        {
            // Space key is pressed
            // Perform actions accordingly
        }
    }
}
  

In the above example, the Update method checks if the Space key is pressed using the Input.GetKey method. You can use this to handle various keyboard inputs in your scene.


Conclusion

This guide provides a basic overview of getting started with OneratConsoleEngine. You can explore more advanced features and concepts in the OneratConsoleEngine documentation.

Powered by Create your own unique website with customizable templates.
  • Home
  • Games
    • Elden: Path of the Forgotten
    • Outback
    • Itch.io
  • Learn
    • Onerat's C# Console Engine >
      • Getting Started
      • Scripting API >
        • GameObject
        • Rigidbody
        • Transfrom
        • Component
        • Input
        • Rect
        • Screen
        • Vector2
        • Console Engine Math
      • Lessions >
        • Lesson 1: Snake
        • Lesson 2: Particle Simulation
        • Lesson 3: Tetris
      • Donate
      • Download
  • Asset Store