7-8-25 6:02pm
This commit is contained in:
25
Gameplay/Main.cs
Normal file
25
Gameplay/Main.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using Godot;
|
||||
using System;
|
||||
|
||||
public partial class Main : Node
|
||||
{
|
||||
// Don't forget to rebuild the project so the editor knows about the new export variable.
|
||||
public override void _Ready()
|
||||
{
|
||||
NewGame();
|
||||
}
|
||||
|
||||
public void NewGame()
|
||||
{
|
||||
//_score = 0;
|
||||
|
||||
var player = GetNode<Marble>("Marble");
|
||||
var startPosition = GetNode<Marker2D>("StartPosition");
|
||||
player.Start(startPosition.Position);
|
||||
var player2 = GetNode<Marble>("Marble2");
|
||||
var startPosition2 = GetNode<Marker2D>("StartPosition2");
|
||||
player2.Start(startPosition2.Position);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
181
Gameplay/Marble.cs
Normal file
181
Gameplay/Marble.cs
Normal file
@@ -0,0 +1,181 @@
|
||||
using Godot;
|
||||
using System;
|
||||
|
||||
public partial class Marble : RigidBody2D
|
||||
{
|
||||
// Don't forget to rebuild the project so the editor knows about the new signal.
|
||||
|
||||
[Signal]
|
||||
public delegate void HitEventHandler();
|
||||
[Signal]
|
||||
public delegate void HoverEventHandler();
|
||||
[Signal]
|
||||
public delegate void HoverFalseEventHandler();
|
||||
[Signal]
|
||||
public delegate void SelectEventHandler();
|
||||
[Signal]
|
||||
public delegate void SelectFalseEventHandler();
|
||||
[Signal]
|
||||
public delegate void AimEventHandler();
|
||||
[Signal]
|
||||
public delegate void AimFalseEventHandler();
|
||||
[Signal]
|
||||
public delegate void LaunchEventHandler();
|
||||
[Signal]
|
||||
public delegate void MoveEventHandler();
|
||||
[Signal]
|
||||
public delegate void StopEventHandler();
|
||||
|
||||
[Export]
|
||||
public int Speed { get; set; } = 400; // How fast the player will move (pixels/sec).
|
||||
|
||||
public bool Hovered = false, Selected = false, Aimed = false, Launched = false, Moving = false;
|
||||
public Vector2 Force = Vector2.Zero, Velocity = Vector2.Zero;
|
||||
public Vector2 ScreenSize; // Size of the game window.
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
ScreenSize = GetViewportRect().Size;
|
||||
//Hide();
|
||||
}
|
||||
|
||||
public override void _PhysicsProcess(double delta) //THIS IS LIKE THE UPDATE FUNCTION
|
||||
{
|
||||
TrySelect();
|
||||
TryAim();
|
||||
TryLaunch();
|
||||
TryMovement();
|
||||
}
|
||||
|
||||
public void ProcessOnBump(Node2D body)
|
||||
{
|
||||
GD.Print(body);
|
||||
}
|
||||
|
||||
public void ProcessOnMovement()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void Start(Vector2 position)
|
||||
{
|
||||
Position = position;
|
||||
Show();
|
||||
GetNode<CollisionShape2D>("CollisionShape2D").Disabled = false;
|
||||
}
|
||||
|
||||
public void TryAim()
|
||||
{
|
||||
if (Selected && Input.IsActionPressed("left_click") && !Hovered && !Aimed)
|
||||
{
|
||||
Aimed = true;
|
||||
EmitSignal(SignalName.Aim);
|
||||
}
|
||||
|
||||
if (Aimed)
|
||||
{
|
||||
Vector2 mousePosition = GetGlobalMousePosition();
|
||||
Force = Position - mousePosition;
|
||||
|
||||
if (!Input.IsActionPressed("left_click"))
|
||||
{
|
||||
if (!Hovered)
|
||||
{
|
||||
Launched = true;
|
||||
EmitSignal(SignalName.SelectFalse);
|
||||
}
|
||||
else
|
||||
{
|
||||
Aimed = false;
|
||||
EmitSignal(SignalName.AimFalse);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void TryLaunch()
|
||||
{
|
||||
if (Aimed && Input.IsActionJustReleased("left_click"))
|
||||
{
|
||||
Selected = false;
|
||||
EmitSignal(SignalName.SelectFalse);
|
||||
|
||||
Aimed = false;
|
||||
EmitSignal(SignalName.AimFalse);
|
||||
|
||||
Launched = true;
|
||||
EmitSignal(SignalName.Launch);
|
||||
|
||||
ApplyCentralForce(Force * Speed);
|
||||
|
||||
Force = Vector2.Zero;
|
||||
}
|
||||
}
|
||||
|
||||
public void TryMovement()
|
||||
{
|
||||
if (LinearVelocity.Length() > 0 && !Sleeping)
|
||||
{
|
||||
if (!Moving)
|
||||
{
|
||||
Moving = true;
|
||||
EmitSignal(SignalName.Move);
|
||||
}
|
||||
}
|
||||
if (Moving)
|
||||
{
|
||||
ProcessOnMovement();
|
||||
if (Sleeping)
|
||||
{
|
||||
Moving = false;
|
||||
EmitSignal(SignalName.Stop);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void TrySelect()
|
||||
{
|
||||
if (Hovered)
|
||||
{
|
||||
if (Input.IsActionJustPressed("left_click") && !Selected)
|
||||
{
|
||||
Selected = true;
|
||||
EmitSignal(SignalName.Select);
|
||||
}
|
||||
}
|
||||
|
||||
if (Selected)
|
||||
{
|
||||
if (!Hovered)
|
||||
{
|
||||
if (Input.IsActionJustPressed("left_click") && Selected)
|
||||
{
|
||||
Selected = false;
|
||||
EmitSignal(SignalName.SelectFalse);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void OnMouseEntered()
|
||||
{
|
||||
Hovered = true;
|
||||
EmitSignal(SignalName.Hover);
|
||||
}
|
||||
|
||||
private void OnMouseExited()
|
||||
{
|
||||
Hovered = false;
|
||||
EmitSignal(SignalName.HoverFalse);
|
||||
}
|
||||
|
||||
private void OnBodyEntered(Node2D body)
|
||||
{
|
||||
if (body.GetType() == typeof(Marble))
|
||||
{
|
||||
Marble marble = (Marble)body;
|
||||
ProcessOnBump(marble);
|
||||
marble.ProcessOnBump(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
19
Gameplay/main.tscn
Normal file
19
Gameplay/main.tscn
Normal file
@@ -0,0 +1,19 @@
|
||||
[gd_scene load_steps=3 format=3 uid="uid://yqtgkxjjexag"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://v6ovq4snxruc" path="res://Gameplay/Main.cs" id="1_0xm2m"]
|
||||
[ext_resource type="PackedScene" uid="uid://c8n4lue2bn25n" path="res://Gameplay/marble.tscn" id="2_h2yge"]
|
||||
|
||||
[node name="Main" type="Node"]
|
||||
script = ExtResource("1_0xm2m")
|
||||
|
||||
[node name="Marble" parent="." instance=ExtResource("2_h2yge")]
|
||||
|
||||
[node name="StartPosition" type="Marker2D" parent="."]
|
||||
position = Vector2(200, 200)
|
||||
|
||||
[node name="Marble2" parent="." instance=ExtResource("2_h2yge")]
|
||||
|
||||
[node name="StartPosition2" type="Marker2D" parent="."]
|
||||
position = Vector2(400, 200)
|
||||
|
||||
[connection signal="Hit" from="Marble" to="." method="GameOver"]
|
||||
83
Gameplay/marble.tscn
Normal file
83
Gameplay/marble.tscn
Normal file
@@ -0,0 +1,83 @@
|
||||
[gd_scene load_steps=14 format=3 uid="uid://c8n4lue2bn25n"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://b1bipn8tmpggr" path="res://Gameplay/Marble.cs" id="1_7ritg"]
|
||||
[ext_resource type="Texture2D" uid="uid://bigvacjklr7in" path="res://art/playerGrey_up1.png" id="2_76m5q"]
|
||||
[ext_resource type="Texture2D" uid="uid://dd3s6x86dgxem" path="res://art/checkerboard.png" id="2_fkve3"]
|
||||
[ext_resource type="Texture2D" uid="uid://bskloxogmm7ox" path="res://art/playerGrey_up2.png" id="3_4rms2"]
|
||||
[ext_resource type="Shader" uid="uid://dvpsalh3o60iu" path="res://shaders/red.gdshader" id="3_6v01e"]
|
||||
[ext_resource type="Texture2D" uid="uid://cww2tug20ksn3" path="res://art/playerGrey_walk1.png" id="4_iy80h"]
|
||||
[ext_resource type="Texture2D" uid="uid://csm4ru8wkc2cb" path="res://art/playerGrey_walk2.png" id="5_ryns1"]
|
||||
|
||||
[sub_resource type="PhysicsMaterial" id="PhysicsMaterial_803qd"]
|
||||
bounce = 1.0
|
||||
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_bdlqm"]
|
||||
render_priority = 0
|
||||
shader = ExtResource("3_6v01e")
|
||||
|
||||
[sub_resource type="CapsuleMesh" id="CapsuleMesh_eju0r"]
|
||||
material = SubResource("ShaderMaterial_bdlqm")
|
||||
radius = 1.5
|
||||
height = 3.0
|
||||
|
||||
[sub_resource type="MeshTexture" id="MeshTexture_nbhrg"]
|
||||
mesh = SubResource("CapsuleMesh_eju0r")
|
||||
base_texture = ExtResource("2_fkve3")
|
||||
image_size = Vector2(55, 55)
|
||||
|
||||
[sub_resource type="SpriteFrames" id="SpriteFrames_n7ghd"]
|
||||
animations = [{
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": ExtResource("2_76m5q")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": ExtResource("3_4rms2")
|
||||
}],
|
||||
"loop": true,
|
||||
"name": &"up",
|
||||
"speed": 5.0
|
||||
}, {
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": ExtResource("4_iy80h")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": ExtResource("5_ryns1")
|
||||
}],
|
||||
"loop": true,
|
||||
"name": &"walk",
|
||||
"speed": 5.0
|
||||
}]
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_803qd"]
|
||||
radius = 27.0185
|
||||
|
||||
[node name="Marble" type="RigidBody2D"]
|
||||
input_pickable = true
|
||||
mass = 3.0
|
||||
physics_material_override = SubResource("PhysicsMaterial_803qd")
|
||||
gravity_scale = 0.0
|
||||
contact_monitor = true
|
||||
max_contacts_reported = 1
|
||||
linear_damp = 3.0
|
||||
script = ExtResource("1_7ritg")
|
||||
metadata/_edit_group_ = true
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||
position = Vector2(-4.76837e-07, -9.53674e-07)
|
||||
texture = SubResource("MeshTexture_nbhrg")
|
||||
|
||||
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
|
||||
visible = false
|
||||
position = Vector2(0, 7)
|
||||
scale = Vector2(0.5, 0.5)
|
||||
sprite_frames = SubResource("SpriteFrames_n7ghd")
|
||||
animation = &"walk"
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
shape = SubResource("CircleShape2D_803qd")
|
||||
|
||||
[connection signal="body_entered" from="." to="." method="OnBodyEntered"]
|
||||
[connection signal="mouse_entered" from="." to="." method="OnMouseEntered"]
|
||||
[connection signal="mouse_exited" from="." to="." method="OnMouseExited"]
|
||||
82
Main.cs
82
Main.cs
@@ -1,82 +0,0 @@
|
||||
using Godot;
|
||||
using System;
|
||||
|
||||
public partial class Main : Node
|
||||
{
|
||||
// Don't forget to rebuild the project so the editor knows about the new export variable.
|
||||
|
||||
[Export]
|
||||
public PackedScene MobScene { get; set; }
|
||||
|
||||
private int _score;
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
//NewGame();
|
||||
}
|
||||
|
||||
public void GameOver()
|
||||
{
|
||||
GetNode<Timer>("MobTimer").Stop();
|
||||
GetNode<Timer>("ScoreTimer").Stop();
|
||||
GetNode<Hud>("HUD").ShowGameOver();
|
||||
}
|
||||
|
||||
public void NewGame()
|
||||
{
|
||||
_score = 0;
|
||||
|
||||
var player = GetNode<Marble>("Marble");
|
||||
var startPosition = GetNode<Marker2D>("StartPosition");
|
||||
player.Start(startPosition.Position);
|
||||
|
||||
GetNode<Timer>("StartTimer").Start();
|
||||
|
||||
var hud = GetNode<Hud>("HUD");
|
||||
hud.UpdateScore(_score);
|
||||
hud.ShowMessage("Get Ready!");
|
||||
|
||||
GetTree().CallGroup("mobs", Node.MethodName.QueueFree);
|
||||
}
|
||||
|
||||
// We also specified this function name in PascalCase in the editor's connection window.
|
||||
private void OnScoreTimerTimeout()
|
||||
{
|
||||
_score++;
|
||||
GetNode<Hud>("HUD").UpdateScore(_score);
|
||||
}
|
||||
|
||||
// We also specified this function name in PascalCase in the editor's connection window.
|
||||
private void OnStartTimerTimeout()
|
||||
{
|
||||
GetNode<Timer>("MobTimer").Start();
|
||||
GetNode<Timer>("ScoreTimer").Start();
|
||||
}
|
||||
|
||||
private void OnMobTimerTimeout()
|
||||
{
|
||||
// Create a new instance of the Mob scene.
|
||||
Mob mob = MobScene.Instantiate<Mob>();
|
||||
|
||||
// Choose a random location on Path2D.
|
||||
var mobSpawnLocation = GetNode<PathFollow2D>("MobPath/MobSpawnLocation");
|
||||
mobSpawnLocation.ProgressRatio = GD.Randf();
|
||||
|
||||
// Set the mob's direction perpendicular to the path direction.
|
||||
float direction = mobSpawnLocation.Rotation + Mathf.Pi / 2;
|
||||
|
||||
// Set the mob's position to a random location.
|
||||
mob.Position = mobSpawnLocation.Position;
|
||||
|
||||
// Add some randomness to the direction.
|
||||
direction += (float)GD.RandRange(-Mathf.Pi / 4, Mathf.Pi / 4);
|
||||
mob.Rotation = direction;
|
||||
|
||||
// Choose the velocity.
|
||||
var velocity = new Vector2((float)GD.RandRange(150.0, 250.0), 0);
|
||||
mob.LinearVelocity = velocity.Rotated(direction);
|
||||
|
||||
// Spawn the mob by adding it to the Main scene.
|
||||
AddChild(mob);
|
||||
}
|
||||
}
|
||||
92
Marble.cs
92
Marble.cs
@@ -1,92 +0,0 @@
|
||||
using Godot;
|
||||
using System;
|
||||
|
||||
public partial class Marble : Area2D
|
||||
{
|
||||
// Don't forget to rebuild the project so the editor knows about the new signal.
|
||||
|
||||
[Signal]
|
||||
public delegate void HitEventHandler();
|
||||
[Export]
|
||||
public int Speed { get; set; } = 400; // How fast the player will move (pixels/sec).
|
||||
|
||||
public Vector2 ScreenSize; // Size of the game window.
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
ScreenSize = GetViewportRect().Size;
|
||||
Hide();
|
||||
}
|
||||
|
||||
public override void _Process(double delta) //THIS IS LIKE THE UPDATE FUNCTION
|
||||
{
|
||||
var velocity = Vector2.Zero; // The player's movement vector.
|
||||
|
||||
if (Input.IsActionPressed("move_right"))
|
||||
{
|
||||
velocity.X += 1;
|
||||
}
|
||||
|
||||
if (Input.IsActionPressed("move_left"))
|
||||
{
|
||||
velocity.X -= 1;
|
||||
}
|
||||
|
||||
if (Input.IsActionPressed("move_down"))
|
||||
{
|
||||
velocity.Y += 1;
|
||||
}
|
||||
|
||||
if (Input.IsActionPressed("move_up"))
|
||||
{
|
||||
velocity.Y -= 1;
|
||||
}
|
||||
|
||||
var animatedSprite2D = GetNode<AnimatedSprite2D>("AnimatedSprite2D");
|
||||
|
||||
if (velocity.Length() > 0)
|
||||
{
|
||||
velocity = velocity.Normalized() * Speed;
|
||||
animatedSprite2D.Play();
|
||||
}
|
||||
else
|
||||
{
|
||||
animatedSprite2D.Stop();
|
||||
}
|
||||
|
||||
Position += velocity * (float)delta;
|
||||
Position = new Vector2(
|
||||
x: Mathf.Clamp(Position.X, 0, ScreenSize.X),
|
||||
y: Mathf.Clamp(Position.Y, 0, ScreenSize.Y)
|
||||
);
|
||||
|
||||
if (velocity.X != 0)
|
||||
{
|
||||
animatedSprite2D.Animation = "walk";
|
||||
animatedSprite2D.FlipV = false;
|
||||
// See the note below about the following boolean assignment.
|
||||
animatedSprite2D.FlipH = velocity.X < 0;
|
||||
}
|
||||
else if (velocity.Y != 0)
|
||||
{
|
||||
animatedSprite2D.Animation = "up";
|
||||
animatedSprite2D.FlipV = velocity.Y > 0;
|
||||
}
|
||||
}
|
||||
|
||||
// We also specified this function name in PascalCase in the editor's connection window.
|
||||
private void OnBodyEntered(Node2D body)
|
||||
{
|
||||
Hide(); // Player disappears after being hit.
|
||||
EmitSignal(SignalName.Hit);
|
||||
// Must be deferred as we can't change physics properties on a physics callback.
|
||||
GetNode<CollisionShape2D>("CollisionShape2D").SetDeferred(CollisionShape2D.PropertyName.Disabled, true);
|
||||
}
|
||||
|
||||
public void Start(Vector2 position)
|
||||
{
|
||||
Position = position;
|
||||
Show();
|
||||
GetNode<CollisionShape2D>("CollisionShape2D").Disabled = false;
|
||||
}
|
||||
}
|
||||
Binary file not shown.
BIN
art/checkerboard.png
Normal file
BIN
art/checkerboard.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
34
art/checkerboard.png.import
Normal file
34
art/checkerboard.png.import
Normal file
@@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://dd3s6x86dgxem"
|
||||
path="res://.godot/imported/checkerboard.png-0a62bdcb70613a5b49cd84d25b5abd77.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://art/checkerboard.png"
|
||||
dest_files=["res://.godot/imported/checkerboard.png-0a62bdcb70613a5b49cd84d25b5abd77.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
92
main.tscn
92
main.tscn
@@ -1,92 +0,0 @@
|
||||
[gd_scene load_steps=13 format=3 uid="uid://yqtgkxjjexag"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://v6ovq4snxruc" path="res://Main.cs" id="1_0xm2m"]
|
||||
[ext_resource type="Texture2D" uid="uid://20l58n0ih2w8" path="res://art/enemyFlyingAlt_1.png" id="2_5vw27"]
|
||||
[ext_resource type="PackedScene" uid="uid://c8n4lue2bn25n" path="res://marble.tscn" id="2_h2yge"]
|
||||
[ext_resource type="Texture2D" uid="uid://j3he7mqxqv3u" path="res://art/enemyFlyingAlt_2.png" id="3_kek77"]
|
||||
[ext_resource type="Texture2D" uid="uid://oagj5757wwts" path="res://art/enemySwimming_1.png" id="4_4c57u"]
|
||||
[ext_resource type="Texture2D" uid="uid://b0ricy0343hpo" path="res://art/enemySwimming_2.png" id="5_efxa6"]
|
||||
[ext_resource type="Texture2D" uid="uid://cfuwipiglerup" path="res://art/enemyWalking_1.png" id="6_dg77c"]
|
||||
[ext_resource type="Texture2D" uid="uid://doayjemlvuit1" path="res://art/enemyWalking_2.png" id="7_ycdy4"]
|
||||
|
||||
[sub_resource type="CSharpScript" id="CSharpScript_w48qg"]
|
||||
script/source = "using Godot;
|
||||
using System;
|
||||
|
||||
public partial class Mob : RigidBody2D
|
||||
{
|
||||
public override void _Ready()
|
||||
{
|
||||
var animatedSprite2D = GetNode<AnimatedSprite2D>(\"AnimatedSprite2D\");
|
||||
string[] mobTypes = animatedSprite2D.SpriteFrames.GetAnimationNames();
|
||||
animatedSprite2D.Play(mobTypes[GD.Randi() % mobTypes.Length]);
|
||||
}
|
||||
|
||||
// We also specified this function name in PascalCase in the editor's connection window.
|
||||
private void OnVisibleOnScreenNotifier2DScreenExited()
|
||||
{
|
||||
QueueFree();
|
||||
}
|
||||
}
|
||||
"
|
||||
|
||||
[sub_resource type="SpriteFrames" id="SpriteFrames_pcqmr"]
|
||||
animations = [{
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": ExtResource("2_5vw27")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": ExtResource("3_kek77")
|
||||
}],
|
||||
"loop": true,
|
||||
"name": &"fly",
|
||||
"speed": 3.0
|
||||
}, {
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": ExtResource("4_4c57u")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": ExtResource("5_efxa6")
|
||||
}],
|
||||
"loop": true,
|
||||
"name": &"swim",
|
||||
"speed": 3.0
|
||||
}, {
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": ExtResource("6_dg77c")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": ExtResource("7_ycdy4")
|
||||
}],
|
||||
"loop": true,
|
||||
"name": &"walk",
|
||||
"speed": 3.0
|
||||
}]
|
||||
|
||||
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_jbnni"]
|
||||
radius = 36.0
|
||||
height = 90.0
|
||||
|
||||
[sub_resource type="PackedScene" id="PackedScene_vivmo"]
|
||||
_bundled = {
|
||||
"conn_count": 0,
|
||||
"conns": PackedInt32Array(),
|
||||
"editable_instances": [],
|
||||
"names": PackedStringArray("Mob", "collision_mask", "gravity_scale", "script", "metadata/_edit_group_", "mobs", "RigidBody2D", "AnimatedSprite2D", "scale", "sprite_frames", "animation", "CollisionShape2D", "rotation", "shape", "VisibleOnScreenEnabler2D", "enable_node_path"),
|
||||
"node_count": 4,
|
||||
"node_paths": [],
|
||||
"nodes": PackedInt32Array(-1, -1, 6, 0, -1, 4, 1, 0, 2, 1, 3, 2, 4, 3, 1, 5, 0, 0, 7, 7, -1, 3, 8, 4, 9, 5, 10, 6, 0, 0, 0, 11, 11, -1, 2, 12, 7, 13, 8, 0, 0, 0, 14, 14, -1, 1, 15, 9, 0),
|
||||
"variants": [0, 0.0, SubResource("CSharpScript_w48qg"), true, Vector2(0.75, 0.75), SubResource("SpriteFrames_pcqmr"), &"fly", 1.5708, SubResource("CapsuleShape2D_jbnni"), NodePath("../CollisionShape2D")],
|
||||
"version": 3
|
||||
}
|
||||
|
||||
[node name="Main" type="Node"]
|
||||
script = ExtResource("1_0xm2m")
|
||||
MobScene = SubResource("PackedScene_vivmo")
|
||||
|
||||
[node name="Marble" parent="." instance=ExtResource("2_h2yge")]
|
||||
|
||||
[connection signal="Hit" from="Marble" to="." method="GameOver"]
|
||||
50
marble.tscn
50
marble.tscn
@@ -1,50 +0,0 @@
|
||||
[gd_scene load_steps=8 format=3 uid="uid://c8n4lue2bn25n"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://b1bipn8tmpggr" path="res://Marble.cs" id="1_7ritg"]
|
||||
[ext_resource type="Texture2D" uid="uid://bigvacjklr7in" path="res://art/playerGrey_up1.png" id="2_76m5q"]
|
||||
[ext_resource type="Texture2D" uid="uid://bskloxogmm7ox" path="res://art/playerGrey_up2.png" id="3_4rms2"]
|
||||
[ext_resource type="Texture2D" uid="uid://cww2tug20ksn3" path="res://art/playerGrey_walk1.png" id="4_iy80h"]
|
||||
[ext_resource type="Texture2D" uid="uid://csm4ru8wkc2cb" path="res://art/playerGrey_walk2.png" id="5_ryns1"]
|
||||
|
||||
[sub_resource type="SpriteFrames" id="SpriteFrames_n7ghd"]
|
||||
animations = [{
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": ExtResource("2_76m5q")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": ExtResource("3_4rms2")
|
||||
}],
|
||||
"loop": true,
|
||||
"name": &"up",
|
||||
"speed": 5.0
|
||||
}, {
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": ExtResource("4_iy80h")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": ExtResource("5_ryns1")
|
||||
}],
|
||||
"loop": true,
|
||||
"name": &"walk",
|
||||
"speed": 5.0
|
||||
}]
|
||||
|
||||
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_aa3e1"]
|
||||
radius = 27.0
|
||||
height = 68.0
|
||||
|
||||
[node name="Marble" type="Area2D"]
|
||||
script = ExtResource("1_7ritg")
|
||||
metadata/_edit_group_ = true
|
||||
|
||||
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
|
||||
scale = Vector2(0.5, 0.5)
|
||||
sprite_frames = SubResource("SpriteFrames_n7ghd")
|
||||
animation = &"walk"
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
shape = SubResource("CapsuleShape2D_aa3e1")
|
||||
|
||||
[connection signal="body_entered" from="." to="." method="OnBodyEntered"]
|
||||
@@ -11,6 +11,7 @@ config_version=5
|
||||
[application]
|
||||
|
||||
config/name="Hotdesking"
|
||||
run/main_scene="uid://yqtgkxjjexag"
|
||||
config/features=PackedStringArray("4.4", "C#", "Forward Plus")
|
||||
config/icon="res://icon.svg"
|
||||
|
||||
@@ -28,24 +29,28 @@ version_control/autoload_on_startup=true
|
||||
move_right={
|
||||
"deadzone": 0.2,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194321,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":68,"key_label":0,"unicode":100,"location":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
move_left={
|
||||
"deadzone": 0.2,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194319,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":65,"key_label":0,"unicode":97,"location":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
move_up={
|
||||
"deadzone": 0.2,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194320,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":87,"key_label":0,"unicode":119,"location":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
move_down={
|
||||
"deadzone": 0.2,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194322,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":83,"key_label":0,"unicode":115,"location":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
click={
|
||||
left_click={
|
||||
"deadzone": 0.2,
|
||||
"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":0,"position":Vector2(0, 0),"global_position":Vector2(0, 0),"factor":1.0,"button_index":1,"canceled":false,"pressed":false,"double_click":false,"script":null)
|
||||
]
|
||||
|
||||
15
shaders/blue.gdshader
Normal file
15
shaders/blue.gdshader
Normal file
@@ -0,0 +1,15 @@
|
||||
shader_type canvas_item;
|
||||
|
||||
void vertex() {
|
||||
// Called for every vertex the material is visible on.
|
||||
}
|
||||
|
||||
void fragment() {
|
||||
// Called for every pixel the material is visible on.
|
||||
|
||||
}
|
||||
|
||||
//void light() {
|
||||
// // Called for every pixel for every light affecting the CanvasItem.
|
||||
// // Uncomment to replace the default light processing function with this one.
|
||||
//}
|
||||
1
shaders/blue.gdshader.uid
Normal file
1
shaders/blue.gdshader.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://bgf53pnrg4qv1
|
||||
15
shaders/red.gdshader
Normal file
15
shaders/red.gdshader
Normal file
@@ -0,0 +1,15 @@
|
||||
shader_type spatial;
|
||||
|
||||
void vertex() {
|
||||
// Called for every vertex the material is visible on.
|
||||
}
|
||||
|
||||
void fragment() {
|
||||
// Called for every pixel the material is visible on.
|
||||
ALBEDO = vec3(1, 0, 0);
|
||||
}
|
||||
|
||||
//void light() {
|
||||
// // Called for every pixel for every light affecting the material.
|
||||
// // Uncomment to replace the default light processing function with this one.
|
||||
//}
|
||||
1
shaders/red.gdshader.uid
Normal file
1
shaders/red.gdshader.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://dvpsalh3o60iu
|
||||
6
shaders/red.tres
Normal file
6
shaders/red.tres
Normal file
@@ -0,0 +1,6 @@
|
||||
[gd_resource type="ShaderMaterial" load_steps=2 format=3 uid="uid://dnjqa0ph5ptli"]
|
||||
|
||||
[ext_resource type="Shader" uid="uid://dvpsalh3o60iu" path="res://shaders/red.gdshader" id="1_ofpe7"]
|
||||
|
||||
[resource]
|
||||
shader = ExtResource("1_ofpe7")
|
||||
Reference in New Issue
Block a user