5 Commits

Author SHA1 Message Date
cd4f527ab1 Code cleanup
Cleaned up various things in the code to make it easier for the next person
2026-03-10 18:26:21 -07:00
2c1c865e3d Added Creature
Added the creature from Mika's art and also implemented the animations as well
2026-03-09 18:57:18 -07:00
743899be33 Improved outline preservation
Did basically anti aliasing but for the sake of making the outlines more clear.

It worked but I'm gonna continue to noodle on this solution in the future

Also incidentally fixed a minor visual glitch with the projectile directions after bounce
2026-03-09 00:43:54 -07:00
5fe0a716ce Added shader test scene
Added shader test scene
Added shaders
Added Mikas wizzard asset
Added some debugging assets
2026-03-08 23:59:00 -07:00
ebff6dfa3e Projectiles+bounce
I hate github desktop oh my god just let me create a new branch

i gave up on creating a new branch

It wont let me move to a new branch cause it thinks there are conflicts. what the fuck is the point of that

It may say that there are conflicting files. push them through anyways, git is tweaking. I tested it myself, and the last commit to main was also from me so there's nothing to be conflicting with
2026-03-02 02:19:20 -08:00
31 changed files with 766 additions and 66 deletions

57
TedsNotepad.txt Normal file
View File

@@ -0,0 +1,57 @@
x1*x2+y1*y2
along normal speedx*sp
var proje_normal = global_transform.x.normalized()
#proje_normal.y = -proje_normal.y
print("Proje Normal: ", proje_normal)
var speed_perp: float = proje_normal.dot(normal)
var perp_line: Vector2 = Vector2(normal.y,-normal.x)
var speed_para: float = proje_normal.dot(perp_line)
print("speed perp: ", speed_perp)
print("speed para: ", speed_para)
# this is just to check my math
# should be aproximately 1 (there will be some bit depth precision errors)
print("speed hype: ", speed_para*speed_para + speed_perp*speed_perp)
var newDirection: Vector2 = Vector2(
(speed_perp * normal.x) + (speed_para * normal.y),
(speed_perp * normal.y) + (speed_para *-normal.x))
var projectile_velocity = area.get_parent().get_facing_direction()
print("projectile speed......................", projectile_velocity)
var shield_normal = global_transform.x.normalized()
print("Shield Normal: ", shield_normal)
#shield_normal.y = -shield_normal.y
# if abs(projectile_velocity.y)>abs(projectile_velocity.x):
# shield_normal = global_transform.y.normalized()
#shield_normal.y = -shield_normal.y
#shield_normal.x = -shield_normal.x
# var shield_perp = Vector2(shield_normal.y,-shield_normal.x)
# if area.has_method("bounce"):
# if projectile_velocity.dot(shield_perp) < 0:
# area.bounce(shield_normal)
if area.has_method("bounce"):
#if projectile_velocity.dot(shield_normal) < 0:
area.bounce(shield_normal)

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

@@ -0,0 +1,40 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://djar02rjgqabs"
path="res://.godot/imported/Black.png-1613e05a6d554bb6d40131c1c2f5f072.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Assets/GameplayArt/Black.png"
dest_files=["res://.godot/imported/Black.png-1613e05a6d554bb6d40131c1c2f5f072.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
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/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
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

Binary file not shown.

After

Width:  |  Height:  |  Size: 247 KiB

View File

@@ -0,0 +1,40 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://c8c6fh1jtdd0i"
path="res://.godot/imported/Creature2Spritesheet.png-e2e0ef81f527506d5f444ce2e43b5c24.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Assets/GameplayArt/Creature2Spritesheet.png"
dest_files=["res://.godot/imported/Creature2Spritesheet.png-e2e0ef81f527506d5f444ce2e43b5c24.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
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/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
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

Binary file not shown.

After

Width:  |  Height:  |  Size: 125 B

View File

@@ -0,0 +1,40 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://b4xxaewt8vfbl"
path="res://.godot/imported/PallateV1.png-34e6e0012a0cedbe20615ffb3ccf5822.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Assets/GameplayArt/PallateV1.png"
dest_files=["res://.godot/imported/PallateV1.png-34e6e0012a0cedbe20615ffb3ccf5822.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
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/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
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

Binary file not shown.

After

Width:  |  Height:  |  Size: 79 KiB

View File

@@ -0,0 +1,40 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://dk7eufhisqp25"
path="res://.godot/imported/wizard_1.png-f69e6649a354bdd2df6db43b36f207c1.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Assets/GameplayArt/wizard_1.png"
dest_files=["res://.godot/imported/wizard_1.png-f69e6649a354bdd2df6db43b36f207c1.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
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/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
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

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

View File

@@ -0,0 +1,40 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://b5gvrcwfqtubf"
path="res://.godot/imported/PlaceholderPallate.png-81deac43f0fca2626c9303de8fa9ae37.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Assets/PlaceHolders/PlaceholderPallate.png"
dest_files=["res://.godot/imported/PlaceholderPallate.png-81deac43f0fca2626c9303de8fa9ae37.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
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/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
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

View File

@@ -0,0 +1,25 @@
shader_type canvas_item;
uniform sampler2D palette_texture : filter_nearest;
uniform int palette_size = 16;
uniform sampler2D screen_texture : hint_screen_texture, filter_nearest;
uniform float pixel_size = 256.0; // This now represents the "Height" resolution
uniform float color_levels : hint_range(2.0, 256.0) = 2.0;
uniform float PXwidth = 640;
uniform float PXheight = 360;
void fragment() {
float aspect_ratio = SCREEN_PIXEL_SIZE.y / SCREEN_PIXEL_SIZE.x;
vec2 uv = SCREEN_UV;
uv.x = round(uv.x * pixel_size * aspect_ratio) / (pixel_size * aspect_ratio);
uv.y = round(uv.y * pixel_size) / pixel_size;
// 3. Sample and Posterize
vec4 rgba = texture(screen_texture, uv);
vec3 crushed_color = floor(rgba.rgb * color_levels) / (color_levels - 1.0);
COLOR = vec4(crushed_color, rgba.a);
}

View File

@@ -0,0 +1 @@
uid://sek5p4kfxpli

View File

@@ -0,0 +1,86 @@
shader_type canvas_item;
// This grabs the screen texture automatically in Godot 4
uniform sampler2D screen_texture : hint_screen_texture, filter_nearest;
uniform sampler2D palette_texture : filter_nearest;
uniform int palette_size = 16;
uniform float pixel_size = 256.0;
uniform float color_levels : hint_range(2.0, 256.0) = 2.0;
uniform float black_bias : hint_range(0.0, 1.0) = 1.0; // Lower = stronger preference for black
uniform float outline_sensitivity : hint_range(0.0, 1.0) = 0.25; // Higher = grabs more grey
uniform vec2 target_resolution = vec2(640.0, 360.0);
void fragment() {
vec2 uv = floor(SCREEN_UV * target_resolution) / target_resolution;
vec2 v_pixel_size = 1.0 / target_resolution;
vec2 offset = v_pixel_size * 0.5;
// check center and 4 small offsets to see if black is nearby
vec3 col0 = texture(screen_texture, uv).rgb;
vec3 col1 = texture(screen_texture, uv + vec2(offset.x, 0.0)).rgb;
vec3 col2 = texture(screen_texture, uv - vec2(offset.x, 0.0)).rgb;
vec3 col3 = texture(screen_texture, uv + vec2(0.0, offset.y)).rgb;
vec3 col4 = texture(screen_texture, uv - vec2(0.0, offset.y)).rgb;
// Calculate the darkest brightness among the 5 samples
float b0 = dot(col0, vec3(0.299, 0.587, 0.114));
float b1 = dot(col1, vec3(0.299, 0.587, 0.114));
float b2 = dot(col2, vec3(0.299, 0.587, 0.114));
float b3 = dot(col3, vec3(0.299, 0.587, 0.114));
float b4 = dot(col4, vec3(0.299, 0.587, 0.114));
float min_brightness = min(b0, min(b1, min(b2, min(b3, b4))));
vec3 final_rgb;
// 2. The "Outline Guard"
// If ANY sampled pixel in this area is dark, force it to black immediately
if (min_brightness < outline_sensitivity) {
final_rgb = vec3(0.0, 0.0, 0.0);
} else {
// 3. Normal Palette Snapping
vec3 rgba = col0; // Use center sample for normal colors
float best_dist = 10.0;
vec3 best_color = rgba;
for (int i = 0; i < palette_size; i++) {
float x_coord = (float(i) + 0.5) / float(palette_size);
vec3 p_color = texture(palette_texture, vec2(x_coord, 0.5)).rgb;
float dist = distance(rgba, p_color);
/*
// Apply bias in the loop as a secondary safety measure
if (length(p_color) < 0.1) {
dist *= black_bias;
}
//*/
if (dist < best_dist) {
best_dist = dist;
best_color = p_color;
}
}
final_rgb = best_color;
}
COLOR = vec4(final_rgb, 1.0);
}
void vertex() {
// Called for every vertex 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.
//}
/*
// test posteriser instead of the for loop:
float levels = 8.0; // Number of color steps per channel
rgba.rgb = floor(rgba.rgb * levels) / levels;
COLOR = vec4(rgba.rgb, 1.0);
*/

View File

@@ -0,0 +1 @@
uid://dyr1qs8xwscgm

View File

@@ -0,0 +1,89 @@
[gd_scene format=3 uid="uid://cja4ibeplpuvg"]
[ext_resource type="PackedScene" uid="uid://db1oeukux1376" path="res://Scenes/Enemy1.tscn" id="1_1lo65"]
[ext_resource type="Texture2D" uid="uid://c8c6fh1jtdd0i" path="res://Assets/GameplayArt/Creature2Spritesheet.png" id="2_wvt7r"]
[sub_resource type="AtlasTexture" id="AtlasTexture_uldxc"]
atlas = ExtResource("2_wvt7r")
region = Rect2(0, 0, 1002, 1002)
[sub_resource type="AtlasTexture" id="AtlasTexture_hm5n8"]
atlas = ExtResource("2_wvt7r")
region = Rect2(1002, 0, 1002, 1002)
[sub_resource type="SpriteFrames" id="SpriteFrames_r1616"]
animations = [{
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_uldxc")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_hm5n8")
}],
"loop": true,
"name": &"default",
"speed": 1.0
}]
[sub_resource type="CircleShape2D" id="CircleShape2D_sli80"]
radius = 18.0
[sub_resource type="Animation" id="Animation_uldxc"]
resource_name = "Wiggle"
length = 2.0
loop_mode = 1
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Sprite2D:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 1),
"transitions": PackedFloat32Array(1, 1),
"update": 1,
"values": [0, 1]
}
[sub_resource type="Animation" id="Animation_wvt7r"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Sprite2D:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [0]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_hm5n8"]
_data = {
&"Idle": SubResource("Animation_uldxc"),
&"RESET": SubResource("Animation_wvt7r")
}
[node name="Enemy1" unique_id=1765361359 instance=ExtResource("1_1lo65")]
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="." index="0" unique_id=769003556]
visible = false
rotation = -1.5707964
scale = Vector2(0.3, 0.3)
sprite_frames = SubResource("SpriteFrames_r1616")
frame = 1
frame_progress = 0.7216727
[node name="Sprite2D" parent="." index="1" unique_id=93765061]
position = Vector2(0, 0)
rotation = -1.5707964
texture = ExtResource("2_wvt7r")
hframes = 2
[node name="CollisionShape2D" parent="." index="2" unique_id=1856443411]
shape = SubResource("CircleShape2D_sli80")
[node name="AnimationPlayer" type="AnimationPlayer" parent="." index="4" unique_id=525993328]
libraries/ = SubResource("AnimationLibrary_hm5n8")

View File

@@ -0,0 +1,88 @@
[gd_scene format=3 uid="uid://cja4ibeplpuvg"]
[ext_resource type="PackedScene" uid="uid://db1oeukux1376" path="res://Scenes/Enemy1.tscn" id="1_1lo65"]
[ext_resource type="Texture2D" uid="uid://c8c6fh1jtdd0i" path="res://Assets/GameplayArt/Creature2Spritesheet.png" id="2_wvt7r"]
[sub_resource type="AtlasTexture" id="AtlasTexture_uldxc"]
atlas = ExtResource("2_wvt7r")
region = Rect2(0, 0, 1002, 1002)
[sub_resource type="AtlasTexture" id="AtlasTexture_hm5n8"]
atlas = ExtResource("2_wvt7r")
region = Rect2(1002, 0, 1002, 1002)
[sub_resource type="SpriteFrames" id="SpriteFrames_r1616"]
animations = [{
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_uldxc")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_hm5n8")
}],
"loop": true,
"name": &"default",
"speed": 1.0
}]
[sub_resource type="CircleShape2D" id="CircleShape2D_sli80"]
radius = 18.0
[sub_resource type="Animation" id="Animation_uldxc"]
resource_name = "Wiggle"
length = 2.0
loop_mode = 1
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Sprite2D:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 1),
"transitions": PackedFloat32Array(1, 1),
"update": 1,
"values": [0, 1]
}
[sub_resource type="Animation" id="Animation_wvt7r"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Sprite2D:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [1]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_hm5n8"]
_data = {
&"Idle": SubResource("Animation_uldxc"),
&"RESET": SubResource("Animation_wvt7r")
}
[node name="Enemy1" unique_id=1765361359 instance=ExtResource("1_1lo65")]
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="." index="0" unique_id=769003556]
visible = false
rotation = -1.5707964
scale = Vector2(0.3, 0.3)
sprite_frames = SubResource("SpriteFrames_r1616")
frame = 1
frame_progress = 0.7216727
[node name="Sprite2D" parent="." index="1" unique_id=93765061]
texture = ExtResource("2_wvt7r")
hframes = 2
frame = 1
[node name="CollisionShape2D" parent="." index="2" unique_id=1856443411]
shape = SubResource("CircleShape2D_sli80")
[node name="AnimationPlayer" type="AnimationPlayer" parent="." index="4" unique_id=525993328]
libraries/ = SubResource("AnimationLibrary_hm5n8")

