Merge branch 'main' of https://github.com/MarcEricMartel/MAD
This commit is contained in:
		@@ -1,9 +1,8 @@
 | 
				
			|||||||
[gd_scene load_steps=8 format=3 uid="uid://cbs0x36e3ranm"]
 | 
					[gd_scene load_steps=7 format=3 uid="uid://cbs0x36e3ranm"]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[ext_resource type="MeshLibrary" uid="uid://dwo1m72yajrb1" path="res://assets/tilesets/tileset.tres" id="1_l447d"]
 | 
					[ext_resource type="MeshLibrary" uid="uid://bo7ir5us230sa" path="res://assets/tilesets/tileset.tres" id="1_l447d"]
 | 
				
			||||||
[ext_resource type="PackedScene" uid="uid://b5gb5paiupum" path="res://player/player.tscn" id="2_ojnju"]
 | 
					[ext_resource type="PackedScene" uid="uid://b5gb5paiupum" path="res://player/player.tscn" id="2_ojnju"]
 | 
				
			||||||
[ext_resource type="PackedScene" uid="uid://2pw0p13lcklv" path="res://buildings/kash_buildings/factory.tscn" id="3_08gdj"]
 | 
					[ext_resource type="AudioStream" uid="uid://bba7tiqty57ek" path="res://music/jazz.ogg" id="3_brvx4"]
 | 
				
			||||||
[ext_resource type="AudioStream" uid="uid://byo1w5vecks0m" path="res://music/jazz.ogg" id="3_brvx4"]
 | 
					 | 
				
			||||||
[ext_resource type="PackedScene" uid="uid://c2casdi4d2o3j" path="res://shaders/water_plane.tscn" id="3_ga7wg"]
 | 
					[ext_resource type="PackedScene" uid="uid://c2casdi4d2o3j" path="res://shaders/water_plane.tscn" id="3_ga7wg"]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[sub_resource type="Environment" id="Environment_lo4sd"]
 | 
					[sub_resource type="Environment" id="Environment_lo4sd"]
 | 
				
			||||||
