From aac57286438b63162ea6539b67ff86197b3e204d Mon Sep 17 00:00:00 2001 From: Victor Turgeon Date: Sun, 15 Jan 2023 13:01:14 -0500 Subject: [PATCH] urinal goes zoom --- Enemies/basic_enemy.gd | 2 +- Enemies/basic_enemy.tscn | 1 + Enemies/urinal_mimic.gd | 59 ++++++++++++++++++ Enemies/urinal_mimic.tscn | 103 ++++++++++++++++++++++++++++++++ GameJam-Vanier.csproj | 2 +- GameJam-Vanier.csproj.old.2 | 7 +++ Player/player.tscn | 2 + Sprites/Urinol.png | Bin 0 -> 635 bytes Sprites/Urinol.png.import | 34 +++++++++++ Sprites/Urinol_MIMIC.png | Bin 0 -> 4454 bytes Sprites/Urinol_MIMIC.png.import | 34 +++++++++++ test_level001.tscn | 26 ++------ 12 files changed, 246 insertions(+), 24 deletions(-) create mode 100644 Enemies/urinal_mimic.gd create mode 100644 Enemies/urinal_mimic.tscn create mode 100644 GameJam-Vanier.csproj.old.2 create mode 100644 Sprites/Urinol.png create mode 100644 Sprites/Urinol.png.import create mode 100644 Sprites/Urinol_MIMIC.png create mode 100644 Sprites/Urinol_MIMIC.png.import diff --git a/Enemies/basic_enemy.gd b/Enemies/basic_enemy.gd index 27e1b39..c80c7f3 100644 --- a/Enemies/basic_enemy.gd +++ b/Enemies/basic_enemy.gd @@ -4,7 +4,7 @@ extends CharacterBody2D @export var ACCELERATION = 1000.0; @export var FRICTION = 1500.0; @export var HP = 100; -@export var DAMAGE = 34; +@export var DAMAGE = 10; @export var COOLDOWN = 2; @onready var raycast = $RayCast2D; diff --git a/Enemies/basic_enemy.tscn b/Enemies/basic_enemy.tscn index 3b52baa..f232147 100644 --- a/Enemies/basic_enemy.tscn +++ b/Enemies/basic_enemy.tscn @@ -31,6 +31,7 @@ shape = SubResource("RectangleShape2D_47nt3") target_position = Vector2(35, 0) [node name="Line2D" type="Line2D" parent="RayCast2D"] +visible = false points = PackedVector2Array(0, 0, 35, 0) width = 5.0 default_color = Color(1, 0, 0, 0.392157) diff --git a/Enemies/urinal_mimic.gd b/Enemies/urinal_mimic.gd new file mode 100644 index 0000000..5432758 --- /dev/null +++ b/Enemies/urinal_mimic.gd @@ -0,0 +1,59 @@ +extends CharacterBody2D + +@export var MAX_SPEED = 500.0; +@export var ACCELERATION = 1000.0; +@export var FRICTION = 1500.0; +@export var HP = 1; +@export var DAMAGE = 25; +@export var COOLDOWN = 10; + +@onready var raycast = $RayCast2D; +@onready var cooldown_timer = $CooldownTimer; +@onready var sprite = $AnimatedSprite2D; + +var player = null; +var is_on_cooldown = false; +var attacking = false; + +func _ready(): + add_to_group("enemies"); + +func _physics_process(delta): + if player == null || !attacking: + return + + var vec_to_player = player.global_position - global_position; + vec_to_player = vec_to_player.normalized(); + raycast.rotation = atan2(vec_to_player.y,vec_to_player.x); + velocity = velocity.move_toward(vec_to_player * MAX_SPEED,ACCELERATION*delta); + move_and_slide(); + + if raycast.is_colliding(): + var coll = raycast.get_collider(); + if coll.name == "Player": + attack(coll); + +func attack(collider): + collider.take_damage(DAMAGE); + kill() + +func take_damage(damage): + HP = HP - damage; + if HP <= 0: + kill(); + +func kill(): + queue_free(); + +func set_player(p): + player = p; + +func _on_cooldown_timer_timeout(): + is_on_cooldown = false; + +func _on_area_2d_body_entered(body): + if body.name == "Player": + sprite.play("default"); + +func _on_animated_sprite_2d_animation_finished(): + attacking = true; diff --git a/Enemies/urinal_mimic.tscn b/Enemies/urinal_mimic.tscn new file mode 100644 index 0000000..d2f06a0 --- /dev/null +++ b/Enemies/urinal_mimic.tscn @@ -0,0 +1,103 @@ +[gd_scene load_steps=14 format=3 uid="uid://p7aa6t787b3d"] + +[ext_resource type="Script" path="res://Enemies/urinal_mimic.gd" id="1_2ga4k"] +[ext_resource type="Texture2D" uid="uid://clw15m8cxj22p" path="res://Sprites/Urinol.png" id="2_3n7wy"] +[ext_resource type="Texture2D" uid="uid://t2d8ft40y5c0" path="res://Sprites/Urinol_MIMIC.png" id="3_fjxqr"] + +[sub_resource type="AtlasTexture" id="AtlasTexture_rqcqj"] +atlas = ExtResource("3_fjxqr") +region = Rect2(0, 0, 64, 64) + +[sub_resource type="AtlasTexture" id="AtlasTexture_hcf1j"] +atlas = ExtResource("3_fjxqr") +region = Rect2(64, 0, 64, 64) + +[sub_resource type="AtlasTexture" id="AtlasTexture_smam5"] +atlas = ExtResource("3_fjxqr") +region = Rect2(128, 0, 64, 64) + +[sub_resource type="AtlasTexture" id="AtlasTexture_mvcd5"] +atlas = ExtResource("3_fjxqr") +region = Rect2(192, 0, 64, 64) + +[sub_resource type="AtlasTexture" id="AtlasTexture_uyisr"] +atlas = ExtResource("3_fjxqr") +region = Rect2(256, 0, 64, 64) + +[sub_resource type="AtlasTexture" id="AtlasTexture_r27p5"] +atlas = ExtResource("3_fjxqr") +region = Rect2(320, 0, 64, 64) + +[sub_resource type="AtlasTexture" id="AtlasTexture_qbor8"] +atlas = ExtResource("3_fjxqr") +region = Rect2(384, 0, 64, 64) + +[sub_resource type="SpriteFrames" id="SpriteFrames_e70cb"] +animations = [{ +"frames": [{ +"duration": 1.0, +"texture": ExtResource("2_3n7wy") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_rqcqj") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_hcf1j") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_smam5") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_mvcd5") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_uyisr") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_r27p5") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_qbor8") +}], +"loop": true, +"name": &"default", +"speed": 5.0 +}] + +[sub_resource type="RectangleShape2D" id="RectangleShape2D_jn4wv"] +size = Vector2(23, 21) + +[sub_resource type="CircleShape2D" id="CircleShape2D_0y76e"] +radius = 120.037 + +[node name="urinal_mimic" type="CharacterBody2D"] +script = ExtResource("1_2ga4k") + +[node name="RayCast2D" type="RayCast2D" parent="."] +target_position = Vector2(30, 0) + +[node name="Line2D" type="Line2D" parent="RayCast2D"] +visible = false +points = PackedVector2Array(0, 0, 30, 0) +width = 4.0 +default_color = Color(0.752941, 0, 0, 1) + +[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."] +position = Vector2(0, 21) +frames = SubResource("SpriteFrames_e70cb") + +[node name="CollisionShape2D" type="CollisionShape2D" parent="."] +position = Vector2(0.5, -0.5) +shape = SubResource("RectangleShape2D_jn4wv") + +[node name="Area2D" type="Area2D" parent="."] +collision_layer = 2 +collision_mask = 2 + +[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"] +shape = SubResource("CircleShape2D_0y76e") + +[node name="CooldownTimer" type="Timer" parent="."] + +[connection signal="animation_finished" from="AnimatedSprite2D" to="." method="_on_animated_sprite_2d_animation_finished"] +[connection signal="body_entered" from="Area2D" to="." method="_on_area_2d_body_entered"] diff --git a/GameJam-Vanier.csproj b/GameJam-Vanier.csproj index 4210b40..2762b39 100644 --- a/GameJam-Vanier.csproj +++ b/GameJam-Vanier.csproj @@ -1,4 +1,4 @@ - + net6.0 true diff --git a/GameJam-Vanier.csproj.old.2 b/GameJam-Vanier.csproj.old.2 new file mode 100644 index 0000000..4210b40 --- /dev/null +++ b/GameJam-Vanier.csproj.old.2 @@ -0,0 +1,7 @@ + + + net6.0 + true + GameJamVanier + + \ No newline at end of file diff --git a/Player/player.tscn b/Player/player.tscn index 5ce5edf..46e87cd 100644 --- a/Player/player.tscn +++ b/Player/player.tscn @@ -18,6 +18,8 @@ animations = [{ size = Vector2(40, 64) [node name="Player" type="CharacterBody2D"] +collision_layer = 3 +collision_mask = 3 script = ExtResource("1_mbyc2") [node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."] diff --git a/Sprites/Urinol.png b/Sprites/Urinol.png new file mode 100644 index 0000000000000000000000000000000000000000..4a5cea4fe4b7507c5af0276ea04f29f03c544068 GIT binary patch literal 635 zcmeAS@N?(olHy`uVBq!ia0vp^4j|0I1|(Ny7TyC=jKx9jP7LeL$-HD>V3PK9aSW-5 zdppB=QnLY1+u1;kl@F~*Ik^yeHdU9jwl#+wtu8xK9)c=CkD$5XK#8<+U+PkDUi zWB<(hlgmYo^`vvS1>2uh+NBxrG_PKD>h8Y0)7jtO?|%LJ-qh4eiRfvS({KJsi|$}P zAZa0A$;DtG5W<@mu>)UPRSpUCfJJ=U!bcHI!Ubn0;>s!pt+}as^o-sp+A;V46poZ_@ z;ROi-9zhJ>UNJSzU3Svcck`43?u-oSj`wabD+Ih?PLy=`mdLk?!I=Nx;U6vx{{r0k z%{G)@cJojSV9jCeU+!E~kd%98O?Rs`W8Dn}h7iVcixmz%F#P?c;!G_^(%WUyTlf6Z zy3^e7e&Lgk<{tKCAEq;XI3~BWpiF_I`FOeIZu?&Xt62(a>kT(d^t>;8h_Uhg*?z&A z9M%gz=IMFLech8JP{((C#ZQ5%9M&}oI-4wZ7;+tO`L4gKac-6UF5}%-mV5WkHMQ^j z&)dLK>TBl9IBS#Q!){H7rd?{YmofO>obchOh=OD6WZ&S1WjP){lDH-;Sa))nrbDoq zN{u0_N5J)z%OVRjrG@s*U{YC;y(yFH!W3T4cppZgE2cM1STjzwwdgNn;CwYJXBLx5 zs`DZ7VEopcm6r~C<+$R%xg;>n@TEq0ruq6ZXaU(AKnwzxf+vG0Pgg&ebxsLQ0En~- A_y7O^ literal 0 HcmV?d00001 diff --git a/Sprites/Urinol.png.import b/Sprites/Urinol.png.import new file mode 100644 index 0000000..3061fb5 --- /dev/null +++ b/Sprites/Urinol.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://clw15m8cxj22p" +path="res://.godot/imported/Urinol.png-3d48a5dd6a4ef8c95cb84ee41f232b9e.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Sprites/Urinol.png" +dest_files=["res://.godot/imported/Urinol.png-3d48a5dd6a4ef8c95cb84ee41f232b9e.ctex"] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/bptc_ldr=0 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +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 diff --git a/Sprites/Urinol_MIMIC.png b/Sprites/Urinol_MIMIC.png new file mode 100644 index 0000000000000000000000000000000000000000..46587a7e1b4458657a6ec92e7148b5f69bc434a8 GIT binary patch literal 4454 zcmX9?2{@G97k}rq4XPPqEo7{NB80w#8C$YNn2=>e>8ps6r7SZ<5!ppiMk=&F-pWfz=|1HY1oycJa!jE?uOo97 zF!gZdHk2D!LB{Z%6{9eg8v`Tu?-TB`PUxaCt}njFK9ZH)(>|yIP;x|S2LM-YxMao? zZvS<}0}JM%7cm;b_AU(9q3;1>$g#I#|Dpwm+Gh9=PEY7mZ()(|5fAbJE0 z#Cy46%=|!P7PV|LuNsm8;k!|Wi2yzp3u-JCiTi$=n;90a4G9OP7^OF6UJ_eaE6(G3 z=bI}U*S>fjIQHQ=QG!2Z7kSCNykFsxsF<25XgVqJUsDYa>f93C58mD(}Vu}82qud{CWFN>fXaE(1j0$z5kf0!z}v|X5HQ0F4;4a ztwS&`PTqMj^Q{@NmLNe%RczxXnbTk|-?B0kU{=9q{B}E-q}o7;;@Ht4vtwBXu{j&( z`5UkQ94R!Rt%WXrm{|MgRF*WuB(nq?*$uu)fdbV@_CLsq%+#K2!FdQx`ThN!5 zqDFL!wdE=WQa`|)7XDr*M)wl>nCYr*PB0yNNZ~pdDooNg&xm;Dqu`MyWlaE z#7CkbW;+Cxj3d{5!{rp@7V4i+Wcam~FK#trWg#+ak1Eipoke=yw`NCzU+!ftZlgv_ zCQMaHbq$9S0lzG21~=t;(Oq`Sl0tX8>CT^egZ+GIcZt<(S3r_M#M9kuNxnDsO@;8+ zzEi*}h{0lh?A1RU8C7TrUeE12;HwR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