diff --git a/Scripts/player.gd b/Scripts/player.gd new file mode 100644 index 0000000..558eada --- /dev/null +++ b/Scripts/player.gd @@ -0,0 +1,29 @@ +extends KinematicBody2D + +## zoom zoom +export (int) var speed = 200 + + +# Declare member variables here. Examples: +# var a = 2 +# var b = "text" + + +# Called when the node enters the scene tree for the first time. +func _ready(): + pass # Replace with function body. + + +# Called every frame. 'delta' is the elapsed time since the previous frame. +func _process(delta): + var direction = Vector2.ZERO + if Input.is_action_pressed("right"): + direction.x += 1 + if Input.is_action_pressed("left"): + direction.x -= 1 + if Input.is_action_pressed("up"): + direction.y += 1 + if Input.is_action_pressed("down"): + direction.y -= 1 + print(direction) + diff --git a/Texture/2d_animation_frog_spritesheet.png b/Texture/2d_animation_frog_spritesheet.png new file mode 100644 index 0000000..ebb5f1f Binary files /dev/null and b/Texture/2d_animation_frog_spritesheet.png differ diff --git a/Texture/2d_animation_frog_spritesheet.png.import b/Texture/2d_animation_frog_spritesheet.png.import new file mode 100644 index 0000000..dbc1567 --- /dev/null +++ b/Texture/2d_animation_frog_spritesheet.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/2d_animation_frog_spritesheet.png-cfc8a1f38e8c8a10ac4e39cdfa0fee14.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Texture/2d_animation_frog_spritesheet.png" +dest_files=[ "res://.import/2d_animation_frog_spritesheet.png-cfc8a1f38e8c8a10ac4e39cdfa0fee14.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=true +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 diff --git a/Texture/character.png b/Texture/character.png index 87ab6df..71fcd5d 100644 Binary files a/Texture/character.png and b/Texture/character.png differ diff --git a/Texture/character.png.import b/Texture/character.png.import index d659454..fee4626 100644 --- a/Texture/character.png.import +++ b/Texture/character.png.import @@ -20,7 +20,7 @@ compress/hdr_mode=0 compress/bptc_ldr=0 compress/normal_map=0 flags/repeat=0 -flags/filter=false +flags/filter=true flags/mipmaps=false flags/anisotropic=false flags/srgb=2 diff --git a/main.tscn b/main.tscn index 7a4c6cd..52eebc7 100644 --- a/main.tscn +++ b/main.tscn @@ -1,6 +1,8 @@ -[gd_scene load_steps=2 format=2] +[gd_scene load_steps=4 format=2] [ext_resource path="res://Texture/grass.png" type="Texture" id=1] +[ext_resource path="res://sprites/player.tscn" type="PackedScene" id=2] +[ext_resource path="res://Scripts/player.gd" type="Script" id=3] [node name="Main" type="Node2D"] @@ -11,3 +13,6 @@ centered = false __meta__ = { "_edit_lock_": true } + +[node name="AnimatedSprite" parent="." instance=ExtResource( 2 )] +script = ExtResource( 3 ) diff --git a/project.godot b/project.godot index d2b3aef..8f62d1d 100644 --- a/project.godot +++ b/project.godot @@ -28,9 +28,33 @@ config/icon="res://icon.png" singletons=[ "res://addons/godot-git-plugin/git_api.gdnlib" ] +[input] + +left={ +"deadzone": 0.5, +"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777231,"physical_scancode":0,"unicode":0,"echo":false,"script":null) + ] +} +right={ +"deadzone": 0.5, +"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777233,"physical_scancode":0,"unicode":0,"echo":false,"script":null) + ] +} +up={ +"deadzone": 0.5, +"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777232,"physical_scancode":0,"unicode":0,"echo":false,"script":null) + ] +} +down={ +"deadzone": 0.5, +"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777234,"physical_scancode":0,"unicode":0,"echo":false,"script":null) + ] +} + [physics] common/enable_pause_aware_picking=true +2d/default_gravity_vector=Vector2( 0, 0 ) [rendering] diff --git a/sprites/player.tscn b/sprites/player.tscn new file mode 100644 index 0000000..ec4a63c --- /dev/null +++ b/sprites/player.tscn @@ -0,0 +1,233 @@ +[gd_scene load_steps=47 format=2] + +[ext_resource path="res://Texture/character.png" type="Texture" id=1] +[ext_resource path="res://Scripts/player.gd" type="Script" id=2] + +[sub_resource type="RectangleShape2D" id=44] + +[sub_resource type="AtlasTexture" id=2] +flags = 4 +atlas = ExtResource( 1 ) +region = Rect2( 0, 0, 32, 48 ) + +[sub_resource type="AtlasTexture" id=3] +flags = 4 +atlas = ExtResource( 1 ) +region = Rect2( 32, 0, 32, 48 ) + +[sub_resource type="AtlasTexture" id=4] +flags = 4 +atlas = ExtResource( 1 ) +region = Rect2( 64, 0, 32, 48 ) + +[sub_resource type="AtlasTexture" id=5] +flags = 4 +atlas = ExtResource( 1 ) +region = Rect2( 96, 0, 32, 48 ) + +[sub_resource type="AtlasTexture" id=6] +flags = 4 +atlas = ExtResource( 1 ) +region = Rect2( 128, 0, 32, 48 ) + +[sub_resource type="AtlasTexture" id=7] +flags = 4 +atlas = ExtResource( 1 ) +region = Rect2( 160, 0, 32, 48 ) + +[sub_resource type="AtlasTexture" id=8] +flags = 4 +atlas = ExtResource( 1 ) +region = Rect2( 192, 0, 32, 48 ) + +[sub_resource type="AtlasTexture" id=9] +flags = 4 +atlas = ExtResource( 1 ) +region = Rect2( 224, 0, 32, 48 ) + +[sub_resource type="AtlasTexture" id=10] +flags = 4 +atlas = ExtResource( 1 ) +region = Rect2( 0, 48, 32, 48 ) + +[sub_resource type="AtlasTexture" id=11] +flags = 4 +atlas = ExtResource( 1 ) +region = Rect2( 32, 48, 32, 48 ) + +[sub_resource type="AtlasTexture" id=12] +flags = 4 +atlas = ExtResource( 1 ) +region = Rect2( 64, 48, 32, 48 ) + +[sub_resource type="AtlasTexture" id=13] +flags = 4 +atlas = ExtResource( 1 ) +region = Rect2( 96, 48, 32, 48 ) + +[sub_resource type="AtlasTexture" id=14] +flags = 4 +atlas = ExtResource( 1 ) +region = Rect2( 128, 48, 32, 48 ) + +[sub_resource type="AtlasTexture" id=15] +flags = 4 +atlas = ExtResource( 1 ) +region = Rect2( 160, 48, 32, 48 ) + +[sub_resource type="AtlasTexture" id=16] +flags = 4 +atlas = ExtResource( 1 ) +region = Rect2( 192, 48, 32, 48 ) + +[sub_resource type="AtlasTexture" id=17] +flags = 4 +atlas = ExtResource( 1 ) +region = Rect2( 224, 48, 32, 48 ) + +[sub_resource type="AtlasTexture" id=18] +flags = 4 +atlas = ExtResource( 1 ) +region = Rect2( 0, 96, 32, 48 ) + +[sub_resource type="AtlasTexture" id=19] +flags = 4 +atlas = ExtResource( 1 ) +region = Rect2( 32, 96, 32, 48 ) + +[sub_resource type="AtlasTexture" id=20] +flags = 4 +atlas = ExtResource( 1 ) +region = Rect2( 64, 96, 32, 48 ) + +[sub_resource type="AtlasTexture" id=21] +flags = 4 +atlas = ExtResource( 1 ) +region = Rect2( 96, 96, 32, 48 ) + +[sub_resource type="AtlasTexture" id=22] +flags = 4 +atlas = ExtResource( 1 ) +region = Rect2( 128, 96, 32, 48 ) + +[sub_resource type="AtlasTexture" id=23] +flags = 4 +atlas = ExtResource( 1 ) +region = Rect2( 160, 96, 32, 48 ) + +[sub_resource type="AtlasTexture" id=24] +flags = 4 +atlas = ExtResource( 1 ) +region = Rect2( 192, 96, 32, 48 ) + +[sub_resource type="AtlasTexture" id=25] +flags = 4 +atlas = ExtResource( 1 ) +region = Rect2( 224, 96, 32, 48 ) + +[sub_resource type="AtlasTexture" id=26] +flags = 4 +atlas = ExtResource( 1 ) +region = Rect2( 0, 144, 32, 48 ) + +[sub_resource type="AtlasTexture" id=27] +flags = 4 +atlas = ExtResource( 1 ) +region = Rect2( 32, 144, 32, 48 ) + +[sub_resource type="AtlasTexture" id=28] +flags = 4 +atlas = ExtResource( 1 ) +region = Rect2( 64, 144, 32, 48 ) + +[sub_resource type="AtlasTexture" id=29] +flags = 4 +atlas = ExtResource( 1 ) +region = Rect2( 96, 144, 32, 48 ) + +[sub_resource type="AtlasTexture" id=30] +flags = 4 +atlas = ExtResource( 1 ) +region = Rect2( 128, 144, 32, 48 ) + +[sub_resource type="AtlasTexture" id=31] +flags = 4 +atlas = ExtResource( 1 ) +region = Rect2( 160, 144, 32, 48 ) + +[sub_resource type="AtlasTexture" id=32] +flags = 4 +atlas = ExtResource( 1 ) +region = Rect2( 192, 144, 32, 48 ) + +[sub_resource type="AtlasTexture" id=33] +flags = 4 +atlas = ExtResource( 1 ) +region = Rect2( 224, 144, 32, 48 ) + +[sub_resource type="AtlasTexture" id=34] +flags = 4 +atlas = ExtResource( 1 ) +region = Rect2( 0, 192, 32, 48 ) + +[sub_resource type="AtlasTexture" id=35] +flags = 4 +atlas = ExtResource( 1 ) +region = Rect2( 32, 192, 32, 48 ) + +[sub_resource type="AtlasTexture" id=36] +flags = 4 +atlas = ExtResource( 1 ) +region = Rect2( 64, 192, 32, 48 ) + +[sub_resource type="AtlasTexture" id=37] +flags = 4 +atlas = ExtResource( 1 ) +region = Rect2( 96, 192, 32, 48 ) + +[sub_resource type="AtlasTexture" id=38] +flags = 4 +atlas = ExtResource( 1 ) +region = Rect2( 128, 192, 32, 48 ) + +[sub_resource type="AtlasTexture" id=39] +flags = 4 +atlas = ExtResource( 1 ) +region = Rect2( 160, 192, 32, 48 ) + +[sub_resource type="AtlasTexture" id=40] +flags = 4 +atlas = ExtResource( 1 ) +region = Rect2( 192, 192, 32, 48 ) + +[sub_resource type="AtlasTexture" id=41] +flags = 4 +atlas = ExtResource( 1 ) +region = Rect2( 224, 192, 32, 48 ) + +[sub_resource type="AtlasTexture" id=42] +flags = 4 +atlas = ExtResource( 1 ) +region = Rect2( 0, 240, 32, 48 ) + +[sub_resource type="AtlasTexture" id=43] +flags = 4 +atlas = ExtResource( 1 ) +region = Rect2( 32, 240, 32, 48 ) + +[sub_resource type="SpriteFrames" id=1] +animations = [ { +"frames": [ SubResource( 2 ), SubResource( 3 ), SubResource( 4 ), SubResource( 5 ), SubResource( 6 ), SubResource( 7 ), SubResource( 8 ), SubResource( 9 ), SubResource( 10 ), SubResource( 11 ), SubResource( 12 ), SubResource( 13 ), SubResource( 14 ), SubResource( 15 ), SubResource( 16 ), SubResource( 17 ), SubResource( 18 ), SubResource( 19 ), SubResource( 20 ), SubResource( 21 ), SubResource( 22 ), SubResource( 23 ), SubResource( 24 ), SubResource( 25 ), SubResource( 26 ), SubResource( 27 ), SubResource( 28 ), SubResource( 29 ), 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 ) ], +"loop": true, +"name": "default", +"speed": 5.0 +} ] + +[node name="KinematicBody2D" type="KinematicBody2D"] +script = ExtResource( 2 ) + +[node name="CollisionShape2D" type="CollisionShape2D" parent="."] +shape = SubResource( 44 ) + +[node name="AnimatedSprite" type="AnimatedSprite" parent="."] +frames = SubResource( 1 )