Compare commits

...

2 Commits

Author SHA1 Message Date
385d722b78 New player based on template! 2024-06-12 22:47:28 -07:00
0cb827a981 UI impovements. 2024-06-08 23:46:15 -07:00
12 changed files with 736 additions and 2 deletions

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=27 format=2] [gd_scene load_steps=28 format=2]
[ext_resource path="res://assets/Backgrounds/bgmuck.png" type="Texture" id=1] [ext_resource path="res://assets/Backgrounds/bgmuck.png" type="Texture" id=1]
[ext_resource path="res://src/playerC/Player.tscn" type="PackedScene" id=2] [ext_resource path="res://src/playerC/Player.tscn" type="PackedScene" id=2]
@ -13,6 +13,7 @@
[ext_resource path="res://assets/UI/Healthbar-Indicator.png" type="Texture" id=11] [ext_resource path="res://assets/UI/Healthbar-Indicator.png" type="Texture" id=11]
[ext_resource path="res://src/UI/HealthBar.gd" type="Script" id=12] [ext_resource path="res://src/UI/HealthBar.gd" type="Script" id=12]
[ext_resource path="res://icon.png" type="Texture" id=13] [ext_resource path="res://icon.png" type="Texture" id=13]
[ext_resource path="res://src/playerD/Player.tscn" type="PackedScene" id=14]
[sub_resource type="ConvexPolygonShape2D" id=2] [sub_resource type="ConvexPolygonShape2D" id=2]
points = PoolVector2Array( 16, 16, 0, 16, 0, 0, 16, 0 ) points = PoolVector2Array( 16, 16, 0, 16, 0, 0, 16, 0 )
@ -149,10 +150,17 @@ scroll_limit_end = Vector2( 1300, 0 )
[node name="ParallaxLayer" type="ParallaxLayer" parent="ParallaxBackground"] [node name="ParallaxLayer" type="ParallaxLayer" parent="ParallaxBackground"]
motion_mirroring = Vector2( 500, 0 ) motion_mirroring = Vector2( 500, 0 )
__meta__ = {
"_edit_group_": true,
"_edit_lock_": true
}
[node name="Bgmuck" type="Sprite" parent="ParallaxBackground/ParallaxLayer"] [node name="Bgmuck" type="Sprite" parent="ParallaxBackground/ParallaxLayer"]
texture = ExtResource( 1 ) texture = ExtResource( 1 )
centered = false centered = false
__meta__ = {
"_edit_lock_": true
}
[node name="TileMap" type="TileMap" parent="."] [node name="TileMap" type="TileMap" parent="."]
tile_set = SubResource( 1 ) tile_set = SubResource( 1 )
@ -164,23 +172,37 @@ __meta__ = {
"_edit_lock_": true "_edit_lock_": true
} }
[node name="Player" parent="." instance=ExtResource( 2 )] [node name="Player" parent="." instance=ExtResource( 14 )]
position = Vector2( 93, 54 )
[node name="PlayerC" parent="." instance=ExtResource( 2 )]
position = Vector2( 137, 54 ) position = Vector2( 137, 54 )
player_number = 2
[node name="CameraControl" type="Position2D" parent="."] [node name="CameraControl" type="Position2D" parent="."]
process_priority = 1 process_priority = 1
script = ExtResource( 5 ) script = ExtResource( 5 )
__meta__ = {
"_edit_group_": true,
"_edit_lock_": true
}
[node name="Line2D" type="Line2D" parent="CameraControl"] [node name="Line2D" type="Line2D" parent="CameraControl"]
visible = false visible = false
points = PoolVector2Array( 0, 0, 160, 160, 241, 217, 406, 261, 358, 359, 43, 412, 53, 279, 250, 121, 355, -64, -4, 167, -141, -162, -274, -190, -321, 55, -211, 196, 564, 205, -325, -173, 174, -15 ) points = PoolVector2Array( 0, 0, 160, 160, 241, 217, 406, 261, 358, 359, 43, 412, 53, 279, 250, 121, 355, -64, -4, 167, -141, -162, -274, -190, -321, 55, -211, 196, 564, 205, -325, -173, 174, -15 )
width = 3.0 width = 3.0
__meta__ = {
"_edit_lock_": true
}
[node name="Camera2D" type="Camera2D" parent="CameraControl"] [node name="Camera2D" type="Camera2D" parent="CameraControl"]
process_priority = 1 process_priority = 1
anchor_mode = 0 anchor_mode = 0
current = true current = true
smoothing_speed = 30.0 smoothing_speed = 30.0
__meta__ = {
"_edit_lock_": true
}
[node name="Left" type="RayCast2D" parent="CameraControl"] [node name="Left" type="RayCast2D" parent="CameraControl"]
position = Vector2( 160, 90 ) position = Vector2( 160, 90 )
@ -189,6 +211,9 @@ cast_to = Vector2( -160, 0 )
collision_mask = 256 collision_mask = 256
collide_with_areas = true collide_with_areas = true
collide_with_bodies = false collide_with_bodies = false
__meta__ = {
"_edit_lock_": true
}
[node name="Right" type="RayCast2D" parent="CameraControl"] [node name="Right" type="RayCast2D" parent="CameraControl"]
position = Vector2( 160, 90 ) position = Vector2( 160, 90 )
@ -197,33 +222,55 @@ cast_to = Vector2( 160, 0 )
collision_mask = 256 collision_mask = 256
collide_with_areas = true collide_with_areas = true
collide_with_bodies = false collide_with_bodies = false
__meta__ = {
"_edit_lock_": true
}
[node name="CameraBoundaries" type="Area2D" parent="."] [node name="CameraBoundaries" type="Area2D" parent="."]
collision_layer = 256 collision_layer = 256
collision_mask = 0 collision_mask = 0
__meta__ = {
"_edit_lock_": true
}
[node name="CollisionShape2D" type="CollisionShape2D" parent="CameraBoundaries"] [node name="CollisionShape2D" type="CollisionShape2D" parent="CameraBoundaries"]
position = Vector2( 0, 66 ) position = Vector2( 0, 66 )
shape = SubResource( 13 ) shape = SubResource( 13 )
__meta__ = {
"_edit_lock_": true
}
[node name="CollisionShape2D2" type="CollisionShape2D" parent="CameraBoundaries"] [node name="CollisionShape2D2" type="CollisionShape2D" parent="CameraBoundaries"]
position = Vector2( 1281, 68 ) position = Vector2( 1281, 68 )
shape = SubResource( 13 ) shape = SubResource( 13 )
__meta__ = {
"_edit_lock_": true
}
[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."] [node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."]
stream = ExtResource( 4 ) stream = ExtResource( 4 )
[node name="EnemyC" parent="." instance=ExtResource( 7 )] [node name="EnemyC" parent="." instance=ExtResource( 7 )]
position = Vector2( 394, 47 ) position = Vector2( 394, 47 )
__meta__ = {
"_edit_lock_": true
}
[node name="EnemyC2" parent="." instance=ExtResource( 7 )] [node name="EnemyC2" parent="." instance=ExtResource( 7 )]
position = Vector2( 492, 27 ) position = Vector2( 492, 27 )
__meta__ = {
"_edit_lock_": true
}
[node name="ActorTemplate" parent="." instance=ExtResource( 6 )] [node name="ActorTemplate" parent="." instance=ExtResource( 6 )]
position = Vector2( 262, 44 ) position = Vector2( 262, 44 )
__meta__ = {
"_edit_lock_": true
}
actor_type = "NPC" actor_type = "NPC"
[node name="UI_Layer" type="CanvasLayer" parent="."] [node name="UI_Layer" type="CanvasLayer" parent="."]
pause_mode = 2
layer = 2 layer = 2
script = ExtResource( 9 ) script = ExtResource( 9 )
@ -258,6 +305,12 @@ custom_fonts/font = ExtResource( 8 )
text = "In a world where danger lurks in your plumbing. One thing decides to do another thing and we all determine it wasn't worth it. Hello World" text = "In a world where danger lurks in your plumbing. One thing decides to do another thing and we all determine it wasn't worth it. Hello World"
autowrap = true autowrap = true
[node name="Polygon2D" type="Polygon2D" parent="UI_Layer/PanelContainer"]
position = Vector2( 75, 16.5 )
scale = Vector2( 0.769547, 0.833333 )
color = Color( 0.533333, 0.533333, 0.533333, 1 )
polygon = PoolVector2Array( 294, 63, 300.177, 63, 307, 63, 300.503, 69 )
[node name="HealthBar" type="TextureProgress" parent="UI_Layer"] [node name="HealthBar" type="TextureProgress" parent="UI_Layer"]
margin_left = 2.0 margin_left = 2.0
margin_top = 2.0 margin_top = 2.0

