delete old files
parent
4a34595a97
commit
96fd6f5c26
|
@ -1,36 +0,0 @@
|
||||||
[gd_scene load_steps=6 format=3 uid="uid://8ewc46esswdo"]
|
|
||||||
|
|
||||||
[ext_resource type="Texture2D" uid="uid://bw052v8ikfget" path="res://icon.svg" id="1_jh0yt"]
|
|
||||||
[ext_resource type="PackedScene" uid="uid://du5vhccg75nrq" path="res://BoundingBoxes/Hitbox.tscn" id="2_gtebh"]
|
|
||||||
[ext_resource type="PackedScene" uid="uid://cjgxyhgcyvsv7" path="res://BoundingBoxes/Hurtbox.tscn" id="2_konpx"]
|
|
||||||
[ext_resource type="Script" path="res://Tests/OscillatingBody.cs" id="3_exvxj"]
|
|
||||||
|
|
||||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_bvv0o"]
|
|
||||||
size = Vector2(128, 128)
|
|
||||||
|
|
||||||
[node name="HItboxTest" type="Node2D"]
|
|
||||||
position = Vector2(377, 214)
|
|
||||||
|
|
||||||
[node name="Node2D" type="Node2D" parent="."]
|
|
||||||
|
|
||||||
[node name="Sprite2D" type="Sprite2D" parent="Node2D"]
|
|
||||||
texture = ExtResource("1_jh0yt")
|
|
||||||
|
|
||||||
[node name="Hitbox" parent="Node2D" instance=ExtResource("2_gtebh")]
|
|
||||||
|
|
||||||
[node name="OscillatingBody" type="CharacterBody2D" parent="."]
|
|
||||||
script = ExtResource("3_exvxj")
|
|
||||||
|
|
||||||
[node name="Sprite2D" type="Sprite2D" parent="OscillatingBody"]
|
|
||||||
position = Vector2(230, 7)
|
|
||||||
texture = ExtResource("1_jh0yt")
|
|
||||||
|
|
||||||
[node name="Hurtbox" parent="OscillatingBody" instance=ExtResource("2_konpx")]
|
|
||||||
|
|
||||||
[node name="CollisionShape2D" parent="OscillatingBody/Hurtbox" index="0"]
|
|
||||||
shape = SubResource("RectangleShape2D_bvv0o")
|
|
||||||
|
|
||||||
[connection signal="ReceivedDamage" from="OscillatingBody/Hurtbox" to="OscillatingBody" method="_on_hurtbox_received_damage"]
|
|
||||||
|
|
||||||
[editable path="Node2D/Hitbox"]
|
|
||||||
[editable path="OscillatingBody/Hurtbox"]
|
|
|
@ -1,22 +0,0 @@
|
||||||
using Godot;
|
|
||||||
using SupaLidlGame.Characters;
|
|
||||||
using System;
|
|
||||||
|
|
||||||
public partial class OscillatingBody : CharacterBody2D
|
|
||||||
{
|
|
||||||
private double _time = 0;
|
|
||||||
|
|
||||||
public override void _PhysicsProcess(double delta)
|
|
||||||
{
|
|
||||||
_time += delta;
|
|
||||||
// move along the path sin(x) whose derivative is cos(x)
|
|
||||||
Velocity = Vector2.Left * Mathf.Cos((float)_time) * 256;
|
|
||||||
MoveAndSlide();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void _on_hurtbox_received_damage(float damage, Character attacker,
|
|
||||||
float knockback, Vector2 _, Vector2 __)
|
|
||||||
{
|
|
||||||
GD.Print($"took {damage} dmg");
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,38 +0,0 @@
|
||||||
using Godot;
|
|
||||||
|
|
||||||
public partial class StaticMovement : CharacterBody2D
|
|
||||||
{
|
|
||||||
public const float Speed = 300.0f;
|
|
||||||
public const float JumpVelocity = -400.0f;
|
|
||||||
|
|
||||||
// Get the gravity from the project settings to be synced with RigidBody nodes.
|
|
||||||
public float gravity = ProjectSettings.GetSetting("physics/2d/default_gravity").AsSingle();
|
|
||||||
|
|
||||||
public override void _PhysicsProcess(double delta)
|
|
||||||
{
|
|
||||||
Vector2 velocity = Velocity;
|
|
||||||
|
|
||||||
// Add the gravity.
|
|
||||||
if (!IsOnFloor())
|
|
||||||
velocity.Y += gravity * (float)delta;
|
|
||||||
|
|
||||||
// Handle Jump.
|
|
||||||
if (Input.IsActionJustPressed("ui_accept") && IsOnFloor())
|
|
||||||
velocity.Y = JumpVelocity;
|
|
||||||
|
|
||||||
// Get the input direction and handle the movement/deceleration.
|
|
||||||
// As good practice, you should replace UI actions with custom gameplay actions.
|
|
||||||
Vector2 direction = Input.GetVector("ui_left", "ui_right", "ui_up", "ui_down");
|
|
||||||
if (direction != Vector2.Zero)
|
|
||||||
{
|
|
||||||
velocity.X = direction.X * Speed;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
velocity.X = Mathf.MoveToward(Velocity.X, 0, Speed);
|
|
||||||
}
|
|
||||||
|
|
||||||
Velocity = velocity;
|
|
||||||
MoveAndSlide();
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue