From fce540a122451d26347246f7b5b8a0b61d34696b Mon Sep 17 00:00:00 2001 From: ajuvercr Date: Wed, 29 Jan 2020 21:51:40 +0100 Subject: [PATCH] make game more like a real game --- ...s.png-7e797c86c60ebf1baad54990ba20f2d3.md5 | 2 +- ....png-7e797c86c60ebf1baad54990ba20f2d3.stex | Bin 29487 -> 29487 bytes Camera2D.gd | 14 ++-- Main.tscn | 35 +++++---- Player.gd | 6 +- Player.tscn | 67 ++++++------------ Tower.gd | 5 -- project.godot | 2 + res/sprites.png.import | 2 +- 9 files changed, 55 insertions(+), 78 deletions(-) diff --git a/.import/sprites.png-7e797c86c60ebf1baad54990ba20f2d3.md5 b/.import/sprites.png-7e797c86c60ebf1baad54990ba20f2d3.md5 index b9c34eb..90dfa02 100644 --- a/.import/sprites.png-7e797c86c60ebf1baad54990ba20f2d3.md5 +++ b/.import/sprites.png-7e797c86c60ebf1baad54990ba20f2d3.md5 @@ -1,3 +1,3 @@ source_md5="5438542557626c9814ef2162a19e2908" -dest_md5="0ef11008070ef53cd0839c6e85118d97" +dest_md5="9d76f2a502b40f58f15d6243d8d732d4" diff --git a/.import/sprites.png-7e797c86c60ebf1baad54990ba20f2d3.stex b/.import/sprites.png-7e797c86c60ebf1baad54990ba20f2d3.stex index 2510feff16fe753f3e0ffd9a28c2eac4eb7787b2..e5cb983f39d92181ae7da9330ce3a87085b7d5e0 100644 GIT binary patch delta 24 ccmZ4gjB))lMqYQ9;1C8T1_m(R$g5Ng09?ie!vFvP delta 24 dcmZ4gjB))lMqYQ9;1C8T1_lsj*~qI@3; screen_size.y / 2 - 100: + if position.y > screen_size.y: emit_signal("hit") print(position) playing = false diff --git a/Player.tscn b/Player.tscn index 579a573..2e76614 100644 --- a/Player.tscn +++ b/Player.tscn @@ -1,51 +1,31 @@ -[gd_scene load_steps=5 format=2] +[gd_scene load_steps=6 format=2] [ext_resource path="res://Player.gd" type="Script" id=1] [ext_resource path="res://res/sprites.png" type="Texture" id=2] -[sub_resource type="CapsuleShape2D" id=2] +[sub_resource type="CapsuleShape2D" id=1] radius = 12.8837 height = 4.07484 +[sub_resource type="AtlasTexture" id=2] +atlas = ExtResource( 2 ) +region = Rect2( -4, 488, 84, 16 ) + [sub_resource type="Animation" id=3] -resource_name = "fly" -length = 0.4 +length = 0.8 loop = true +step = 0.2 tracks/0/type = "value" -tracks/0/path = NodePath("Sprite1:frame") +tracks/0/path = NodePath("Node2D/Sprite1:frame") tracks/0/interp = 1 tracks/0/loop_wrap = true tracks/0/imported = false tracks/0/enabled = true tracks/0/keys = { -"times": PoolRealArray( 0 ), -"transitions": PoolRealArray( 1 ), +"times": PoolRealArray( 0, 0.2, 0.4, 0.6 ), +"transitions": PoolRealArray( 1, 1, 1, 1 ), "update": 1, -"values": [ 0 ] -} -tracks/1/type = "value" -tracks/1/path = NodePath("Sprite2:frame") -tracks/1/interp = 1 -tracks/1/loop_wrap = true -tracks/1/imported = false -tracks/1/enabled = true -tracks/1/keys = { -"times": PoolRealArray( 0.1, 0.3 ), -"transitions": PoolRealArray( 1, 1 ), -"update": 1, -"values": [ 0, 0 ] -} -tracks/2/type = "value" -tracks/2/path = NodePath("Sprite3:frame") -tracks/2/interp = 1 -tracks/2/loop_wrap = true -tracks/2/imported = false -tracks/2/enabled = true -tracks/2/keys = { -"times": PoolRealArray( 0.2 ), -"transitions": PoolRealArray( 1 ), -"update": 1, -"values": [ 0 ] +"values": [ 1, 2, 1, 0 ] } [node name="Player" type="Area2D"] @@ -57,28 +37,23 @@ __meta__ = { [node name="CollisionShape2D" type="CollisionShape2D" parent="."] rotation = 1.5708 -shape = SubResource( 2 ) +shape = SubResource( 1 ) [node name="Node2D" type="Node2D" parent="."] scale = Vector2( 2, 2 ) [node name="Sprite1" type="Sprite" parent="Node2D"] -texture = ExtResource( 2 ) -region_enabled = true -region_rect = Rect2( 3, 491, 17, 12 ) - -[node name="Sprite2" type="Sprite" parent="Node2D"] -texture = ExtResource( 2 ) -region_enabled = true -region_rect = Rect2( 31, 491, 17, 12 ) - -[node name="Sprite3" type="Sprite" parent="Node2D"] -texture = ExtResource( 2 ) -region_enabled = true -region_rect = Rect2( 59, 491, 17, 12 ) +texture = SubResource( 2 ) +hframes = 3 +frame = 1 [node name="AnimationPlayer" type="AnimationPlayer" parent="Node2D"] root_node = NodePath("../..") autoplay = "fly" anims/fly = SubResource( 3 ) + +[node name="Camera2D" type="Camera2D" parent="."] +current = true +limit_top = 0 +limit_bottom = 0 [connection signal="body_entered" from="." to="." method="_on_Player_body_entered"] diff --git a/Tower.gd b/Tower.gd index 3a22842..8e57392 100644 --- a/Tower.gd +++ b/Tower.gd @@ -9,15 +9,10 @@ signal exit func _ready(): pass # Replace with function body. -# Called every frame. 'delta' is the elapsed time since the previous frame. -#func _process(delta): -# pass - func _on_Tower_body_entered(body): print("HIT HERE") pass # Replace with function body. func _on_Visibility_screen_exited(): - print("Leaving") queue_free() emit_signal("exit") diff --git a/project.godot b/project.godot index 93d171f..85d25c1 100644 --- a/project.godot +++ b/project.godot @@ -23,6 +23,8 @@ config/icon="res://icon.png" window/size/width=420 window/size/height=640 +window/handheld/orientation="portrait" +window/stretch/mode="viewport" [physics] diff --git a/res/sprites.png.import b/res/sprites.png.import index 276158f..46482a5 100644 --- a/res/sprites.png.import +++ b/res/sprites.png.import @@ -20,7 +20,7 @@ compress/hdr_mode=0 compress/bptc_ldr=0 compress/normal_map=0 flags/repeat=0 -flags/filter=true +flags/filter=false flags/mipmaps=false flags/anisotropic=false flags/srgb=2