Skip to content

Commit

Permalink
Merge pull request #4 from ben-kahl/ben-kahl-hitbox
Browse files Browse the repository at this point in the history
Hitbox system implemented
  • Loading branch information
ben-kahl authored Feb 15, 2024
2 parents 42e0c23 + 0c18016 commit ba0262d
Show file tree
Hide file tree
Showing 28 changed files with 1,995 additions and 30 deletions.
21 changes: 21 additions & 0 deletions CS361/CS361 Term Project/addons/godot-git-plugin/LICENSE
Original file line number Diff line number Diff line change
@@ -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.
1,349 changes: 1,349 additions & 0 deletions CS361/CS361 Term Project/addons/godot-git-plugin/THIRDPARTY.md

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[configuration]

entry_symbol = "git_plugin_init"
compatibility_minimum = "4.1.0"

[libraries]

macos.editor = "macos/libgit_plugin.macos.editor.universal.dylib"
windows.editor.x86_64 = "win64/libgit_plugin.windows.editor.x86_64.dll"
linux.editor.x86_64 = "linux/libgit_plugin.linux.editor.x86_64.so"
linux.editor.arm64 = "linux/libgit_plugin.linux.editor.arm64.so"
linux.editor.rv64 = ""
Binary file not shown.
Binary file not shown.
7 changes: 7 additions & 0 deletions CS361/CS361 Term Project/addons/godot-git-plugin/plugin.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[plugin]

name="Godot Git Plugin"
description="This plugin lets you interact with Git without leaving the Godot editor. More information can be found at https://github.com/godotengine/godot-git-plugin/wiki"
author="twaritwaikar"
version="v3.1.0"
script="godot-git-plugin.gd"
Binary file not shown.
Binary file not shown.
Binary file not shown.
14 changes: 14 additions & 0 deletions CS361/CS361 Term Project/project.godot
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ config/features=PackedStringArray("4.2", "Forward Plus")
run/max_fps=60
config/icon="res://icon.svg"

[autoload]

InputBuffer="*res://scripts/input_buffer.gd"

[display]

window/size/viewport_width=1920
Expand Down Expand Up @@ -59,3 +63,13 @@ pause={
"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":4194305,"key_label":0,"unicode":0,"echo":false,"script":null)
]
}
dash_right={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":true,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":68,"key_label":0,"unicode":100,"echo":false,"script":null)
]
}
dash_left={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":true,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":65,"key_label":0,"unicode":65,"echo":false,"script":null)
]
}
28 changes: 24 additions & 4 deletions CS361/CS361 Term Project/scenes/character1.tscn
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
[gd_scene load_steps=55 format=3 uid="uid://du6oabv526v8a"]
[gd_scene load_steps=57 format=3 uid="uid://du6oabv526v8a"]

[ext_resource type="Script" path="res://scripts/character1.gd" id="1_8bhqe"]
[ext_resource type="Texture2D" uid="uid://dljhl2f6dbyej" path="res://art/Martial Hero/Sprites/Attack1.png" id="2_6sets"]
[ext_resource type="Script" path="res://scripts/StateMachineChar1.gd" id="2_56fhw"]
[ext_resource type="Script" path="res://scripts/sm_char_1.gd" id="2_56fhw"]
[ext_resource type="PackedScene" uid="uid://dhjw00cpa1bg4" path="res://scenes/hitbox.tscn" id="2_ix0gc"]
[ext_resource type="Texture2D" uid="uid://dkxye3anfyvjk" path="res://art/Martial Hero/Sprites/Death.png" id="3_s0mtn"]
[ext_resource type="Texture2D" uid="uid://b877el3ghj0dc" path="res://art/Martial Hero/Sprites/Jump.png" id="4_25ok7"]
[ext_resource type="Texture2D" uid="uid://0jr5354di4ba" path="res://art/Martial Hero/Sprites/Fall.png" id="4_b61d6"]
Expand Down Expand Up @@ -303,7 +304,6 @@ animations = [{
[sub_resource type="Animation" id="Animation_ysp03"]
resource_name = "Attack1"
length = 0.300002
loop_mode = 1
step = 0.0166667
tracks/0/type = "value"
tracks/0/imported = false
Expand All @@ -318,6 +318,22 @@ tracks/0/keys = {
"values": [0, 1, 2, 3, 4, 5]
}

[sub_resource type="Animation" id="Animation_6xt20"]
resource_name = "Crouch"
step = 0.0166667
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0.1, 0.2, 0.3, 0.4, 0.5, 0.6),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1),
"update": 1,
"values": [0, 1, 2, 3, 4, 5]
}

