forked from andreyratz/block
Added Creature
Added the creature from Mika's art and also implemented the animations as well
This commit is contained in:
BIN
block/Assets/GameplayArt/Creature2Spritesheet.png
Normal file
BIN
block/Assets/GameplayArt/Creature2Spritesheet.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 247 KiB |
40
block/Assets/GameplayArt/Creature2Spritesheet.png.import
Normal file
40
block/Assets/GameplayArt/Creature2Spritesheet.png.import
Normal file
@@ -0,0 +1,40 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://c8c6fh1jtdd0i"
|
||||
path="res://.godot/imported/Creature2Spritesheet.png-e2e0ef81f527506d5f444ce2e43b5c24.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Assets/GameplayArt/Creature2Spritesheet.png"
|
||||
dest_files=["res://.godot/imported/Creature2Spritesheet.png-e2e0ef81f527506d5f444ce2e43b5c24.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
89
block/Scenes/Creature_2.tscn
Normal file
89
block/Scenes/Creature_2.tscn
Normal file
@@ -0,0 +1,89 @@
|
||||
[gd_scene format=3 uid="uid://cja4ibeplpuvg"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://db1oeukux1376" path="res://Scenes/Enemy1.tscn" id="1_1lo65"]
|
||||
[ext_resource type="Texture2D" uid="uid://c8c6fh1jtdd0i" path="res://Assets/GameplayArt/Creature2Spritesheet.png" id="2_wvt7r"]
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_uldxc"]
|
||||
atlas = ExtResource("2_wvt7r")
|
||||
region = Rect2(0, 0, 1002, 1002)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_hm5n8"]
|
||||
atlas = ExtResource("2_wvt7r")
|
||||
region = Rect2(1002, 0, 1002, 1002)
|
||||
|
||||
[sub_resource type="SpriteFrames" id="SpriteFrames_r1616"]
|
||||
animations = [{
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_uldxc")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_hm5n8")
|
||||
}],
|
||||
"loop": true,
|
||||
"name": &"default",
|
||||
"speed": 1.0
|
||||
}]
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_sli80"]
|
||||
radius = 18.0
|
||||
|
||||
[sub_resource type="Animation" id="Animation_uldxc"]
|
||||
resource_name = "Wiggle"
|
||||
length = 2.0
|
||||
loop_mode = 1
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Sprite2D:frame")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 1),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 1,
|
||||
"values": [0, 1]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_wvt7r"]
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Sprite2D:frame")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [0]
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_hm5n8"]
|
||||
_data = {
|
||||
&"Idle": SubResource("Animation_uldxc"),
|
||||
&"RESET": SubResource("Animation_wvt7r")
|
||||
}
|
||||
|
||||
[node name="Enemy1" unique_id=1765361359 instance=ExtResource("1_1lo65")]
|
||||
|
||||
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="." index="0" unique_id=769003556]
|
||||
visible = false
|
||||
rotation = -1.5707964
|
||||
scale = Vector2(0.3, 0.3)
|
||||
sprite_frames = SubResource("SpriteFrames_r1616")
|
||||
frame = 1
|
||||
frame_progress = 0.7216727
|
||||
|
||||
[node name="Sprite2D" parent="." index="1" unique_id=93765061]
|
||||
position = Vector2(0, 0)
|
||||
rotation = -1.5707964
|
||||
texture = ExtResource("2_wvt7r")
|
||||
hframes = 2
|
||||
|
||||
[node name="CollisionShape2D" parent="." index="2" unique_id=1856443411]
|
||||
shape = SubResource("CircleShape2D_sli80")
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="." index="4" unique_id=525993328]
|
||||
libraries/ = SubResource("AnimationLibrary_hm5n8")
|
||||
88
block/Scenes/Creature_2.tscn8571099678.tmp
Normal file
88
block/Scenes/Creature_2.tscn8571099678.tmp
Normal file
@@ -0,0 +1,88 @@
|
||||
[gd_scene format=3 uid="uid://cja4ibeplpuvg"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://db1oeukux1376" path="res://Scenes/Enemy1.tscn" id="1_1lo65"]
|
||||
[ext_resource type="Texture2D" uid="uid://c8c6fh1jtdd0i" path="res://Assets/GameplayArt/Creature2Spritesheet.png" id="2_wvt7r"]
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_uldxc"]
|
||||
atlas = ExtResource("2_wvt7r")
|
||||
region = Rect2(0, 0, 1002, 1002)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_hm5n8"]
|
||||
atlas = ExtResource("2_wvt7r")
|
||||
region = Rect2(1002, 0, 1002, 1002)
|
||||
|
||||
[sub_resource type="SpriteFrames" id="SpriteFrames_r1616"]
|
||||
animations = [{
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_uldxc")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_hm5n8")
|
||||
}],
|
||||
"loop": true,
|
||||
"name": &"default",
|
||||
"speed": 1.0
|
||||
}]
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_sli80"]
|
||||
radius = 18.0
|
||||
|
||||
[sub_resource type="Animation" id="Animation_uldxc"]
|
||||
resource_name = "Wiggle"
|
||||
length = 2.0
|
||||
loop_mode = 1
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Sprite2D:frame")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 1),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 1,
|
||||
"values": [0, 1]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_wvt7r"]
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Sprite2D:frame")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [1]
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_hm5n8"]
|
||||
_data = {
|
||||
&"Idle": SubResource("Animation_uldxc"),
|
||||
&"RESET": SubResource("Animation_wvt7r")
|
||||
}
|
||||
|
||||
[node name="Enemy1" unique_id=1765361359 instance=ExtResource("1_1lo65")]
|
||||
|
||||
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="." index="0" unique_id=769003556]
|
||||
visible = false
|
||||
rotation = -1.5707964
|
||||
scale = Vector2(0.3, 0.3)
|
||||
sprite_frames = SubResource("SpriteFrames_r1616")
|
||||
frame = 1
|
||||
frame_progress = 0.7216727
|
||||
|
||||
[node name="Sprite2D" parent="." index="1" unique_id=93765061]
|
||||
texture = ExtResource("2_wvt7r")
|
||||
hframes = 2
|
||||
frame = 1
|
||||
|
||||
[node name="CollisionShape2D" parent="." index="2" unique_id=1856443411]
|
||||
shape = SubResource("CircleShape2D_sli80")
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="." index="4" unique_id=525993328]
|
||||
libraries/ = SubResource("AnimationLibrary_hm5n8")
|
||||
@@ -16,6 +16,7 @@ scale = Vector2(0.3, 0.3)
|
||||
texture = ExtResource("1_g6sln")
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="." unique_id=1856443411]
|
||||
visible = false
|
||||
scale = Vector2(6, 6)
|
||||
shape = SubResource("CapsuleShape2D_g6sln")
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
[ext_resource type="PackedScene" uid="uid://du7hapc7kscm6" path="res://Scenes/game.tscn" id="1_i0wgn"]
|
||||
[ext_resource type="Shader" uid="uid://dyr1qs8xwscgm" path="res://Assets/Shaders/ShaderTest.gdshader" id="2_exucn"]
|
||||
[ext_resource type="Texture2D" uid="uid://djar02rjgqabs" path="res://Assets/GameplayArt/Black.png" id="2_ipaa6"]
|
||||
[ext_resource type="PackedScene" uid="uid://cja4ibeplpuvg" path="res://Scenes/Creature_2.tscn" id="3_meac5"]
|
||||
[ext_resource type="Texture2D" uid="uid://b4xxaewt8vfbl" path="res://Assets/GameplayArt/PallateV1.png" id="4_vet50"]
|
||||
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_exucn"]
|
||||
@@ -22,6 +23,9 @@ shader_parameter/target_resolution = Vector2(640, 360)
|
||||
[node name="Sprite2D" parent="Game/ArenaGameManager/MapArena/Parallax2D" parent_id_path=PackedInt32Array(850692785, 1024187604, 194007747, 598922861) index="0" unique_id=1318408175]
|
||||
texture = ExtResource("2_ipaa6")
|
||||
|
||||
[node name="Enemy2" parent="Game" unique_id=1765361359 instance=ExtResource("3_meac5")]
|
||||
position = Vector2(258, 363)
|
||||
|
||||
[node name="CanvasLayer" type="CanvasLayer" parent="." unique_id=298300130]
|
||||
layer = 10
|
||||
|
||||
|
||||
@@ -28,8 +28,11 @@ var current_state = States.IDLE
|
||||
|
||||
|
||||
@onready var player: CharacterBody2D = get_tree().get_first_node_in_group("player")
|
||||
@onready var _animation_player = $AnimationPlayer
|
||||
@export var Projectile: PackedScene
|
||||
|
||||
var anim_player
|
||||
|
||||
func _on_timer_timeout() -> void:
|
||||
$DirectionTimer.wait_time = chose([1,2,3])
|
||||
if current_state !=States.CHASE:
|
||||
@@ -49,11 +52,17 @@ func wraparound():
|
||||
var direction = global_position.direction_to(player.global_position)
|
||||
global_position += direction * max_distance*2
|
||||
|
||||
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
if has_node("AnimationPlayer"):
|
||||
anim_player = get_node_or_null("AnimationPlayer")
|
||||
var list = anim_player.get_animation_list()
|
||||
print(list) # Outputs something like ["idle", "walk", "default"]
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
if has_node("AnimationPlayer"):
|
||||
anim_player = get_node_or_null("AnimationPlayer")
|
||||
if anim_player.has_animation("Idle"):
|
||||
anim_player.play("Idle")
|
||||
look_at(player.global_position)
|
||||
#print(player.global_position)
|
||||
var distance = global_position.distance_to(player.global_position)
|
||||
@@ -61,29 +70,4 @@ func _process(delta: float) -> void:
|
||||
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()
|
||||
"""
|
||||
|
||||
@@ -14,11 +14,12 @@ script = ExtResource("1_cvnsp")
|
||||
|
||||
[node name="Body" type="Sprite2D" parent="." unique_id=719417979]
|
||||
rotation = -1.5707964
|
||||
scale = Vector2(0.114894986, 0.11449075)
|
||||
scale = Vector2(0.115, 0.115)
|
||||
texture = ExtResource("2_vgqql")
|
||||
|
||||
[node name="BodyColision" type="CollisionShape2D" parent="." unique_id=1477808378]
|
||||
scale = Vector2(4.2653956, 4.2653956)
|
||||
visible = false
|
||||
scale = Vector2(3.5, 3.5)
|
||||
shape = SubResource("CircleShape2D_v0iea")
|
||||
|
||||
[node name="Shield" type="Sprite2D" parent="." unique_id=212386399]
|
||||
@@ -27,6 +28,7 @@ scale = Vector2(0.15, 0.15)
|
||||
texture = ExtResource("3_6t5aa")
|
||||
|
||||
[node name="ShieldColision" type="CollisionShape2D" parent="." unique_id=948717563]
|
||||
visible = false
|
||||
position = Vector2(50, 0)
|
||||
scale = Vector2(2.5, 6)
|
||||
shape = SubResource("RectangleShape2D_6t5aa")
|
||||
@@ -37,6 +39,7 @@ collision_mask = 2
|
||||
script = ExtResource("4_vgqql")
|
||||
|
||||
[node name="ShieldHitboxCol" type="CollisionShape2D" parent="ShieldHitbox" unique_id=1829894325]
|
||||
visible = false
|
||||
position = Vector2(50, 0)
|
||||
scale = Vector2(2.5, 6)
|
||||
shape = SubResource("RectangleShape2D_6t5aa")
|
||||
|
||||
Reference in New Issue
Block a user