MORE Camera
This commit is contained in:
55
scenes/main/Main.cs
Normal file
55
scenes/main/Main.cs
Normal file
@@ -0,0 +1,55 @@
|
||||
using Godot;
|
||||
|
||||
namespace Ecosystem.scenes.main;
|
||||
|
||||
public partial class Main : Node
|
||||
{
|
||||
public Vector2 screenSize;
|
||||
public Node spawner;
|
||||
public Camera2D camera;
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
screenSize = GetViewport().GetVisibleRect().Size;
|
||||
camera = GetNode<Camera2D>("GlobalCamera");
|
||||
spawner = GetNode("World/Spawner");
|
||||
|
||||
GetNode<Node2D>("Grid").Call("generateGrid");
|
||||
|
||||
camera.Position = new Vector2(screenSize.X / 2, screenSize.Y / 2);
|
||||
|
||||
var flyPosition = camera.Position;
|
||||
spawner.Call("spawn_fly", flyPosition);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* main.gd
|
||||
extends Node
|
||||
|
||||
var screenSize: Vector2
|
||||
var spawner
|
||||
var camera
|
||||
|
||||
func _ready() -> void:
|
||||
screenSize = get_viewport().get_visible_rect().size
|
||||
spawner = $World/Spawner
|
||||
camera = $Camera2D
|
||||
|
||||
camera.position = Vector2(screenSize.x / 2, screenSize.x / 2)
|
||||
|
||||
var flyPosition = camera.position
|
||||
spawner.spawn_fly(flyPosition)
|
||||
spawner.spawn_bee(flyPosition)
|
||||
|
||||
|
||||
|
||||
func spawn_fly():
|
||||
spawner.spawn_fly(camera.position)
|
||||
|
||||
|
||||
func open_entity_panel(entity):
|
||||
const information_container: MarginContainer = $HUD/InformationMarginContainer
|
||||
*/
|
||||
Reference in New Issue
Block a user