View File

@@ -1,12 +1,14 @@
[gd_scene format=3 uid="uid://db1oeukux1376"]
[ext_resource type="Texture2D" uid="uid://xg0mu5mtpcgo" path="res://Assets/PlaceHolders/BuffMonk.png" id="1_g6sln"]
[ext_resource type="Script" uid="uid://dm8ytxk67ejef" path="res://Scenes/enemy_1.gd" id="1_s7od6"]
[ext_resource type="Script" uid="uid://d34snqiuscbv8" path="res://Scenes/enemy_1.gd" id="1_s7od6"]
[ext_resource type="PackedScene" uid="uid://b3ngjk0lkeemd" path="res://Scenes/Projectile_1.tscn" id="2_n3m8v"]
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_g6sln"]
[node name="Enemy1" type="CharacterBody2D" unique_id=1765361359]
script = ExtResource("1_s7od6")
Projectile = ExtResource("2_n3m8v")
[node name="Sprite2D" type="Sprite2D" parent="." unique_id=93765061]
position = Vector2(22, -29)
@@ -14,6 +16,7 @@ scale = Vector2(0.3, 0.3)
texture = ExtResource("1_g6sln")
[node name="CollisionShape2D" type="CollisionShape2D" parent="." unique_id=1856443411]
visible = false
scale = Vector2(6, 6)
shape = SubResource("CapsuleShape2D_g6sln")

