New player based on template!
This commit is contained in:
parent
0cb827a981
commit
385d722b78
|
|
@ -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 )
|
||||||
|
|
@ -171,8 +172,12 @@ __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
|
||||||
|
|
|
||||||
|
|
@ -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={
|
||||||
|
|
|
||||||
|
|
@ -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
19
src/playerD/Player.gd
Normal 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
464
src/playerD/Player.tscn
Normal 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
BIN
src/playerD/assets/Mega.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 90 KiB |
35
src/playerD/assets/Mega.png.import
Normal file
35
src/playerD/assets/Mega.png.import
Normal 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
|
||||||
75
src/playerD/movement_component.gd
Normal file
75
src/playerD/movement_component.gd
Normal 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
|
||||||
|
|
||||||
|
|
||||||
19
src/playerD/states/fall.gd
Normal file
19
src/playerD/states/fall.gd
Normal 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
|
||||||
30
src/playerD/states/idle.gd
Normal file
30
src/playerD/states/idle.gd
Normal 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
|
||||||
21
src/playerD/states/move.gd
Normal file
21
src/playerD/states/move.gd
Normal 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
|
||||||
Loading…
Reference in New Issue
Block a user