[sub_resource type="Animation" id="Animation_uqdjs"]
resource_name = "Hit"
step = 0.0166667
Expand Down Expand Up @@ -402,6 +418,7 @@ tracks/0/keys = {
[sub_resource type="AnimationLibrary" id="AnimationLibrary_00aio"]
_data = {
"Attack1": SubResource("Animation_ysp03"),
"Crouch": SubResource("Animation_6xt20"),
"Hit": SubResource("Animation_uqdjs"),
"Idle": SubResource("Animation_b2bte"),
"Jump": SubResource("Animation_oq6dt"),
Expand All @@ -415,16 +432,19 @@ size = Vector2(32, 56)
[node name="Character1" type="CharacterBody2D"]
collision_layer = 3
script = ExtResource("1_8bhqe")
hitbox = ExtResource("2_ix0gc")

[node name="StateMachine" type="Node" parent="."]
script = ExtResource("2_56fhw")

[node name="Character1Sprite" type="AnimatedSprite2D" parent="."]
scale = Vector2(8.77, 8.77)
sprite_frames = SubResource("SpriteFrames_dcwh6")
animation = &"Idle"
animation = &"Crouch"
frame = 5

[node name="AnimationPlayer" type="AnimationPlayer" parent="Character1Sprite"]
reset_on_save = false
libraries = {
"": SubResource("AnimationLibrary_00aio")
}
Expand Down
12 changes: 12 additions & 0 deletions CS361/CS361 Term Project/scenes/hitbox.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[gd_scene load_steps=3 format=3 uid="uid://dhjw00cpa1bg4"]

[ext_resource type="Script" path="res://scripts/hitbox.gd" id="1_ojlg6"]

[sub_resource type="RectangleShape2D" id="RectangleShape2D_qoj7x"]

[node name="Hitbox" type="Area2D"]
script = ExtResource("1_ojlg6")

[node name="HitboxShape" type="CollisionShape2D" parent="."]
position = Vector2(75, 51)
shape = SubResource("RectangleShape2D_qoj7x")
6 changes: 6 additions & 0 deletions CS361/CS361 Term Project/scenes/input_buffer.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[gd_scene load_steps=2 format=3 uid="uid://7hltlpg3n5t4"]

[ext_resource type="Script" path="res://scripts/input_buffer.gd" id="1_kxenh"]

[node name="input_buffer" type="Node"]
script = ExtResource("1_kxenh")
2 changes: 1 addition & 1 deletion CS361/CS361 Term Project/scenes/main_menu.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ offset_top = -55.0
grow_horizontal = 0
grow_vertical = 0
theme_override_font_sizes/font_size = 40
text = "Use the mouse and left click to select mode"
text = "Use the mouse and left click to navigate menus"

[connection signal="pressed" from="Versus" to="." method="_on_versus_pressed"]
[connection signal="pressed" from="Training" to="." method="_on_training_pressed"]
Expand Down
10 changes: 10 additions & 0 deletions CS361/CS361 Term Project/scenes/pause_menu.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,13 @@ text = "Resume"
layout_mode = 2
theme_override_font_sizes/font_size = 40
text = "Back to Main Menu"

[node name="Controls" type="Label" parent="ColorRect/CenterContainer/PanelContainer/MarginContainer/VBoxContainer"]
layout_mode = 2
text = "A to move left, D to move right
Shift+A/D to sprint left/right
O to attack
ESC for pause
Use mouse to navigate pause menu"
horizontal_alignment = 1
vertical_alignment = 1
108 changes: 108 additions & 0 deletions CS361/CS361 Term Project/scenes/training.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
[gd_scene load_steps=10 format=3 uid="uid://nlvhjymubrgp"]

[ext_resource type="Script" path="res://scripts/training.gd" id="1_alt73"]
[ext_resource type="Texture2D" uid="uid://dmnmpgg22xinx" path="res://art/stage1Background.png" id="2_8qltu"]
[ext_resource type="PackedScene" uid="uid://du6oabv526v8a" path="res://scenes/character1.tscn" id="3_rirq4"]
[ext_resource type="Script" path="res://scripts/stage_cam.gd" id="4_0cw3g"]
[ext_resource type="Script" path="res://scripts/health_bar_p1.gd" id="5_sgoq4"]
[ext_resource type="Script" path="res://scripts/health_bar_p2.gd" id="6_yqfwc"]
[ext_resource type="PackedScene" uid="uid://d0vit3ssobmxx" path="res://scenes/pause_menu.tscn" id="7_am2xm"]

[sub_resource type="RectangleShape2D" id="RectangleShape2D_ogvlw"]
size = Vector2(3097, 8)

[sub_resource type="RectangleShape2D" id="RectangleShape2D_evgoj"]
size = Vector2(60, 1094)

[node name="Node" type="Node"]
script = ExtResource("1_alt73")

[node name="HealthReset" type="Timer" parent="."]
wait_time = 2.0
one_shot = true

[node name="RoundTimer" type="Timer" parent="."]

[node name="ParallaxBackground" type="ParallaxBackground" parent="."]
follow_viewport_enabled = true

[node name="stage" type="Sprite2D" parent="ParallaxBackground"]
position = Vector2(960, 540)
texture = ExtResource("2_8qltu")
metadata/_edit_group_ = true

[node name="Bounds" type="StaticBody2D" parent="ParallaxBackground"]
position = Vector2(-608, 540)
collision_layer = 3
metadata/_edit_group_ = true

[node name="Floor" type="CollisionShape2D" parent="ParallaxBackground/Bounds"]
position = Vector2(1575, 540)
shape = SubResource("RectangleShape2D_ogvlw")

[node name="LeftWall" type="CollisionShape2D" parent="ParallaxBackground/Bounds"]
position = Vector2(0, -4)
shape = SubResource("RectangleShape2D_evgoj")

[node name="RightWall" type="CollisionShape2D" parent="ParallaxBackground/Bounds"]
position = Vector2(3125, -4)
shape = SubResource("RectangleShape2D_evgoj")

[node name="Player1StartPos" type="Marker2D" parent="."]
position = Vector2(576, 831)

[node name="Player2StartPos" type="Marker2D" parent="."]
position = Vector2(1300, 831)

[node name="Character1" parent="." instance=ExtResource("3_rirq4")]

[node name="Character2" parent="." instance=ExtResource("3_rirq4")]

[node name="Camera2D" type="Camera2D" parent="."]
position = Vector2(960, 536)
limit_left = -580
limit_top = 0
limit_right = 2500
limit_bottom = 540
drag_left_margin = 0.0
drag_right_margin = 0.0
script = ExtResource("4_0cw3g")
metadata/_edit_group_ = true

[node name="HUD" type="CanvasLayer" parent="."]

[node name="HealthBarP1" type="ProgressBar" parent="HUD" node_paths=PackedStringArray("player1")]
offset_left = 91.0
offset_right = 855.0
offset_bottom = 65.0
show_percentage = false
script = ExtResource("5_sgoq4")
player1 = NodePath("../../Character1")
metadata/_edit_group_ = true

[node name="HealthBarP2" type="ProgressBar" parent="HUD" node_paths=PackedStringArray("player2")]
offset_left = 1062.0
offset_right = 1826.0
offset_bottom = 65.0
show_percentage = false
script = ExtResource("6_yqfwc")
player2 = NodePath("../../Character2")
metadata/_edit_group_ = true

[node name="RoundTime" type="Label" parent="HUD"]
offset_left = 896.0
offset_top = -1.0
offset_right = 1023.0
offset_bottom = 55.0
theme_override_font_sizes/font_size = 50
text = "0"
horizontal_alignment = 1
vertical_alignment = 1
metadata/_edit_group_ = true

[node name="PauseMenu" parent="." instance=ExtResource("7_am2xm")]
visible = false

[connection signal="timeout" from="HealthReset" to="." method="_on_health_reset_timeout"]
[connection signal="health_changed" from="Character1" to="." method="_on_character_1_health_changed"]
[connection signal="health_changed" from="Character2" to="HUD/HealthBarP2" method="_on_character_2_health_changed"]
22 changes: 14 additions & 8 deletions CS361/CS361 Term Project/scenes/versus.tscn
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
[gd_scene load_steps=8 format=3 uid="uid://dmksxolfm4cey"]
[gd_scene load_steps=10 format=3 uid="uid://dmksxolfm4cey"]

[ext_resource type="Script" path="res://scripts/versus.gd" id="1_4omcc"]
[ext_resource type="Texture2D" uid="uid://dmnmpgg22xinx" path="res://art/stage1Background.png" id="1_dos3d"]
[ext_resource type="PackedScene" uid="uid://du6oabv526v8a" path="res://scenes/character1.tscn" id="2_n67mf"]
[ext_resource type="Script" path="res://scripts/HealthBarP1.gd" id="4_qe1jm"]
[ext_resource type="Script" path="res://scripts/stage_cam.gd" id="4_emvwi"]
[ext_resource type="Script" path="res://scripts/health_bar_p1.gd" id="4_qe1jm"]
[ext_resource type="PackedScene" uid="uid://d0vit3ssobmxx" path="res://scenes/pause_menu.tscn" id="5_u86co"]
[ext_resource type="Script" path="res://scripts/health_bar_p2.gd" id="6_uwh25"]

[sub_resource type="RectangleShape2D" id="RectangleShape2D_ogvlw"]
size = Vector2(3097, 8)
Expand All @@ -20,11 +22,8 @@ script = ExtResource("1_4omcc")
[node name="ParallaxBackground" type="ParallaxBackground" parent="."]
follow_viewport_enabled = true

[node name="ParallaxLayer" type="ParallaxLayer" parent="ParallaxBackground"]
[node name="stage" type="Sprite2D" parent="ParallaxBackground"]
position = Vector2(960, 540)
metadata/_edit_group_ = true

[node name="stage" type="Sprite2D" parent="ParallaxBackground/ParallaxLayer"]
texture = ExtResource("1_dos3d")
metadata/_edit_group_ = true

Expand All @@ -46,15 +45,20 @@ position = Vector2(3125, -4)
shape = SubResource("RectangleShape2D_evgoj")

[node name="Player1StartPos" type="Marker2D" parent="."]
position = Vector2(967, 540)
position = Vector2(576, 831)

[node name="Character1" parent="." instance=ExtResource("2_n67mf")]
visible = false

[node name="Camera2D" type="Camera2D" parent="."]
position = Vector2(960, 536)
limit_left = -580
limit_top = 0
limit_right = 2500
limit_bottom = 540
drag_left_margin = 0.0
drag_right_margin = 0.0
script = ExtResource("4_emvwi")
metadata/_edit_group_ = true

[node name="HUD" type="CanvasLayer" parent="."]

Expand All @@ -69,6 +73,7 @@ player1 = NodePath("../../Character1")
offset_left = 1062.0
offset_right = 1826.0
offset_bottom = 65.0
script = ExtResource("6_uwh25")

[node name="RoundTime" type="Label" parent="HUD"]
offset_left = 896.0
Expand All @@ -81,3 +86,4 @@ horizontal_alignment = 1
vertical_alignment = 1

[node name="PauseMenu" parent="." instance=ExtResource("5_u86co")]
visible = false
Loading

0 comments on commit ba0262d

Please sign in to comment.