View File

@@ -1,11 +0,0 @@
[gd_scene format=3 uid="uid://d3m22yqoyvo4t"]
[ext_resource type="PackedScene" uid="uid://b448mpav6ek52" path="res://Scenes/arena_game_manager.tscn" id="1_0tjoe"]
[ext_resource type="PackedScene" uid="uid://db1oeukux1376" path="res://Scenes/Enemy1.tscn" id="2_pddb8"]
[node name="MapTest" type="Node2D" unique_id=2115555896]
[node name="ArenaGameManager" parent="." unique_id=1024187604 instance=ExtResource("1_0tjoe")]
[node name="Enemy1" parent="." unique_id=1765361359 instance=ExtResource("2_pddb8")]
position = Vector2(379, 168)

View File

@@ -0,0 +1,24 @@
extends Node2D
const isDebugLineOn: bool = false
const speed = 200
@onready var player: CharacterBody2D = get_tree().get_first_node_in_group("player")
var direction = Vector2.RIGHT
func _ready() -> void:
# direction of the player
direction = (player.global_position - global_position).normalized()
global_rotation = direction.angle()
func _process(delta: float) -> void:
position += direction * speed * delta
func changeDirection(normal: Vector2):
direction = normal
rotation = direction.angle()
#debug functions
var debug_normal: Vector2 = Vector2.ZERO
func _draw():
if isDebugLineOn:
draw_line(Vector2(1,0) * 1000, debug_normal * 50, Color.RED, 2.0)