View File

@ -104,6 +104,12 @@ enabled=PoolStringArray( "res://addons/AsepriteWizard/plugin.cfg" )
common/drop_mouse_on_gui_input_disabled=true common/drop_mouse_on_gui_input_disabled=true
[importer_defaults]
texture={
"flags/filter": false
}
[input] [input]
ui_accept={ ui_accept={

View File

@ -12,10 +12,14 @@ onready var DialogContainerPortrait = $PanelContainer/HSplitContainer/TextureRec
onready var DialogContainerText = $PanelContainer/HSplitContainer/Label onready var DialogContainerText = $PanelContainer/HSplitContainer/Label
onready var DialogIndicator = $PanelContainer/Polygon2D
onready var HUD = $HealthBar onready var HUD = $HealthBar
var current_pane var current_pane
var tween
# Called when the node enters the scene tree for the first time. # Called when the node enters the scene tree for the first time.
func _ready(): func _ready():
# How to change to a differant portrait picture. # How to change to a differant portrait picture.
@ -23,9 +27,14 @@ func _ready():
#DialogContainerText.text = UiManager.dialog_text #DialogContainerText.text = UiManager.dialog_text
UiManager.current_pane = UiManager.UI_PANES.HUD UiManager.current_pane = UiManager.UI_PANES.HUD
#DialogContainer.visible = false #DialogContainer.visible = false
tween = get_tree().create_tween().set_loops()
tween.tween_property(DialogIndicator, "modulate", Color.darkgray, 1)
tween.tween_property(DialogIndicator, "modulate", Color.white , 1)
##tween.tween_property(DialogIndicator, "modulate", Color.RED, 1)
# Called every frame. 'delta' is the elapsed time since the previous frame. # Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta): func _process(delta):
if (UiManager.current_pane != current_pane): if (UiManager.current_pane != current_pane):
print("UI Switch detected") print("UI Switch detected")
current_pane = UiManager.current_pane current_pane = UiManager.current_pane
@ -40,6 +49,7 @@ func _process(delta):
DialogContainerPortrait.texture = UiManager.dialog_portrait DialogContainerPortrait.texture = UiManager.dialog_portrait
DialogContainerText.text = UiManager.dialog_text DialogContainerText.text = UiManager.dialog_text
DialogContainer.visible = true DialogContainer.visible = true
#get_tree().paused = true
_: # Implicitly off _: # Implicitly off
print("UI Turned off") print("UI Turned off")
@ -47,3 +57,4 @@ func _process(delta):
func _unhandled_input(event): func _unhandled_input(event):
if current_pane == UiManager.UI_PANES.DIALOG and Input.is_action_just_pressed("ui_accept"): if current_pane == UiManager.UI_PANES.DIALOG and Input.is_action_just_pressed("ui_accept"):
UiManager.current_pane = UiManager.UI_PANES.HUD UiManager.current_pane = UiManager.UI_PANES.HUD
#get_tree().paused = false

View File

@ -8,6 +8,7 @@ onready var gun = $Gun
func _ready() -> void: func _ready() -> void:
PlayerInfo.player_health = $Health_Component.health PlayerInfo.player_health = $Health_Component.health
movement_component.player_number = player_number
var portrait = preload("res://assets/MManPortrait.png") var portrait = preload("res://assets/MManPortrait.png")

19
src/playerD/Player.gd Normal file
View File

@ -0,0 +1,19 @@
extends Actor
export var player_number: int = 1
onready var player_hurtbox = $Hurtbox_Component/CollisionShape2D
func _ready() -> void:
movement_component.player_number = player_number
func hit_Receiver(damage):
$Hurtbox_Component.set_hurtbox(false)
$Health_Component.take_damage(damage)
if $Health_Component.health > 0:
movement_state_machine.change_state($movement_state_machine/hurt)
PlayerInfo.player_health = $Health_Component.health
yield( get_tree().create_timer(2 + $movement_state_machine/hurt.timeout_seconds), "timeout")
$Hurtbox_Component.set_hurtbox(true)

464
src/playerD/Player.tscn Normal file
View File

@ -0,0 +1,464 @@
[gd_scene load_steps=97 format=2]
[ext_resource path="res://src/templates/Actor/ActorTemplate.tscn" type="PackedScene" id=1]
[ext_resource path="res://src/playerD/movement_component.gd" type="Script" id=2]
[ext_resource path="res://src/playerD/Player.gd" type="Script" id=3]
[ext_resource path="res://src/playerD/states/idle.gd" type="Script" id=4]
[ext_resource path="res://src/playerD/states/move.gd" type="Script" id=5]
[ext_resource path="res://src/playerD/states/fall.gd" type="Script" id=6]
[ext_resource path="res://src/components/Health_Component.tscn" type="PackedScene" id=7]
[sub_resource type="StreamTexture" id=1]
load_path = "res://.import/Mega.png-93dfe0790902b932f7b46f7b23c5d4e7.stex"
[sub_resource type="AtlasTexture" id=2]
atlas = SubResource( 1 )
region = Rect2( 1680, 800, 240, 160 )
[sub_resource type="AtlasTexture" id=3]
atlas = SubResource( 1 )
region = Rect2( 1920, 800, 240, 160 )
[sub_resource type="AtlasTexture" id=4]
atlas = SubResource( 1 )
region = Rect2( 2160, 800, 240, 160 )
[sub_resource type="AtlasTexture" id=5]
atlas = SubResource( 1 )
region = Rect2( 0, 960, 240, 160 )
[sub_resource type="AtlasTexture" id=6]
atlas = SubResource( 1 )
region = Rect2( 240, 960, 240, 160 )
[sub_resource type="AtlasTexture" id=7]
atlas = SubResource( 1 )
region = Rect2( 480, 960, 240, 160 )
[sub_resource type="AtlasTexture" id=8]
atlas = SubResource( 1 )
region = Rect2( 720, 960, 240, 160 )
[sub_resource type="AtlasTexture" id=9]
atlas = SubResource( 1 )
region = Rect2( 960, 960, 240, 160 )
[sub_resource type="AtlasTexture" id=10]
atlas = SubResource( 1 )
region = Rect2( 1200, 960, 240, 160 )
[sub_resource type="AtlasTexture" id=11]
atlas = SubResource( 1 )
region = Rect2( 1440, 960, 240, 160 )
[sub_resource type="AtlasTexture" id=12]
atlas = SubResource( 1 )
region = Rect2( 960, 160, 240, 160 )
[sub_resource type="AtlasTexture" id=13]
atlas = SubResource( 1 )
region = Rect2( 1200, 160, 240, 160 )
[sub_resource type="AtlasTexture" id=14]
atlas = SubResource( 1 )
region = Rect2( 1440, 160, 240, 160 )
[sub_resource type="AtlasTexture" id=15]
atlas = SubResource( 1 )
region = Rect2( 1680, 160, 240, 160 )
[sub_resource type="AtlasTexture" id=16]
atlas = SubResource( 1 )
region = Rect2( 1920, 160, 240, 160 )
[sub_resource type="AtlasTexture" id=17]
atlas = SubResource( 1 )
region = Rect2( 1200, 0, 240, 160 )
[sub_resource type="AtlasTexture" id=18]
atlas = SubResource( 1 )
region = Rect2( 0, 0, 240, 160 )
[sub_resource type="AtlasTexture" id=19]
atlas = SubResource( 1 )
region = Rect2( 1440, 0, 240, 160 )
[sub_resource type="AtlasTexture" id=20]
atlas = SubResource( 1 )
region = Rect2( 1680, 0, 240, 160 )
[sub_resource type="AtlasTexture" id=21]
atlas = SubResource( 1 )
region = Rect2( 1920, 0, 240, 160 )
[sub_resource type="AtlasTexture" id=22]
atlas = SubResource( 1 )
region = Rect2( 2160, 0, 240, 160 )
[sub_resource type="AtlasTexture" id=23]
atlas = SubResource( 1 )
region = Rect2( 2160, 160, 240, 160 )
[sub_resource type="AtlasTexture" id=24]
atlas = SubResource( 1 )
region = Rect2( 0, 320, 240, 160 )
[sub_resource type="AtlasTexture" id=25]
atlas = SubResource( 1 )
region = Rect2( 240, 320, 240, 160 )
[sub_resource type="AtlasTexture" id=26]
atlas = SubResource( 1 )
region = Rect2( 480, 320, 240, 160 )
[sub_resource type="AtlasTexture" id=27]
atlas = SubResource( 1 )
region = Rect2( 720, 320, 240, 160 )
[sub_resource type="AtlasTexture" id=28]
atlas = SubResource( 1 )
region = Rect2( 960, 320, 240, 160 )
[sub_resource type="AtlasTexture" id=29]
atlas = SubResource( 1 )
region = Rect2( 1200, 320, 240, 160 )
[sub_resource type="AtlasTexture" id=30]
atlas = SubResource( 1 )
region = Rect2( 1920, 480, 240, 160 )
[sub_resource type="AtlasTexture" id=31]
atlas = SubResource( 1 )
region = Rect2( 2160, 480, 240, 160 )
[sub_resource type="AtlasTexture" id=32]
atlas = SubResource( 1 )
region = Rect2( 0, 640, 240, 160 )
[sub_resource type="AtlasTexture" id=33]
atlas = SubResource( 1 )
region = Rect2( 240, 640, 240, 160 )
[sub_resource type="AtlasTexture" id=34]
atlas = SubResource( 1 )
region = Rect2( 480, 640, 240, 160 )
[sub_resource type="AtlasTexture" id=35]
atlas = SubResource( 1 )
region = Rect2( 720, 640, 240, 160 )
[sub_resource type="AtlasTexture" id=36]
atlas = SubResource( 1 )
region = Rect2( 960, 640, 240, 160 )
[sub_resource type="AtlasTexture" id=37]
atlas = SubResource( 1 )
region = Rect2( 1200, 640, 240, 160 )
[sub_resource type="AtlasTexture" id=38]
atlas = SubResource( 1 )
region = Rect2( 1440, 640, 240, 160 )
[sub_resource type="AtlasTexture" id=39]
atlas = SubResource( 1 )
region = Rect2( 1680, 640, 240, 160 )
[sub_resource type="AtlasTexture" id=40]
atlas = SubResource( 1 )
region = Rect2( 1920, 640, 240, 160 )
[sub_resource type="AtlasTexture" id=41]
atlas = SubResource( 1 )
region = Rect2( 2160, 640, 240, 160 )
[sub_resource type="AtlasTexture" id=42]
atlas = SubResource( 1 )
region = Rect2( 0, 800, 240, 160 )
[sub_resource type="AtlasTexture" id=43]
atlas = SubResource( 1 )
region = Rect2( 240, 800, 240, 160 )
[sub_resource type="AtlasTexture" id=44]
atlas = SubResource( 1 )
region = Rect2( 480, 800, 240, 160 )
[sub_resource type="AtlasTexture" id=45]
atlas = SubResource( 1 )
region = Rect2( 720, 800, 240, 160 )
[sub_resource type="AtlasTexture" id=46]
atlas = SubResource( 1 )
region = Rect2( 960, 800, 240, 160 )
[sub_resource type="AtlasTexture" id=47]
atlas = SubResource( 1 )
region = Rect2( 1200, 800, 240, 160 )
[sub_resource type="AtlasTexture" id=48]
atlas = SubResource( 1 )
region = Rect2( 1440, 800, 240, 160 )
[sub_resource type="AtlasTexture" id=49]
atlas = SubResource( 1 )
region = Rect2( 1680, 320, 240, 160 )
[sub_resource type="AtlasTexture" id=50]
atlas = SubResource( 1 )
region = Rect2( 1920, 320, 240, 160 )
[sub_resource type="AtlasTexture" id=51]
atlas = SubResource( 1 )
region = Rect2( 2160, 320, 240, 160 )
[sub_resource type="AtlasTexture" id=52]
atlas = SubResource( 1 )
region = Rect2( 0, 480, 240, 160 )
[sub_resource type="AtlasTexture" id=53]
atlas = SubResource( 1 )
region = Rect2( 240, 480, 240, 160 )
[sub_resource type="AtlasTexture" id=54]
atlas = SubResource( 1 )
region = Rect2( 480, 480, 240, 160 )
[sub_resource type="AtlasTexture" id=55]
atlas = SubResource( 1 )
region = Rect2( 720, 480, 240, 160 )
[sub_resource type="AtlasTexture" id=56]
atlas = SubResource( 1 )
region = Rect2( 960, 480, 240, 160 )
[sub_resource type="AtlasTexture" id=57]
atlas = SubResource( 1 )
region = Rect2( 1200, 480, 240, 160 )
[sub_resource type="AtlasTexture" id=58]
atlas = SubResource( 1 )
region = Rect2( 1440, 480, 240, 160 )
[sub_resource type="AtlasTexture" id=59]
atlas = SubResource( 1 )
region = Rect2( 0, 160, 240, 160 )
[sub_resource type="AtlasTexture" id=60]
atlas = SubResource( 1 )
region = Rect2( 240, 160, 240, 160 )
[sub_resource type="AtlasTexture" id=61]
atlas = SubResource( 1 )
region = Rect2( 480, 160, 240, 160 )
[sub_resource type="AtlasTexture" id=62]
atlas = SubResource( 1 )
region = Rect2( 720, 160, 240, 160 )
[sub_resource type="AtlasTexture" id=63]
atlas = SubResource( 1 )
region = Rect2( 1680, 960, 240, 160 )
[sub_resource type="AtlasTexture" id=64]
atlas = SubResource( 1 )
region = Rect2( 1920, 960, 240, 160 )
[sub_resource type="AtlasTexture" id=65]
atlas = SubResource( 1 )
region = Rect2( 2160, 960, 240, 160 )
[sub_resource type="AtlasTexture" id=66]
atlas = SubResource( 1 )
region = Rect2( 0, 1120, 240, 160 )
[sub_resource type="AtlasTexture" id=67]
atlas = SubResource( 1 )
region = Rect2( 240, 1120, 240, 160 )
[sub_resource type="AtlasTexture" id=68]
atlas = SubResource( 1 )
region = Rect2( 480, 1120, 240, 160 )
[sub_resource type="AtlasTexture" id=69]
atlas = SubResource( 1 )
region = Rect2( 720, 1120, 240, 160 )
[sub_resource type="AtlasTexture" id=70]
atlas = SubResource( 1 )
region = Rect2( 960, 1120, 240, 160 )
[sub_resource type="AtlasTexture" id=71]
atlas = SubResource( 1 )
region = Rect2( 1200, 1120, 240, 160 )
[sub_resource type="AtlasTexture" id=72]
atlas = SubResource( 1 )
region = Rect2( 1440, 1120, 240, 160 )
[sub_resource type="AtlasTexture" id=73]
atlas = SubResource( 1 )
region = Rect2( 1680, 1120, 240, 160 )
[sub_resource type="AtlasTexture" id=74]
atlas = SubResource( 1 )
region = Rect2( 1920, 1120, 240, 160 )
[sub_resource type="AtlasTexture" id=75]
atlas = SubResource( 1 )
region = Rect2( 2160, 1120, 240, 160 )
[sub_resource type="AtlasTexture" id=76]
atlas = SubResource( 1 )
region = Rect2( 0, 1280, 240, 160 )
[sub_resource type="AtlasTexture" id=77]
atlas = SubResource( 1 )
region = Rect2( 240, 1280, 240, 160 )
[sub_resource type="AtlasTexture" id=78]
atlas = SubResource( 1 )
region = Rect2( 480, 1280, 240, 160 )
[sub_resource type="AtlasTexture" id=79]
atlas = SubResource( 1 )
region = Rect2( 720, 1280, 240, 160 )
[sub_resource type="AtlasTexture" id=80]
atlas = SubResource( 1 )
region = Rect2( 960, 1280, 240, 160 )
[sub_resource type="AtlasTexture" id=81]
atlas = SubResource( 1 )
region = Rect2( 1200, 1280, 240, 160 )
[sub_resource type="AtlasTexture" id=82]
atlas = SubResource( 1 )
region = Rect2( 1440, 1280, 240, 160 )
[sub_resource type="AtlasTexture" id=83]
atlas = SubResource( 1 )
region = Rect2( 240, 0, 240, 160 )
[sub_resource type="AtlasTexture" id=84]
atlas = SubResource( 1 )
region = Rect2( 480, 0, 240, 160 )
[sub_resource type="AtlasTexture" id=85]
atlas = SubResource( 1 )
region = Rect2( 720, 0, 240, 160 )
[sub_resource type="AtlasTexture" id=86]
atlas = SubResource( 1 )
region = Rect2( 960, 0, 240, 160 )
[sub_resource type="AtlasTexture" id=87]
atlas = SubResource( 1 )
region = Rect2( 1440, 320, 240, 160 )
[sub_resource type="SpriteFrames" id=88]
animations = [ {
"frames": [ SubResource( 2 ), SubResource( 3 ), SubResource( 4 ), SubResource( 5 ), SubResource( 6 ), SubResource( 7 ), SubResource( 8 ), SubResource( 9 ), SubResource( 10 ), SubResource( 11 ) ],
"loop": true,
"name": "climb",
"speed": 10.0
}, {
"frames": [ SubResource( 12 ), SubResource( 12 ), SubResource( 12 ), SubResource( 13 ), SubResource( 14 ), SubResource( 15 ), SubResource( 16 ), SubResource( 16 ), SubResource( 16 ) ],
"loop": true,
"name": "dash",
"speed": 10.0
}, {
"frames": [ SubResource( 17 ), SubResource( 17 ), SubResource( 17 ), SubResource( 17 ), SubResource( 17 ), SubResource( 17 ), SubResource( 17 ), SubResource( 17 ), SubResource( 17 ), SubResource( 17 ), SubResource( 17 ), SubResource( 17 ), SubResource( 17 ), SubResource( 17 ), SubResource( 17 ), SubResource( 17 ), SubResource( 17 ), SubResource( 17 ), SubResource( 17 ), SubResource( 17 ), SubResource( 17 ), SubResource( 17 ), SubResource( 17 ), SubResource( 17 ), SubResource( 17 ), SubResource( 17 ), SubResource( 17 ), SubResource( 17 ), SubResource( 17 ), SubResource( 17 ), SubResource( 18 ), SubResource( 19 ), SubResource( 20 ), SubResource( 21 ), SubResource( 22 ) ],
"loop": true,
"name": "idle",
"speed": 10.0
}, {
"frames": [ SubResource( 23 ), SubResource( 24 ), SubResource( 25 ), SubResource( 26 ), SubResource( 24 ), SubResource( 27 ), SubResource( 28 ), SubResource( 29 ) ],
"loop": false,
"name": "jump",
"speed": 10.0
}, {
"frames": [ SubResource( 30 ), SubResource( 31 ), SubResource( 32 ), SubResource( 33 ), SubResource( 34 ), SubResource( 35 ), SubResource( 36 ), SubResource( 37 ), SubResource( 38 ), SubResource( 39 ), SubResource( 40 ), SubResource( 41 ), SubResource( 42 ), SubResource( 43 ), SubResource( 44 ), SubResource( 45 ), SubResource( 46 ), SubResource( 47 ), SubResource( 48 ) ],
"loop": true,
"name": "roll",
"speed": 10.0
}, {
"frames": [ SubResource( 49 ), SubResource( 50 ), SubResource( 51 ), SubResource( 52 ), SubResource( 53 ), SubResource( 54 ), SubResource( 55 ), SubResource( 56 ), SubResource( 57 ), SubResource( 58 ) ],
"loop": true,
"name": "run",
"speed": 10.0
}, {
"frames": [ SubResource( 59 ), SubResource( 60 ), SubResource( 61 ), SubResource( 62 ) ],
"loop": true,
"name": "shoot",
"speed": 10.0
}, {
"frames": [ SubResource( 63 ), SubResource( 64 ), SubResource( 65 ), SubResource( 65 ), SubResource( 66 ), SubResource( 67 ), SubResource( 68 ), SubResource( 69 ), SubResource( 69 ), SubResource( 70 ), SubResource( 71 ), SubResource( 72 ), SubResource( 73 ), SubResource( 74 ), SubResource( 75 ), SubResource( 76 ), SubResource( 77 ), SubResource( 78 ), SubResource( 79 ), SubResource( 80 ), SubResource( 81 ), SubResource( 82 ) ],
"loop": true,
"name": "slash",
"speed": 10.0
}, {
"frames": [ SubResource( 18 ), SubResource( 83 ), SubResource( 84 ), SubResource( 85 ), SubResource( 86 ) ],
"loop": true,
"name": "stand",
"speed": 1.0
}, {
"frames": [ SubResource( 87 ) ],
"loop": false,
"name": "step",
"speed": 10.0
} ]
[sub_resource type="RectangleShape2D" id=89]
extents = Vector2( 12, 16 )
[node name="Player" instance=ExtResource( 1 )]
script = ExtResource( 3 )
actor_type = "Player"
player_number = 1
[node name="AnimatedSprite" parent="." index="0"]
position = Vector2( -1, -51 )
frames = SubResource( 88 )
animation = "idle"
frame = 22
flip_h = false
__meta__ = {
"_aseprite_wizard_config_": {
"layer": "",
"o_ex_p": "",
"o_folder": "res://assets",
"o_name": "",
"only_visible": true,
"op_exp": false,
"slice": "",
"source": "D:/Sync/Assets/Library/Mega.ase"
}
}
[node name="movement_component" parent="." index="2"]
script = ExtResource( 2 )
player_number = 1
[node name="idle" parent="movement_state_machine" index="0"]
script = ExtResource( 4 )
animation_sequence = [ "idle" ]
[node name="fall" parent="movement_state_machine" index="1"]
script = ExtResource( 6 )
animation_sequence = [ "jump" ]
[node name="move" parent="movement_state_machine" index="2"]
script = ExtResource( 5 )
animation_sequence = [ "run" ]
[node name="Hurtbox_Component" parent="." index="4"]
collision_layer = 16
collision_mask = 0
hurtbox_entered_function = "hit_Receiver"
[node name="CollisionShape2D" parent="Hurtbox_Component" index="0"]
position = Vector2( 0, -2 )
shape = SubResource( 89 )
[node name="Health_Component" parent="." index="6" instance=ExtResource( 7 )]
max_health = 100

BIN
src/playerD/assets/Mega.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 90 KiB

View File

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/Mega.png-51b5daca6d4f588ba3190d67e24a0cc1.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://src/playerD/assets/Mega.png"
dest_files=[ "res://.import/Mega.png-51b5daca6d4f588ba3190d67e24a0cc1.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

View File

@ -0,0 +1,75 @@
extends MovementComponent
## Constants available to you
# UP = -1.0
# DOWN = 1.0
# LEFT = -1.0
# RIGHT = 1.0
# Avalable functions to call
# A Series of helper functions
# go_up():
# go_down():
# go_left():
# go_right():
# stop():
export var player_number: int = 1
func process_physics(delta):
PlayerInfo.player_position = owner.global_position
func process_input(event: InputEvent):
get_movement_direction()
# Return the desired direction of movement for the character
# in the range [-1, 1], where positive values indicate a desire
# to move to the right and negative values to the left.
func get_movement_direction() -> float:
#return Input.get_axis('move_left', 'move_right')
desired_movement_vector.x = Input.get_axis("move_left_" + str(player_number), "move_right_" + str(player_number))
return Input.get_axis("move_left_" + str(player_number), "move_right_" + str(player_number))
# Return a boolean indicating if the character wants to jump
func wants_jump() -> bool:
if Input.is_action_just_pressed("jump_" + str(player_number)):
desired_movement_vector.y = 1
return true
else:
return false
# Return a boolean indicating if the character wants to jump
func wants_shoot() -> bool:
if Input.is_action_just_pressed("shoot_" + str(player_number)):
return true
else:
return false
## Other needed variables
# desired_movement_vector: Vector2 - Used to store desired movement depending on the state
# current_movement_state:String - The name of the current State
# Since animactor state machine can actually view properties from this type
# I'm thinking about moving the velocity tracker in here instead of player.
# velocity: Vector2 - Current velocity, you can change this at will but state may modify it
# Declare any other member variables here. Examples:
# var a = 2
# var b = "text"
# Called every frame. 'delta' is the elapsed time since the previous frame.
# you do not normally need to define this for Actor
#func process(delta):
# pass
# For Enemy and NPC Actors:
# should be called on the frame process.
# For Player Actors:
# Should be called on the input process

View File

@ -0,0 +1,19 @@
extends StateAnimatedActor
export (NodePath) var idle_node
onready var idle_state: State = get_node(idle_node)
func process_physics(delta: float) -> State:
#parent.velocity.y += gravity * delta
move_component.velocity.y += gravity * delta
move_component.velocity.x = move_component.desired_movement_vector.x * move_speed
move_component.velocity = parent.move_and_slide(move_component.velocity, Vector2(0, -1))
if move_component.get_movement_direction() != 0.0:
parent.transform.x.x = move_component.get_movement_direction()
if parent.is_on_floor():
return idle_state
return null

View File

@ -0,0 +1,30 @@
extends StateAnimatedActor
export (NodePath) var fall_node
export (NodePath) var move_node
onready var fall_state: State = get_node(fall_node)
onready var move_state: State = get_node(move_node)
func enter() -> void:
.enter()
# parent.set_hurtbox(true)
move_component.velocity.x = 0
if debug_state:
print(owner.name, " Move Component: ", move_component.desired_movement_vector.x)
func process_physics(delta: float) -> State:
# parent.velocity.y += gravity * delta
# #parent.velocity = parent.move_and_slide(parent.velocity, Vector2(0, -1))
# parent.velocity.x = move_component.desired_movement_vector.x * move_speed
# parent.velocity = parent.move_and_slide(parent.velocity, Vector2(0, -1))
move_actor_as_desired(delta)
if move_component.velocity.x != 0.0:
return move_state
if !parent.is_on_floor():
return fall_state
return null

View File

@ -0,0 +1,21 @@
extends StateAnimatedActor
export (NodePath) var fall_node
export (NodePath) var idle_node
onready var fall_state: State = get_node(fall_node)
onready var idle_state: State = get_node(idle_node)
func process_physics(delta: float) -> State:
move_actor_as_desired(delta)
if move_component.velocity.x == 0.0:
return idle_state
#Flip the character before tha actual move maybe.
parent.transform.x.x = move_component.get_movement_direction()
if !parent.is_on_floor():
return fall_state
return null