3 Commits

Author SHA1 Message Date
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
dfbbdca8e9 added mouse look and added a depressed elmo png for later 2026-02-16 17:11:11 -08:00
42 changed files with 2182 additions and 7 deletions

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: 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: 37 KiB

View File

@@ -0,0 +1,40 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bsjn11wcewgya"
path="res://.godot/imported/Blob.png-3a1a5deaf3590dc1853ac0b0bd158753.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Assets/PlaceHolders/Blob.png"
dest_files=["res://.godot/imported/Blob.png-3a1a5deaf3590dc1853ac0b0bd158753.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: 224 KiB

View File

@@ -0,0 +1,40 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://xg0mu5mtpcgo"
path="res://.godot/imported/BuffMonk.png-1bcf3f620dedfe8f64fe9de0addc56fe.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Assets/PlaceHolders/BuffMonk.png"
dest_files=["res://.godot/imported/BuffMonk.png-1bcf3f620dedfe8f64fe9de0addc56fe.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: 289 KiB

View File

@@ -0,0 +1,40 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bcmuqd6p3jhdw"
path="res://.godot/imported/Elmo.png-27156829b64b2a8a5736b4b7de87de5f.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Assets/PlaceHolders/Elmo.png"
dest_files=["res://.godot/imported/Elmo.png-27156829b64b2a8a5736b4b7de87de5f.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: 470 KiB

View File

@@ -0,0 +1,40 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://dfo7q0g3skud5"
path="res://.godot/imported/FallGuy.png-02f4a1ba0f67e389b5e6e02f7fee4c6c.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Assets/PlaceHolders/FallGuy.png"
dest_files=["res://.godot/imported/FallGuy.png-02f4a1ba0f67e389b5e6e02f7fee4c6c.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,24 @@
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,65 @@
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; // 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);
float best_dist = 10.0;
vec3 best_color = rgba.rgb;
///*
// 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);
//*/
//*
// Palette snapping logic
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.rgb, p_color);
if (dist < best_dist) {
best_dist = dist;
best_color = p_color;
}
}
//*/
COLOR = vec4(best_color, 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

25
block/Scenes/Enemy1.tscn Normal file
View File

@@ -0,0 +1,25 @@
[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://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)
scale = Vector2(0.3, 0.3)
texture = ExtResource("1_g6sln")
[node name="CollisionShape2D" type="CollisionShape2D" parent="." unique_id=1856443411]
scale = Vector2(6, 6)
shape = SubResource("CapsuleShape2D_g6sln")
[node name="DirectionTimer" type="Timer" parent="." unique_id=509704860]
autostart = true
[connection signal="timeout" from="DirectionTimer" to="." method="_on_timer_timeout"]

View File

@@ -0,0 +1,49 @@
extends Node2D
const speed = 200
@onready var player: CharacterBody2D = get_tree().get_first_node_in_group("player")
var direction = Vector2.RIGHT
#var debug_normal: Vector2 = Vector2.ZERO
func _ready() -> void:
#direction = (player.global_position - global_position).normalized()
#look_at(player.global_position)
# pass
direction = (player.global_position - global_position).normalized()
global_rotation=direction.angle()
#direction= global_position.direction_to(player.global_position)
#direction = Vector2.RIGHT.rotated(rotation+ get_angle_to(playerDirection))
func _draw():
pass
# draw_line(Vector2(1,0) * 1000, debug_normal * 50, Color.RED, 2.0)
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
position += direction * speed * delta
#position += playerDirection * speed * delta
look_at(player.global_position)
#look_at(direction)#
func get_facing_direction():
# Get the direction vector based on the node's current rotation
var direction_vector: Vector2 = Vector2.from_angle(rotation)
return direction_vector
func changeTrajectory(direction_vector: Vector2):
rotation = rad_to_deg(atan2(direction_vector.y, direction_vector.x))
func changeDirection(normal: Vector2):
print("direction:", direction)
# direction = direction.bounce(normal)
direction = normal
#direction = newDirection
#direction = direction.bounce(perp_line)
rotation = rad_to_deg(direction.angle())
print("direction:", direction)
func bounce(normal: Vector2):
direction = direction.bounce(normal)
rotation = rad_to_deg(direction.angle())

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,37 @@
[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="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/PXwidth = 640.0
shader_parameter/PXheight = 360.0
[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="CanvasLayer" type="CanvasLayer" parent="." unique_id=298300130]
layer = 10
[node name="ColorRect" type="ColorRect" parent="CanvasLayer" unique_id=570744568]
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"]

89
block/Scenes/enemy_1.gd Normal file
View File

@@ -0,0 +1,89 @@
extends CharacterBody2D
class_name Enemy1
enum States
{
IDLE,
ROAM,
CHASE,
ATTACK,
TAKING_DAMMAGE,
DEAD
}
const max_distance = 750
const SPEED = 300.0
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")
@export var Projectile: PackedScene
func _on_timer_timeout() -> void:
$DirectionTimer.wait_time = chose([1,2,3])
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()
return array.front()
func wraparound():
var direction = global_position.direction_to(player.global_position)
global_position += direction * max_distance*2
func _process(delta: float) -> void:
look_at(player.global_position)
#print(player.global_position)
var distance = global_position.distance_to(player.global_position)
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

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

View File

@@ -1,7 +1,11 @@
[gd_scene format=3 uid="uid://du7hapc7kscm6"]
[ext_resource type="PackedScene" uid="uid://b448mpav6ek52" path="res://Scenes/arena_game_manager.tscn" id="1_ebmjs"]
[ext_resource type="PackedScene" uid="uid://db1oeukux1376" path="res://Scenes/Enemy1.tscn" id="2_qxrlw"]
[node name="Game" type="Node2D" unique_id=850692785]
[node name="ArenaGameManager" parent="." unique_id=1024187604 instance=ExtResource("1_ebmjs")]
[node name="Enemy1" parent="." unique_id=1765361359 instance=ExtResource("2_qxrlw")]
position = Vector2(297, 101)

View File

@@ -16,3 +16,8 @@ func _process(_delta: float) -> void:
velocity.y = dir.y
move_and_slide()
# look_at(get_global_mouse_position()) # uncompensated mouse control
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

View File

@@ -1,19 +1,42 @@
[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"]
[node name="CharacterBody2D" type="CharacterBody2D" unique_id=1419412180]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_6t5aa"]
[node name="Player" type="CharacterBody2D" unique_id=1419412180 groups=["player"]]
script = ExtResource("1_cvnsp")
[node name="Sprite2D" type="Sprite2D" parent="." unique_id=719417979]
position = Vector2(0, -43)
[node name="Body" type="Sprite2D" parent="." unique_id=719417979]
rotation = -1.5707964
scale = Vector2(0.114894986, 0.11449075)
texture = ExtResource("1_v0iea")
texture = ExtResource("2_vgqql")
[node name="CollisionShape2D" type="CollisionShape2D" parent="." unique_id=1477808378]
position = Vector2(0, -43)
[node name="BodyColision" type="CollisionShape2D" parent="." unique_id=1477808378]
scale = Vector2(4.2653956, 4.2653956)
shape = SubResource("CircleShape2D_v0iea")
[node name="Shield" type="Sprite2D" parent="." unique_id=212386399]
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(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]
position = Vector2(50, 0)
scale = Vector2(2.5, 6)
shape = SubResource("RectangleShape2D_6t5aa")

View File

@@ -0,0 +1,45 @@
extends Area2D
var debug_normal: Vector2 = Vector2.ZERO
var bounceTrajectory: Vector2
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
area_entered.connect(_on_area_entered)
print("READY!")
func _draw():
# pass
draw_line(bounceTrajectory *1000, debug_normal * 50, Color.RED, 2.0) # normal
# draw_line(Vector2(400,900), debug_normal * 50, Color.RED, 2.0) # normal
# draw_line(Vector2.ZERO, debug_bounce * 50, Color.GREEN, 2.0) # bounce direction
# draw_line(Vector2.ZERO, debug_incoming * 50, Color.BLUE, 2.0) # incoming projectile
func _on_area_entered(area):
if area.is_in_group("Projectiles"):
draw_line(Vector2(400,900), debug_normal * 50, Color.RED, 2.0) # normal
print("projectile has hit player shield")
#gets the proper velocity
var projectile_velocity = area.get_parent().get_facing_direction()
print("projectile speed......................", projectile_velocity)
var shield_normal = global_transform.x.normalized()
#var bounceTrajectory: Vector2 = projectile_velocity.bounce(shield_normal)
bounceTrajectory = projectile_velocity.bounce(shield_normal)
print("Shield Normal: ", shield_normal)
if area.get_parent().has_method("changeDirection"):
draw_line(bounceTrajectory, debug_normal * 50, Color.RED, 2.0)
# area.changeDirection(bounceTrajectory)
# area.get_parent().changeTrajectory(bounceTrajectory)
area.get_parent().changeDirection(bounceTrajectory)
#if area.has_method("bounce"):
# area.bounce(bounceTrajectory)
# Called every frame. 'delta' is the elapsed time since the previous frame.
#func _process(delta: float) -> void:
# pass

View File

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

View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2016-2023 The Godot Engine community
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,10 @@
[configuration]
entry_symbol = "git_plugin_init"
compatibility_minimum = "4.2.0"
[libraries]
linux.editor.x86_64 = "linux/libgit_plugin.linux.editor.x86_64.so"
macos.editor = "macos/libgit_plugin.macos.editor.universal.dylib"
windows.editor.x86_64 = "windows/libgit_plugin.windows.editor.x86_64.dll"

View File

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

View File

@@ -15,6 +15,19 @@ 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]
move_up={

View File

@@ -6,7 +6,66 @@ Using godot version 4.6
- collisions
- projectiles
- attack types?
Done
- WASD movement
Current imported assests:
https://screamingbrainstudios.itch.io/tiny-texture-pack
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)