View File

@@ -0,0 +1 @@
uid://bxqq5rcm0twuk

View File

@@ -0,0 +1,34 @@
[gd_scene format=3 uid="uid://b3ngjk0lkeemd"]
[ext_resource type="Texture2D" uid="uid://bsjn11wcewgya" path="res://Assets/PlaceHolders/Blob.png" id="1_1rre0"]
[ext_resource type="Script" uid="uid://bxqq5rcm0twuk" path="res://Scenes/Projectile_1.gd" id="1_lrei0"]
[sub_resource type="GDScript" id="GDScript_4ipem"]
script/source = "extends Area2D
# Called when the node enters the scene tree for the first time.
#func _ready() -> void:
# pass # Replace with function body.
"
[sub_resource type="CircleShape2D" id="CircleShape2D_v0834"]
[node name="Projectile1" type="Node2D" unique_id=1531719161]
script = ExtResource("1_lrei0")
[node name="Area2D" type="Area2D" parent="." unique_id=1629546418 groups=["Projectiles"]]
collision_layer = 2
collision_mask = 2
script = SubResource("GDScript_4ipem")
[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D" unique_id=286593893]
scale = Vector2(1.1, 1.1)
shape = SubResource("CircleShape2D_v0834")
[node name="Sprite2D" type="Sprite2D" parent="Area2D" unique_id=1983633174]
position = Vector2(-0.9999995, 1)
scale = Vector2(0.17, 0.17)
texture = ExtResource("1_1rre0")

View File

@@ -0,0 +1,43 @@
[gd_scene format=3 uid="uid://3xfnj6mipd2w"]
[ext_resource type="PackedScene" uid="uid://du7hapc7kscm6" path="res://Scenes/game.tscn" id="1_i0wgn"]
[ext_resource type="Shader" uid="uid://dyr1qs8xwscgm" path="res://Assets/Shaders/ShaderTest.gdshader" id="2_exucn"]
[ext_resource type="Texture2D" uid="uid://djar02rjgqabs" path="res://Assets/GameplayArt/Black.png" id="2_ipaa6"]
[ext_resource type="PackedScene" uid="uid://cja4ibeplpuvg" path="res://Scenes/Creature_2.tscn" id="3_meac5"]
[ext_resource type="Texture2D" uid="uid://b4xxaewt8vfbl" path="res://Assets/GameplayArt/PallateV1.png" id="4_vet50"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_exucn"]
shader = ExtResource("2_exucn")
shader_parameter/palette_texture = ExtResource("4_vet50")
shader_parameter/palette_size = 16
shader_parameter/pixel_size = 256.0
shader_parameter/color_levels = 8.0
shader_parameter/black_bias = 0.6
shader_parameter/outline_sensitivity = 0.25
shader_parameter/target_resolution = Vector2(640, 360)
[node name="ShaderTest" type="Node2D" unique_id=1126703629]
[node name="Game" parent="." unique_id=850692785 instance=ExtResource("1_i0wgn")]
[node name="Sprite2D" parent="Game/ArenaGameManager/MapArena/Parallax2D" parent_id_path=PackedInt32Array(850692785, 1024187604, 194007747, 598922861) index="0" unique_id=1318408175]
texture = ExtResource("2_ipaa6")
[node name="Enemy2" parent="Game" unique_id=1765361359 instance=ExtResource("3_meac5")]
position = Vector2(258, 363)
[node name="CanvasLayer" type="CanvasLayer" parent="." unique_id=298300130]
layer = 10
[node name="ColorRect" type="ColorRect" parent="CanvasLayer" unique_id=570744568]
texture_filter = 2
material = SubResource("ShaderMaterial_exucn")
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
[editable path="Game"]
[editable path="Game/ArenaGameManager"]
[editable path="Game/ArenaGameManager/MapArena"]

View File

@@ -17,22 +17,25 @@ var is_enemy_chase: bool
var health = 100
var health_max = 100
var health_min = 0
var attack_dammage = 10
var dir: Vector2
var knockback = 200
var current_state = States.IDLE
@onready var player: CharacterBody2D = get_tree().get_first_node_in_group("player")
@onready var _animation_player = $AnimationPlayer
@export var Projectile: PackedScene
var anim_player
func _on_timer_timeout() -> void:
$DirectionTimer.wait_time = chose([1,2,3])
if current_state !=States.CHASE:
if current_state != States.CHASE:
dir = chose([Vector2.RIGHT, Vector2.LEFT])
var newProjectile = Projectile.instantiate() as Node2D
newProjectile.global_position=global_position
# newProjectile.global_rotation=global_rotation
get_tree().current_scene.add_child(newProjectile)
func chose(array):
array.shuffle()
@@ -42,38 +45,21 @@ func wraparound():
var direction = global_position.direction_to(player.global_position)
global_position += direction * max_distance*2
func _ready() -> void:
if has_node("AnimationPlayer"):
anim_player = get_node_or_null("AnimationPlayer")
var list = anim_player.get_animation_list()
print(list) # Outputs something like ["idle", "walk", "default"]
func _process(delta: float) -> void:
if has_node("AnimationPlayer"):
anim_player = get_node_or_null("AnimationPlayer")
if anim_player.has_animation("Idle"):
anim_player.play("Idle")
look_at(player.global_position)
print(player.global_position)
var distance = global_position.distance_to(player.global_position)
if distance>max_distance:
if distance > max_distance:
wraparound()
"""
if (global_position.x-player.global_position.x)>600:#player to the right
global_position.x=player.global_position.x-600#move right
elif(global_position.x-player.global_position.x)<-600:#player to the left
global_position.x=player.global_position.x+600#move left
if (global_position.y-player.global_position.y)>600:#player to the up
global_position.y=player.global_position.y-600#move up
elif(global_position.y-player.global_position.y)<-600:#player to the down
global_position.y=player.global_position.y+600#move down
"""
"""
func _physics_process(delta: float) -> void:
# Add the gravity.
if not is_on_floor():
velocity += get_gravity() * delta
# Get the input direction and handle the movement/deceleration.
# As good practice, you should replace UI actions with custom gameplay actions.
var direction := Input.get_axis("ui_left", "ui_right")
if direction:
velocity.x = direction * SPEED
else:
velocity.x = move_toward(velocity.x, 0, SPEED)
move_and_slide()
"""

View File

@@ -1 +1 @@
uid://dm8ytxk67ejef
uid://d34snqiuscbv8

View File

@@ -1,10 +1,8 @@
extends CharacterBody2D
const SPEED = 300.0
func _process(_delta: float) -> void:
func _process(delta: float) -> void:
var dirX := Input.get_axis("move_left", "move_right")
var dirY := Input.get_axis("move_up", "move_down")
@@ -17,7 +15,8 @@ func _process(_delta: float) -> void:
move_and_slide()
# look_at(get_global_mouse_position()) #uncompensated mouse control
look_at(get_global_mouse_position())
var angle_to_mouse = get_angle_to(get_global_mouse_position())
rotation += angle_to_mouse + deg_to_rad(90) #+90 to makes top of image face mouse, not side
# mouse control no longer requires this 90 degree compensation
# var angle_to_mouse = get_angle_to(get_global_mouse_position())
# rotation += angle_to_mouse + deg_to_rad(90)

View File

@@ -1,8 +1,9 @@
[gd_scene format=3 uid="uid://cjrgnm28xwju7"]
[ext_resource type="Script" uid="uid://bah031ailk0ha" path="res://Scenes/player.gd" id="1_cvnsp"]
[ext_resource type="Texture2D" uid="uid://g0m835iol4mp" path="res://Assets/PlaceHolders/Screenshot 2024-11-24 210808.png" id="1_v0iea"]
[ext_resource type="Texture2D" uid="uid://dk7eufhisqp25" path="res://Assets/GameplayArt/wizard_1.png" id="2_vgqql"]
[ext_resource type="Texture2D" uid="uid://bcmuqd6p3jhdw" path="res://Assets/PlaceHolders/Elmo.png" id="3_6t5aa"]
[ext_resource type="Script" uid="uid://b7vgyn15fioeu" path="res://Scenes/shield_hitbox.gd" id="4_vgqql"]
[sub_resource type="CircleShape2D" id="CircleShape2D_v0iea"]
@@ -12,21 +13,33 @@
script = ExtResource("1_cvnsp")
[node name="Body" type="Sprite2D" parent="." unique_id=719417979]
scale = Vector2(0.114894986, 0.11449075)
texture = ExtResource("1_v0iea")
rotation = -1.5707964
scale = Vector2(0.115, 0.115)
texture = ExtResource("2_vgqql")
[node name="BodyColision" type="CollisionShape2D" parent="." unique_id=1477808378]
scale = Vector2(4.2653956, 4.2653956)
visible = false
scale = Vector2(3.5, 3.5)
shape = SubResource("CircleShape2D_v0iea")
[node name="Shield" type="Sprite2D" parent="." unique_id=212386399]
position = Vector2(0, -50)
rotation = 1.5707964
position = Vector2(50, 0)
scale = Vector2(0.15, 0.15)
texture = ExtResource("3_6t5aa")
[node name="ShieldColision" type="CollisionShape2D" parent="." unique_id=948717563]
position = Vector2(0, -50)
rotation = 1.5707964
visible = false
position = Vector2(50, 0)
scale = Vector2(2.5, 6)
shape = SubResource("RectangleShape2D_6t5aa")
[node name="ShieldHitbox" type="Area2D" parent="." unique_id=2121529100]
collision_layer = 2
collision_mask = 2
script = ExtResource("4_vgqql")
[node name="ShieldHitboxCol" type="CollisionShape2D" parent="ShieldHitbox" unique_id=1829894325]
visible = false
position = Vector2(50, 0)
scale = Vector2(2.5, 6)
shape = SubResource("RectangleShape2D_6t5aa")

View File

@@ -0,0 +1,36 @@
extends Area2D
# Toggles debugger console output
const isVerbose: bool = false
func _ready() -> void:
area_entered.connect(_on_area_entered)
func _on_area_entered(area):
if area.is_in_group("Projectiles"):
# gets parent node because parent is what's moving, not the child area node
var parent = area.get_parent()
readout("Event: Projectile has hit player shield")
var projectile_dir = Vector2.from_angle(parent.rotation)
vec2Readout("Projectile Dir", projectile_dir)
var shield_normal = global_transform.x.normalized()
vec2Readout("Shield Normal: ", shield_normal)
if parent.has_method("changeDirection"):
var bounce_dir = projectile_dir.bounce(shield_normal)
parent.changeDirection(bounce_dir)
# makes debug output cleaner when printing Vector2
func vec2str(vec: Vector2) -> String:
var x_str = String.num(vec.x, 2)
var y_str = String.num(vec.y, 2)
if not x_str.begins_with("-"): x_str = " " + x_str
if not y_str.begins_with("-"): y_str = " " + y_str
return "(%s, %s)" % [x_str, y_str]
func vec2Readout(label: String, vec: Vector2):
if isVerbose:
print("Readout: ", label, vec2str(vec))
func readout(str: String):
if isVerbose:
print(str)

View File

@@ -0,0 +1 @@
uid://b7vgyn15fioeu

View File

@@ -15,9 +15,18 @@ run/main_scene="uid://du7hapc7kscm6"
config/features=PackedStringArray("4.6", "Forward Plus")
config/icon="res://icon.svg"
[display]
window/size/viewport_width=1920
window/size/viewport_height=1080
window/stretch/mode="canvas_items"
window/stretch/aspect="expand"
window/stretch/scale=2.0
[global_group]
player="Making this for an easy reference to the player in the enemies code"
Projectiles="Tell if the object is a projectile or not"
[input]

View File

@@ -2,13 +2,28 @@ So that we can keep track of what things need to be done
Using godot version 4.6
- Get sprites for basic characters, and background
- collisions
- projectiles
- attack types?
- Get sprites for and background
- projectile damage
- enemy attack types
- enemy behaviors
Done
- WASD movement
- projectiles launching
- projectiles bouncing
- Get sprites for basic characters,
Current imported assests:
https://screamingbrainstudios.itch.io/tiny-texture-pack