@@ -45,14 +44,6 @@ data = {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
metadata/_editor_floor_ = Vector3(0, 0, 0)
 | 
					metadata/_editor_floor_ = Vector3(0, 0, 0)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[node name="player" parent="." instance=ExtResource("2_ojnju")]
 | 
					 | 
				
			||||||
transform = Transform3D(1, 0, 0, 0, 0.388867, 0.921294, 0, -0.921294, 0.388867, -1.19974, 40.1006, 13.3341)
 | 
					 | 
				
			||||||
attributes = null
 | 
					 | 
				
			||||||
current = true
 | 
					 | 
				
			||||||
fov = 37.8493
 | 
					 | 
				
			||||||
near = 0.032
 | 
					 | 
				
			||||||
_test_building = ExtResource("3_08gdj")
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
[node name="Music" type="AudioStreamPlayer" parent="."]
 | 
					[node name="Music" type="AudioStreamPlayer" parent="."]
 | 
				
			||||||
stream = ExtResource("3_brvx4")
 | 
					stream = ExtResource("3_brvx4")
 | 
				
			||||||
autoplay = true
 | 
					autoplay = true
 | 
				
			||||||
@@ -70,3 +61,6 @@ light_angular_distance = 5.2
 | 
				
			|||||||
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
 | 
					[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
 | 
				
			||||||
environment = SubResource("Environment_lo4sd")
 | 
					environment = SubResource("Environment_lo4sd")
 | 
				
			||||||
camera_attributes = SubResource("CameraAttributesPhysical_5s8jn")
 | 
					camera_attributes = SubResource("CameraAttributesPhysical_5s8jn")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[node name="player" parent="." instance=ExtResource("2_ojnju")]
 | 
				
			||||||
 | 
					transform = Transform3D(1, 0, 0, 0, 0.414487, 0.910055, 0, -0.910055, 0.414487, 0, 32.5889, 13.9222)
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										325
									
								
								player/player.cs
									
									
									
									
									
								
							
							
						
						
									
										325
									
								
								player/player.cs
									
									
									
									
									
								
							@@ -3,169 +3,202 @@ using System;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
public partial class player : Camera3D
 | 
					public partial class player : Camera3D
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    private const string _path = "/root/player/";
 | 
						private const string _path = "/root/player/";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    [Export]
 | 
						[Export]
 | 
				
			||||||
    private Label _con;
 | 
						private Label _con;
 | 
				
			||||||
    [Export]
 | 
						[Export]
 | 
				
			||||||
    private Label _mousePosLabel;
 | 
						private Label _mousePosLabel;
 | 
				
			||||||
    [Export]
 | 
						[Export]
 | 
				
			||||||
    private Label _cursorPosLabel;
 | 
						private Label _cursorPosLabel;
 | 
				
			||||||
    [Export]
 | 
						[Export]
 | 
				
			||||||
    private RayCast3D _cursor;
 | 
						private RayCast3D _cursor;
 | 
				
			||||||
    [Export]
 | 
						[Export]
 | 
				
			||||||
    private Node3D _cursorPoint;
 | 
						private Node3D _cursorPoint;
 | 
				
			||||||
    private bool _mUp, _mDown, _mLeft, _mRight, _wIn, _wOut;
 | 
						private bool _mUp, _mDown, _mLeft, _mRight, _wIn, _wOut;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    [Export]
 | 
						[Export]
 | 
				
			||||||
    private PackedScene _test_building;
 | 
						private PackedScene _test_building;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    [Export]
 | 
						[Export]
 | 
				
			||||||
    private TextureProgressBar _nuke, _pr, _kash;
 | 
						private TextureProgressBar _nuke, _pr, _kash;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    [Export]
 | 
						[Export]
 | 
				
			||||||
    private Label _chatter;
 | 
						private Label _chatter;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    [Export]
 | 
						[Export]
 | 
				
			||||||
    private AudioStreamPlayer _sndChtr, _sndBtn;
 | 
						private AudioStreamPlayer _sndChtr, _sndBtn;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    [Export]
 | 
						[Export]
 | 
				
			||||||
    private Timer _tmrChtr;
 | 
						private Timer _tmrChtr, _tmrCashGen;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private float Nuke { get => (float)_nuke.Value; set => _nuke.Value = value; }
 | 
						private float Nukes { get => (float)_nuke.Value; set => _nuke.Value = value; }
 | 
				
			||||||
    private float PR { get => (float)_pr.Value; set => _pr.Value = value; }
 | 
						private float PR { get => (float)_pr.Value; set => _pr.Value = value; }
 | 
				
			||||||
    private float Kash { get => (float)_kash.Value; set => _kash.Value = value; }
 | 
						private float Kash { get => (float)_kash.Value; set => _kash.Value = value; }
 | 
				
			||||||
 | 
						private int KashFlow { get; set; } = 1;
 | 
				
			||||||
    private string Chatter
 | 
						
 | 
				
			||||||
    {
 | 
						private string Chatter
 | 
				
			||||||
        get => _chatter.Get("text").ToString(); set
 | 
						{
 | 
				
			||||||
        {
 | 
							get => _chatter.Get("text").ToString(); set
 | 
				
			||||||
            if (!(bool)_tmrChtr.Get("is_stopped") && value != "")
 | 
							{
 | 
				
			||||||
                _sndChtr.Play();
 | 
								if (!(bool)_tmrChtr.Get("is_stopped") && value != "")
 | 
				
			||||||
            _chatter.Set("text", value);
 | 
									_sndChtr.Play();
 | 
				
			||||||
            _tmrChtr.Start();
 | 
								_chatter.Set("text", value);
 | 
				
			||||||
        }
 | 
								_tmrChtr.Start();
 | 
				
			||||||
    }
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
    public base_building CurrentBuilding { get; set; }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public override void _Ready()
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        //for debugging TODO: Remove
 | 
					 | 
				
			||||||
        game_manager.CurrentState = game_manager.State.Building;
 | 
					 | 
				
			||||||
        if (_test_building != null)
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            CurrentBuilding = _test_building.Instantiate<base_building>();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            GetTree().Root.CallDeferred("add_child", CurrentBuilding);
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        _tmrChtr.Start();
 | 
					 | 
				
			||||||
        _tmrChtr.Timeout += () => Chatter = "";
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public override void _Process(double delta)
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        Vector3 rot = this.Rotation;
 | 
					 | 
				
			||||||
        bool zin = true, zout = true;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        if (Input.IsActionPressed("CamNorth"))
 | 
					 | 
				
			||||||
            _mUp = true;
 | 
					 | 
				
			||||||
        if (Input.IsActionPressed("CamSouth"))
 | 
					 | 
				
			||||||
            _mDown = true;
 | 
					 | 
				
			||||||
        if (Input.IsActionPressed("CamEast"))
 | 
					 | 
				
			||||||
            _mRight = true;
 | 
					 | 
				
			||||||
        if (Input.IsActionPressed("CamWest"))
 | 
					 | 
				
			||||||
            _mLeft = true;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        this.Rotation -= rot;
 | 
					 | 
				
			||||||
        if (this.Position.Y < 5)
 | 
					 | 
				
			||||||
            zin = false;
 | 
					 | 
				
			||||||
        else if (this.Position.Y > 45)
 | 
					 | 
				
			||||||
            zout = false;
 | 
					 | 
				
			||||||
        if (_mLeft && this.Position.X > -30)
 | 
					 | 
				
			||||||
            this.Translate(new Vector3((float)-delta * 10, 0, 0));
 | 
					 | 
				
			||||||
        if (_mRight && this.Position.X < 30)
 | 
					 | 
				
			||||||
            this.Translate(new Vector3((float)delta * 10, 0, 0));
 | 
					 | 
				
			||||||
        if (_mUp && this.Position.Z > -25)
 | 
					 | 
				
			||||||
            this.Translate(new Vector3(0, 0, (float)-delta * 10));
 | 
					 | 
				
			||||||
        if (_mDown && this.Position.Z < 25)
 | 
					 | 
				
			||||||
            this.Translate(new Vector3(0, 0, (float)delta * 10));
 | 
					 | 
				
			||||||
        this.Rotation += rot;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        if (_wIn && zin)
 | 
					 | 
				
			||||||
            this.Translate(new Vector3(0, 0, (float)-delta * 10));
 | 
					 | 
				
			||||||
        if (_wOut && zout)
 | 
					 | 
				
			||||||
            this.Translate(new Vector3(0, 0, (float)delta * 10));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        _con.Set("text", this.Position);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (_cursor != null && _cursorPoint != null)
 | 
						public base_building CurrentBuilding { get; set; }
 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            //Get the collision with map and change its X and Z value to always be in the center of a tile
 | 
					 | 
				
			||||||
            Vector3I collisionVector = (Vector3I)_cursor.GetCollisionPoint();
 | 
					 | 
				
			||||||
            _cursorPosLabel.Text = "Virtual Cursor Postion" + collisionVector.ToString();
 | 
					 | 
				
			||||||
            _cursorPoint.GlobalPosition = new Vector3(collisionVector.X - collisionVector.X % 2, 1.1f, collisionVector.Z - collisionVector.Z % 2);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if (game_manager.CurrentState == game_manager.State.Building)
 | 
						public override void _Ready()
 | 
				
			||||||
                HandleBuilding();
 | 
						{
 | 
				
			||||||
        }
 | 
							//for debugging TODO: Remove
 | 
				
			||||||
    }
 | 
							game_manager.CurrentState = game_manager.State.Building;
 | 
				
			||||||
 | 
							if (_test_building != null)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								CurrentBuilding = _test_building.Instantiate<base_building>();
 | 
				
			||||||
 | 
								GetTree().Root.CallDeferred("add_child", CurrentBuilding);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							_tmrChtr.Start();
 | 
				
			||||||
 | 
							_tmrChtr.Timeout += () => Chatter = "";
 | 
				
			||||||
 | 
						_tmrCashGen.Timeout += MakeMoney;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public override void _Input(InputEvent @event)
 | 
						public override void _Process(double delta)
 | 
				
			||||||
    {
 | 
						{
 | 
				
			||||||
        _mLeft = _mRight = _mUp = _mDown = _wIn = _wOut = false;
 | 
							Vector3 rot = this.Rotation;
 | 
				
			||||||
 | 
							bool zin = true, zout = true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (@event is InputEventMouseMotion mouse)
 | 
							if (Input.IsActionPressed("CamNorth"))
 | 
				
			||||||
        {
 | 
								_mUp = true;
 | 
				
			||||||
            Vector2 vec = mouse.Position;
 | 
							if (Input.IsActionPressed("CamSouth"))
 | 
				
			||||||
            if (vec.X < 5)
 | 
								_mDown = true;
 | 
				
			||||||
                _mLeft = true;
 | 
							if (Input.IsActionPressed("CamEast"))
 | 
				
			||||||
            else if (vec.X > 1915)
 | 
								_mRight = true;
 | 
				
			||||||
                _mRight = true;
 | 
							if (Input.IsActionPressed("CamWest"))
 | 
				
			||||||
            if (vec.Y < 20)
 | 
								_mLeft = true;
 | 
				
			||||||
                _mUp = true;
 | 
					
 | 
				
			||||||
            else if (vec.Y > 1060)
 | 
							this.Rotation -= rot;
 | 
				
			||||||
                _mDown = true;
 | 
							if (this.Position.Y < 5)
 | 
				
			||||||
 | 
								zin = false;
 | 
				
			||||||
 | 
							else if (this.Position.Y > 45)
 | 
				
			||||||
 | 
								zout = false;
 | 
				
			||||||
 | 
							if (_mLeft && this.Position.X > -30)
 | 
				
			||||||
 | 
								this.Translate(new Vector3((float)-delta * 10, 0, 0));
 | 
				
			||||||
 | 
							if (_mRight && this.Position.X < 30)
 | 
				
			||||||
 | 
								this.Translate(new Vector3((float)delta * 10, 0, 0));
 | 
				
			||||||
 | 
							if (_mUp && this.Position.Z > -25)
 | 
				
			||||||
 | 
								this.Translate(new Vector3(0, 0, (float)-delta * 10));
 | 
				
			||||||
 | 
							if (_mDown && this.Position.Z < 25)
 | 
				
			||||||
 | 
								this.Translate(new Vector3(0, 0, (float)delta * 10));
 | 
				
			||||||
 | 
							this.Rotation += rot;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							if (_wIn && zin)
 | 
				
			||||||
 | 
								this.Translate(new Vector3(0, 0, (float)-delta * 10));
 | 
				
			||||||
 | 
							if (_wOut && zout)
 | 
				
			||||||
 | 
								this.Translate(new Vector3(0, 0, (float)delta * 10));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							_con.Set("text", this.Position);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            _mousePosLabel.Text = "Mouse position: " + vec.ToString();
 | 
							if (_cursor != null && _cursorPoint != null)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								//Get the collision with map and change its X and Z value to always be in the center of a tile
 | 
				
			||||||
 | 
								Vector3I collisionVector = (Vector3I)_cursor.GetCollisionPoint();
 | 
				
			||||||
 | 
								_cursorPosLabel.Text = "Virtual Cursor Postion" + collisionVector.ToString();
 | 
				
			||||||
 | 
								_cursorPoint.GlobalPosition = new Vector3(collisionVector.X - collisionVector.X % 2, 1.1f, collisionVector.Z - collisionVector.Z % 2);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            _cursor.Position = new Vector3(
 | 
								if (game_manager.CurrentState == game_manager.State.Building)
 | 
				
			||||||
                (vec.X - GetViewport().GetVisibleRect().Size.X / 2) * this.Position.Y / 1000,
 | 
									HandleBuilding();
 | 
				
			||||||
                -((vec.Y - GetViewport().GetVisibleRect().Size.Y / 2) * this.Position.Y / 1000)
 | 
							}
 | 
				
			||||||
                , 0
 | 
						}
 | 
				
			||||||
                );
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        else if (@event is InputEventMouseButton mousebtn)
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            if (mousebtn.ButtonIndex == MouseButton.WheelUp)
 | 
					 | 
				
			||||||
                _wIn = true;
 | 
					 | 
				
			||||||
            else if (mousebtn.ButtonIndex == MouseButton.WheelDown)
 | 
					 | 
				
			||||||
                _wOut = true;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    }
 | 
						public override void _Input(InputEvent @event)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							_mLeft = _mRight = _mUp = _mDown = _wIn = _wOut = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public void HandleBuilding()
 | 
							if (@event is InputEventMouseMotion mouse)
 | 
				
			||||||
    {
 | 
							{
 | 
				
			||||||
        if (CurrentBuilding != null)
 | 
								Vector2 vec = mouse.Position;
 | 
				
			||||||
        {
 | 
								if (vec.X < 5)
 | 
				
			||||||
            CurrentBuilding.GlobalPosition = _cursorPoint.GlobalPosition;
 | 
									_mLeft = true;
 | 
				
			||||||
 | 
								else if (vec.X > 1915)
 | 
				
			||||||
 | 
									_mRight = true;
 | 
				
			||||||
 | 
								if (vec.Y < 20)
 | 
				
			||||||
 | 
									_mUp = true;
 | 
				
			||||||
 | 
								else if (vec.Y > 1060)
 | 
				
			||||||
 | 
									_mDown = true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if (Input.IsActionJustPressed("rotate"))
 | 
					 | 
				
			||||||
            {
 | 
					 | 
				
			||||||
                CurrentBuilding.RotateY(Mathf.DegToRad(90));
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if (Input.IsActionJustPressed("build"))
 | 
								_mousePosLabel.Text = "Mouse position: " + vec.ToString();
 | 
				
			||||||
            {
 | 
					
 | 
				
			||||||
                if (CurrentBuilding.IsPlaceable)
 | 
								_cursor.Position = new Vector3(
 | 
				
			||||||
                {
 | 
									(vec.X - GetViewport().GetVisibleRect().Size.X / 2) * this.Position.Y / 1000,
 | 
				
			||||||
                    base_building tempBuilding = (base_building)CurrentBuilding.Duplicate();
 | 
									-((vec.Y - GetViewport().GetVisibleRect().Size.Y / 2) * this.Position.Y / 1000)
 | 
				
			||||||
                    GetTree().Root.CallDeferred("add_child", tempBuilding);
 | 
									, 0
 | 
				
			||||||
                }
 | 
									);
 | 
				
			||||||
            }
 | 
							}
 | 
				
			||||||
        }
 | 
							else if (@event is InputEventMouseButton mousebtn)
 | 
				
			||||||
    }
 | 
							{
 | 
				
			||||||
 | 
								if (mousebtn.ButtonIndex == MouseButton.WheelUp)
 | 
				
			||||||
 | 
									_wIn = true;
 | 
				
			||||||
 | 
								else if (mousebtn.ButtonIndex == MouseButton.WheelDown)
 | 
				
			||||||
 | 
									_wOut = true;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						private void CheckGame() {
 | 
				
			||||||
 | 
							bool gameover = false;
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							if (PR <= 0)
 | 
				
			||||||
 | 
								gameover = true;
 | 
				
			||||||
 | 
							else if (Kash <= 0)
 | 
				
			||||||
 | 
								gameover = true;
 | 
				
			||||||
 | 
							else if (Nukes >= 100)
 | 
				
			||||||
 | 
								gameover = true;
 | 
				
			||||||
 | 
								
 | 
				
			||||||
 | 
							if (gameover)
 | 
				
			||||||
 | 
								Chatter = "Game Over.";
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						public void ChangeScore(int price, int pr, int nukes, int isCashCow) {
 | 
				
			||||||
 | 
							if (isCashCow > 1)
 | 
				
			||||||
 | 
								isCashCow = 1;
 | 
				
			||||||
 | 
							else if (isCashCow < -1)
 | 
				
			||||||
 | 
								isCashCow = -1;
 | 
				
			||||||
 | 
								
 | 
				
			||||||
 | 
							Nukes += nukes;
 | 
				
			||||||
 | 
							PR += pr;
 | 
				
			||||||
 | 
							Kash -= price;
 | 
				
			||||||
 | 
							KashFlow += isCashCow;
 | 
				
			||||||
 | 
							CheckGame();
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						private void MakeMoney() {
 | 
				
			||||||
 | 
							Kash += KashFlow * 10;
 | 
				
			||||||
 | 
							CheckGame();
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						public void HandleBuilding()
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							if (CurrentBuilding != null)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								CurrentBuilding.GlobalPosition = _cursorPoint.GlobalPosition;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								if (Input.IsActionJustPressed("rotate"))
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
									CurrentBuilding.RotateY(Mathf.DegToRad(90));
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								if (Input.IsActionJustPressed("build"))
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
									if (CurrentBuilding.IsPlaceable)
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
										base_building tempBuilding = (base_building)CurrentBuilding.Duplicate();
 | 
				
			||||||
 | 
										GetTree().Root.CallDeferred("add_child", tempBuilding);
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,16 +1,13 @@
 | 
				
			|||||||
[gd_scene load_steps=18 format=3 uid="uid://b5gb5paiupum"]
 | 
					[gd_scene load_steps=20 format=3 uid="uid://b5gb5paiupum"]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[ext_resource type="Script" path="res://player/player.cs" id="1_of2l4"]
 | 
					[ext_resource type="Script" path="res://player/player.cs" id="1_of2l4"]
 | 
				
			||||||
 | 
					[ext_resource type="AudioStream" uid="uid://dye3nhm41yk6r" path="res://audio/chatter.wav" id="2_sa1qd"]
 | 
				
			||||||
 | 
					[ext_resource type="AudioStream" uid="uid://c8dcqkmytnyay" path="res://audio/btn.wav" id="3_00x5l"]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[sub_resource type="CameraAttributesPhysical" id="CameraAttributesPhysical_1ejpb"]
 | 
					[sub_resource type="CameraAttributesPhysical" id="CameraAttributesPhysical_1ejpb"]
 | 
				
			||||||
frustum_near = 0.032
 | 
					frustum_near = 0.032
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[sub_resource type="Gradient" id="Gradient_hcpag"]
 | 
					 | 
				
			||||||
interpolation_mode = 2
 | 
					 | 
				
			||||||
colors = PackedColorArray(1, 0, 0, 1, 0.35782, 0, 0.0248139, 1)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
[sub_resource type="GradientTexture2D" id="GradientTexture2D_y5odr"]
 | 
					[sub_resource type="GradientTexture2D" id="GradientTexture2D_y5odr"]
 | 
				
			||||||
gradient = SubResource("Gradient_hcpag")
 | 
					 | 
				
			||||||
fill_to = Vector2(0.858974, 0.615385)
 | 
					fill_to = Vector2(0.858974, 0.615385)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[sub_resource type="Gradient" id="Gradient_camjl"]
 | 
					[sub_resource type="Gradient" id="Gradient_camjl"]
 | 
				
			||||||
@@ -63,7 +60,10 @@ height = 255
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
[sub_resource type="SphereMesh" id="SphereMesh_mtv4x"]
 | 
					[sub_resource type="SphereMesh" id="SphereMesh_mtv4x"]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[node name="player" type="Camera3D" node_paths=PackedStringArray("_con", "_mousePosLabel", "_cursorPosLabel", "_cursor", "_cursorPoint", "_nuke", "_pr", "_kash")]
 | 
					[sub_resource type="LabelSettings" id="LabelSettings_pws5q"]
 | 
				
			||||||
 | 
					font_size = 28
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[node name="player" type="Camera3D" node_paths=PackedStringArray("_con", "_mousePosLabel", "_cursorPosLabel", "_cursor", "_cursorPoint", "_nuke", "_pr", "_kash", "_chatter", "_sndChtr", "_sndBtn", "_tmrChtr", "_tmrCashGen")]
 | 
				
			||||||
attributes = SubResource("CameraAttributesPhysical_1ejpb")
 | 
					attributes = SubResource("CameraAttributesPhysical_1ejpb")
 | 
				
			||||||
script = ExtResource("1_of2l4")
 | 
					script = ExtResource("1_of2l4")
 | 
				
			||||||
_con = NodePath("Debug info/Label")
 | 
					_con = NodePath("Debug info/Label")
 | 
				
			||||||
@@ -74,8 +74,14 @@ _cursorPoint = NodePath("cursorPoint")
 | 
				
			|||||||
_nuke = NodePath("NukeBar")
 | 
					_nuke = NodePath("NukeBar")
 | 
				
			||||||
_pr = NodePath("PrBar")
 | 
					_pr = NodePath("PrBar")
 | 
				
			||||||
_kash = NodePath("KashBar")
 | 
					_kash = NodePath("KashBar")
 | 
				
			||||||
 | 
					_chatter = NodePath("lbl_Chatter")
 | 
				
			||||||
 | 
					_sndChtr = NodePath("snd_Chatter")
 | 
				
			||||||
 | 
					_sndBtn = NodePath("snd_Button")
 | 
				
			||||||
 | 
					_tmrChtr = NodePath("tmr_Chatter")
 | 
				
			||||||
 | 
					_tmrCashGen = NodePath("tmr_kash")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[node name="Debug info" type="Control" parent="."]
 | 
					[node name="Debug info" type="Control" parent="."]
 | 
				
			||||||
 | 
					visible = false
 | 
				
			||||||
layout_mode = 3
 | 
					layout_mode = 3
 | 
				
			||||||
anchors_preset = 0
 | 
					anchors_preset = 0
 | 
				
			||||||
offset_right = 40.0
 | 
					offset_right = 40.0
 | 
				
			||||||
@@ -105,17 +111,45 @@ offset_right = 402.0
 | 
				
			|||||||
offset_bottom = 182.0
 | 
					offset_bottom = 182.0
 | 
				
			||||||
text = "Eat ze caca."
 | 
					text = "Eat ze caca."
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[node name="Button" type="Button" parent="."]
 | 
					[node name="btn_boom" type="Button" parent="."]
 | 
				
			||||||
offset_left = 1772.0
 | 
					offset_left = 1772.0
 | 
				
			||||||
offset_top = 926.0
 | 
					offset_top = 926.0
 | 
				
			||||||
offset_right = 1904.0
 | 
					offset_right = 1904.0
 | 
				
			||||||
offset_bottom = 1058.0
 | 
					offset_bottom = 1058.0
 | 
				
			||||||
text = "BOOM"
 | 
					text = "Nuke Enemy"
 | 
				
			||||||
icon = SubResource("GradientTexture2D_y5odr")
 | 
					icon = SubResource("GradientTexture2D_y5odr")
 | 
				
			||||||
flat = true
 | 
					flat = true
 | 
				
			||||||
icon_alignment = 1
 | 
					icon_alignment = 1
 | 
				
			||||||
expand_icon = true
 | 
					expand_icon = true
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[node name="btn_nukes" type="Button" parent="."]
 | 
				
			||||||
 | 
					offset_left = 1637.0
 | 
				
			||||||
 | 
					offset_top = 926.0
 | 
				
			||||||
 | 
					offset_right = 1769.0
 | 
				
			||||||
 | 
					offset_bottom = 1058.0
 | 
				
			||||||
 | 
					text = "BDE"
 | 
				
			||||||
 | 
					icon_alignment = 1
 | 
				
			||||||
 | 
					expand_icon = true
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[node name="btn_pr" type="Button" parent="."]
 | 
				
			||||||
 | 
					offset_left = 1502.0
 | 
				
			||||||
 | 
					offset_top = 926.0
 | 
				
			||||||
 | 
					offset_right = 1634.0
 | 
				
			||||||
 | 
					offset_bottom = 1058.0
 | 
				
			||||||
 | 
					text = ":)
 | 
				
			||||||
 | 
					"
 | 
				
			||||||
 | 
					icon_alignment = 1
 | 
				
			||||||
 | 
					expand_icon = true
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[node name="btn_kashcow" type="Button" parent="."]
 | 
				
			||||||
 | 
					offset_left = 1366.0
 | 
				
			||||||
 | 
					offset_top = 926.0
 | 
				
			||||||
 | 
					offset_right = 1498.0
 | 
				
			||||||
 | 
					offset_bottom = 1058.0
 | 
				
			||||||
 | 
					text = "$"
 | 
				
			||||||
 | 
					icon_alignment = 1
 | 
				
			||||||
 | 
					expand_icon = true
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[node name="NukeBar" type="TextureProgressBar" parent="."]
 | 
					[node name="NukeBar" type="TextureProgressBar" parent="."]
 | 
				
			||||||
offset_left = 1817.0
 | 
					offset_left = 1817.0
 | 
				
			||||||
offset_top = 664.0
 | 
					offset_top = 664.0
 | 
				
			||||||
@@ -123,6 +157,8 @@ offset_right = 1841.0
 | 
				
			|||||||
offset_bottom = 919.0
 | 
					offset_bottom = 919.0
 | 
				
			||||||
value = 50.0
 | 
					value = 50.0
 | 
				
			||||||
rounded = true
 | 
					rounded = true
 | 
				
			||||||
 | 
					allow_greater = true
 | 
				
			||||||
 | 
					allow_lesser = true
 | 
				
			||||||
fill_mode = 3
 | 
					fill_mode = 3
 | 
				
			||||||
texture_under = SubResource("GradientTexture2D_2xkee")
 | 
					texture_under = SubResource("GradientTexture2D_2xkee")
 | 
				
			||||||
texture_progress = SubResource("GradientTexture2D_d5w6a")
 | 
					texture_progress = SubResource("GradientTexture2D_d5w6a")
 | 
				
			||||||
@@ -134,6 +170,8 @@ offset_right = 1869.0
 | 
				
			|||||||
offset_bottom = 919.0
 | 
					offset_bottom = 919.0
 | 
				
			||||||
value = 50.0
 | 
					value = 50.0
 | 
				
			||||||
rounded = true
 | 
					rounded = true
 | 
				
			||||||
 | 
					allow_greater = true
 | 
				
			||||||
 | 
					allow_lesser = true
 | 
				
			||||||
fill_mode = 3
 | 
					fill_mode = 3
 | 
				
			||||||
texture_under = SubResource("GradientTexture2D_7myfq")
 | 
					texture_under = SubResource("GradientTexture2D_7myfq")
 | 
				
			||||||
texture_progress = SubResource("GradientTexture2D_kdame")
 | 
					texture_progress = SubResource("GradientTexture2D_kdame")
 | 
				
			||||||
@@ -143,8 +181,11 @@ offset_left = 1873.0
 | 
				
			|||||||
offset_top = 664.0
 | 
					offset_top = 664.0
 | 
				
			||||||
offset_right = 1897.0
 | 
					offset_right = 1897.0
 | 
				
			||||||
offset_bottom = 919.0
 | 
					offset_bottom = 919.0
 | 
				
			||||||
value = 50.0
 | 
					max_value = 1000.0
 | 
				
			||||||
 | 
					value = 5.0
 | 
				
			||||||
rounded = true
 | 
					rounded = true
 | 
				
			||||||
 | 
					allow_greater = true
 | 
				
			||||||
 | 
					allow_lesser = true
 | 
				
			||||||
fill_mode = 3
 | 
					fill_mode = 3
 | 
				
			||||||
texture_under = SubResource("GradientTexture2D_18k81")
 | 
					texture_under = SubResource("GradientTexture2D_18k81")
 | 
				
			||||||
texture_progress = SubResource("GradientTexture2D_nfg3s")
 | 
					texture_progress = SubResource("GradientTexture2D_nfg3s")
 | 
				
			||||||
@@ -186,3 +227,24 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 2)
 | 
				
			|||||||
transform = Transform3D(0.5, 0, 0, 0, 0.5, 0, 0, 0, 0.5, 0, 0, 0)
 | 
					transform = Transform3D(0.5, 0, 0, 0, 0.5, 0, 0, 0, 0.5, 0, 0, 0)
 | 
				
			||||||
mesh = SubResource("SphereMesh_mtv4x")
 | 
					mesh = SubResource("SphereMesh_mtv4x")
 | 
				
			||||||
skeleton = NodePath("../..")
 | 
					skeleton = NodePath("../..")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[node name="lbl_Chatter" type="Label" parent="."]
 | 
				
			||||||
 | 
					offset_left = 314.0
 | 
				
			||||||
 | 
					offset_top = 270.0
 | 
				
			||||||
 | 
					offset_right = 756.0
 | 
				
			||||||
 | 
					offset_bottom = 513.0
 | 
				
			||||||
 | 
					label_settings = SubResource("LabelSettings_pws5q")
 | 
				
			||||||
 | 
					autowrap_mode = 3
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[node name="snd_Chatter" type="AudioStreamPlayer" parent="."]
 | 
				
			||||||
 | 
					stream = ExtResource("2_sa1qd")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[node name="snd_Button" type="AudioStreamPlayer" parent="."]
 | 
				
			||||||
 | 
					stream = ExtResource("3_00x5l")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[node name="tmr_Chatter" type="Timer" parent="."]
 | 
				
			||||||
 | 
					wait_time = 3.0
 | 
				
			||||||
 | 
					one_shot = true
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[node name="tmr_kash" type="Timer" parent="."]
 | 
				
			||||||
 | 
					autostart = true
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user