Basic stop what you're doing sheathe attack
This commit is contained in:
		
							parent
							
								
									252a6437d6
								
							
						
					
					
						commit
						c021c3c444
					
				| @ -25,10 +25,22 @@ enum State { | |||||||
| 	Jump, | 	Jump, | ||||||
| 	AirSpin, | 	AirSpin, | ||||||
| 	Land, | 	Land, | ||||||
|  | 	Attack, | ||||||
| 	Roll, | 	Roll, | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func _physics_process(delta): | func _physics_process(delta): | ||||||
|  | 	if Input.is_action_just_pressed("attack"): | ||||||
|  | 		if is_on_floor(): | ||||||
|  | 			state = State.Attack | ||||||
|  | 			velocity = Vector2.ZERO | ||||||
|  | 			sprite.play("Attack1") | ||||||
|  | 	 | ||||||
|  | 	if state == State.Attack: | ||||||
|  | 		await (sprite as AnimatedSprite2D).animation_finished | ||||||
|  | 		state = State.Idle | ||||||
|  | 
 | ||||||
|  | 	else: | ||||||
| 		if not is_on_floor(): | 		if not is_on_floor(): | ||||||
| 			if velocity.y > 50: | 			if velocity.y > 50: | ||||||
| 				velocity.y += gravity_fall * delta | 				velocity.y += gravity_fall * delta | ||||||
| @ -70,6 +82,7 @@ func _physics_process(delta): | |||||||
| 			if Input.is_key_pressed(KEY_SHIFT): | 			if Input.is_key_pressed(KEY_SHIFT): | ||||||
| 				speed /= 3 | 				speed /= 3 | ||||||
| 			var direction = Input.get_axis("left", "right") | 			var direction = Input.get_axis("left", "right") | ||||||
|  | 
 | ||||||
| 			if direction: | 			if direction: | ||||||
| 				velocity.x = direction * speed | 				velocity.x = direction * speed | ||||||
| 			else: | 			else: | ||||||
|  | |||||||
							
								
								
									
										
											BIN
										
									
								
								Godot/Import/Sprites/player katana attack-sheathe 80x64.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Godot/Import/Sprites/player katana attack-sheathe 80x64.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 4.6 KiB | 
| @ -0,0 +1,34 @@ | |||||||
|  | [remap] | ||||||
|  | 
 | ||||||
|  | importer="texture" | ||||||
|  | type="CompressedTexture2D" | ||||||
|  | uid="uid://cwovkjj1o7fm0" | ||||||
|  | path="res://.godot/imported/player katana attack-sheathe 80x64.png-4676fdc54f170af8c2189309f269706a.ctex" | ||||||
|  | metadata={ | ||||||
|  | "vram_texture": false | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | [deps] | ||||||
|  | 
 | ||||||
|  | source_file="res://Import/Sprites/player katana attack-sheathe 80x64.png" | ||||||
|  | dest_files=["res://.godot/imported/player katana attack-sheathe 80x64.png-4676fdc54f170af8c2189309f269706a.ctex"] | ||||||
|  | 
 | ||||||
|  | [params] | ||||||
|  | 
 | ||||||
|  | compress/mode=0 | ||||||
|  | compress/high_quality=false | ||||||
|  | compress/lossy_quality=0.7 | ||||||
|  | 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/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 | ||||||
							
								
								
									
										
											BIN
										
									
								
								Godot/Import/Sprites/player katana continuous attack 80x64.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Godot/Import/Sprites/player katana continuous attack 80x64.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 3.4 KiB | 
| @ -0,0 +1,34 @@ | |||||||
|  | [remap] | ||||||
|  | 
 | ||||||
|  | importer="texture" | ||||||
|  | type="CompressedTexture2D" | ||||||
|  | uid="uid://cqoe7j0c5o3w3" | ||||||
|  | path="res://.godot/imported/player katana continuous attack 80x64.png-500ac913698c7a3ade722a623a783a4d.ctex" | ||||||
|  | metadata={ | ||||||
|  | "vram_texture": false | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | [deps] | ||||||
|  | 
 | ||||||
|  | source_file="res://Import/Sprites/player katana continuous attack 80x64.png" | ||||||
|  | dest_files=["res://.godot/imported/player katana continuous attack 80x64.png-500ac913698c7a3ade722a623a783a4d.ctex"] | ||||||
|  | 
 | ||||||
|  | [params] | ||||||
|  | 
 | ||||||
|  | compress/mode=0 | ||||||
|  | compress/high_quality=false | ||||||
|  | compress/lossy_quality=0.7 | ||||||
|  | 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/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 | ||||||
| @ -1,13 +1,15 @@ | |||||||
| [gd_scene load_steps=56 format=3 uid="uid://bjc6dwxaakqdg"] | [gd_scene load_steps=83 format=3 uid="uid://bjc6dwxaakqdg"] | ||||||
| 
 | 
 | ||||||
| [ext_resource type="Script" path="res://Code/Character.gd" id="1_23c20"] | [ext_resource type="Script" path="res://Code/Character.gd" id="1_23c20"] | ||||||
| [ext_resource type="Texture2D" uid="uid://wfwjlevruveu" path="res://Import/Sprites/Character Idle 48x48.png" id="2_8h572"] | [ext_resource type="Texture2D" uid="uid://wfwjlevruveu" path="res://Import/Sprites/Character Idle 48x48.png" id="2_8h572"] | ||||||
| [ext_resource type="Texture2D" uid="uid://c87b08n23v0kx" path="res://Import/Sprites/player air spin 48x48.png" id="2_gpxo5"] | [ext_resource type="Texture2D" uid="uid://c87b08n23v0kx" path="res://Import/Sprites/player air spin 48x48.png" id="2_gpxo5"] | ||||||
| [ext_resource type="Texture2D" uid="uid://clx88ivnf6id6" path="res://Import/Sprites/Player Roll 48x48.png" id="3_4dpty"] | [ext_resource type="Texture2D" uid="uid://clx88ivnf6id6" path="res://Import/Sprites/Player Roll 48x48.png" id="3_4dpty"] | ||||||
|  | [ext_resource type="Texture2D" uid="uid://cwovkjj1o7fm0" path="res://Import/Sprites/player katana attack-sheathe 80x64.png" id="3_ldd0x"] | ||||||
| [ext_resource type="Texture2D" uid="uid://bge22c82umdui" path="res://Import/Sprites/PlayerWalk 48x48.png" id="3_xxdqr"] | [ext_resource type="Texture2D" uid="uid://bge22c82umdui" path="res://Import/Sprites/PlayerWalk 48x48.png" id="3_xxdqr"] | ||||||
| [ext_resource type="Texture2D" uid="uid://y8syonuki304" path="res://Import/Sprites/run cycle 48x48.png" id="4_rqcgh"] | [ext_resource type="Texture2D" uid="uid://y8syonuki304" path="res://Import/Sprites/run cycle 48x48.png" id="4_rqcgh"] | ||||||
| [ext_resource type="Texture2D" uid="uid://8ikuchoh7pyd" path="res://Import/Sprites/player jump 48x48.png" id="5_f2sni"] | [ext_resource type="Texture2D" uid="uid://8ikuchoh7pyd" path="res://Import/Sprites/player jump 48x48.png" id="5_f2sni"] | ||||||
| [ext_resource type="Texture2D" uid="uid://diiqvgeqnmn1c" path="res://Import/Sprites/player land 48x48.png" id="6_ba2s3"] | [ext_resource type="Texture2D" uid="uid://diiqvgeqnmn1c" path="res://Import/Sprites/player land 48x48.png" id="6_ba2s3"] | ||||||
|  | [ext_resource type="Texture2D" uid="uid://cqoe7j0c5o3w3" path="res://Import/Sprites/player katana continuous attack 80x64.png" id="10_sjvpb"] | ||||||
| 
 | 
 | ||||||
| [sub_resource type="AtlasTexture" id="AtlasTexture_c40es"] | [sub_resource type="AtlasTexture" id="AtlasTexture_c40es"] | ||||||
| atlas = ExtResource("2_gpxo5") | atlas = ExtResource("2_gpxo5") | ||||||
| @ -33,6 +35,106 @@ region = Rect2(192, 0, 48, 48) | |||||||
| atlas = ExtResource("2_gpxo5") | atlas = ExtResource("2_gpxo5") | ||||||
| region = Rect2(240, 0, 48, 48) | region = Rect2(240, 0, 48, 48) | ||||||
| 
 | 
 | ||||||
|  | [sub_resource type="AtlasTexture" id="AtlasTexture_4y312"] | ||||||
|  | atlas = ExtResource("3_ldd0x") | ||||||
|  | region = Rect2(0, 0, 80, 64) | ||||||
|  | 
 | ||||||
|  | [sub_resource type="AtlasTexture" id="AtlasTexture_lc7wi"] | ||||||
|  | atlas = ExtResource("3_ldd0x") | ||||||
|  | region = Rect2(80, 0, 80, 64) | ||||||
|  | 
 | ||||||
|  | [sub_resource type="AtlasTexture" id="AtlasTexture_lf13m"] | ||||||
|  | atlas = ExtResource("3_ldd0x") | ||||||
|  | region = Rect2(160, 0, 80, 64) | ||||||
|  | 
 | ||||||
|  | [sub_resource type="AtlasTexture" id="AtlasTexture_bkbg6"] | ||||||
|  | atlas = ExtResource("3_ldd0x") | ||||||
|  | region = Rect2(240, 0, 80, 64) | ||||||
|  | 
 | ||||||
|  | [sub_resource type="AtlasTexture" id="AtlasTexture_gh4du"] | ||||||
|  | atlas = ExtResource("3_ldd0x") | ||||||
|  | region = Rect2(320, 0, 80, 64) | ||||||
|  | 
 | ||||||
|  | [sub_resource type="AtlasTexture" id="AtlasTexture_yh84k"] | ||||||
|  | atlas = ExtResource("3_ldd0x") | ||||||
|  | region = Rect2(400, 0, 80, 64) | ||||||
|  | 
 | ||||||
|  | [sub_resource type="AtlasTexture" id="AtlasTexture_myi62"] | ||||||
|  | atlas = ExtResource("3_ldd0x") | ||||||
|  | region = Rect2(480, 0, 80, 64) | ||||||
|  | 
 | ||||||
|  | [sub_resource type="AtlasTexture" id="AtlasTexture_ba8as"] | ||||||
|  | atlas = ExtResource("3_ldd0x") | ||||||
|  | region = Rect2(560, 0, 80, 64) | ||||||
|  | 
 | ||||||
|  | [sub_resource type="AtlasTexture" id="AtlasTexture_nbmkv"] | ||||||
|  | atlas = ExtResource("3_ldd0x") | ||||||
|  | region = Rect2(640, 0, 80, 64) | ||||||
|  | 
 | ||||||
|  | [sub_resource type="AtlasTexture" id="AtlasTexture_dvg4c"] | ||||||
|  | atlas = ExtResource("3_ldd0x") | ||||||
|  | region = Rect2(720, 0, 80, 64) | ||||||
|  | 
 | ||||||
|  | [sub_resource type="AtlasTexture" id="AtlasTexture_0liim"] | ||||||
|  | atlas = ExtResource("3_ldd0x") | ||||||
|  | region = Rect2(800, 0, 80, 64) | ||||||
|  | 
 | ||||||
|  | [sub_resource type="AtlasTexture" id="AtlasTexture_em1mn"] | ||||||
|  | atlas = ExtResource("3_ldd0x") | ||||||
|  | region = Rect2(880, 0, 80, 64) | ||||||
|  | 
 | ||||||
|  | [sub_resource type="AtlasTexture" id="AtlasTexture_73cfr"] | ||||||
|  | atlas = ExtResource("3_ldd0x") | ||||||
|  | region = Rect2(960, 0, 80, 64) | ||||||
|  | 
 | ||||||
|  | [sub_resource type="AtlasTexture" id="AtlasTexture_qp1t3"] | ||||||
|  | atlas = ExtResource("3_ldd0x") | ||||||
|  | region = Rect2(1040, 0, 80, 64) | ||||||
|  | 
 | ||||||
|  | [sub_resource type="AtlasTexture" id="AtlasTexture_rcujh"] | ||||||
|  | atlas = ExtResource("3_ldd0x") | ||||||
|  | region = Rect2(1120, 0, 80, 64) | ||||||
|  | 
 | ||||||
|  | [sub_resource type="AtlasTexture" id="AtlasTexture_km0fj"] | ||||||
|  | atlas = ExtResource("3_ldd0x") | ||||||
|  | region = Rect2(1200, 0, 80, 64) | ||||||
|  | 
 | ||||||
|  | [sub_resource type="AtlasTexture" id="AtlasTexture_0audb"] | ||||||
|  | atlas = ExtResource("10_sjvpb") | ||||||
|  | region = Rect2(0, 0, 80, 64) | ||||||
|  | 
 | ||||||
|  | [sub_resource type="AtlasTexture" id="AtlasTexture_4322d"] | ||||||
|  | atlas = ExtResource("10_sjvpb") | ||||||
|  | region = Rect2(80, 0, 80, 64) | ||||||
|  | 
 | ||||||
|  | [sub_resource type="AtlasTexture" id="AtlasTexture_vnrrw"] | ||||||
|  | atlas = ExtResource("10_sjvpb") | ||||||
|  | region = Rect2(160, 0, 80, 64) | ||||||
|  | 
 | ||||||
|  | [sub_resource type="AtlasTexture" id="AtlasTexture_u7b31"] | ||||||
|  | atlas = ExtResource("10_sjvpb") | ||||||
|  | region = Rect2(240, 0, 80, 64) | ||||||
|  | 
 | ||||||
|  | [sub_resource type="AtlasTexture" id="AtlasTexture_mgpi0"] | ||||||
|  | atlas = ExtResource("10_sjvpb") | ||||||
|  | region = Rect2(320, 0, 80, 64) | ||||||
|  | 
 | ||||||
|  | [sub_resource type="AtlasTexture" id="AtlasTexture_56uqh"] | ||||||
|  | atlas = ExtResource("10_sjvpb") | ||||||
|  | region = Rect2(400, 0, 80, 64) | ||||||
|  | 
 | ||||||
|  | [sub_resource type="AtlasTexture" id="AtlasTexture_5mbn8"] | ||||||
|  | atlas = ExtResource("10_sjvpb") | ||||||
|  | region = Rect2(480, 0, 80, 64) | ||||||
|  | 
 | ||||||
|  | [sub_resource type="AtlasTexture" id="AtlasTexture_icpi6"] | ||||||
|  | atlas = ExtResource("10_sjvpb") | ||||||
|  | region = Rect2(560, 0, 80, 64) | ||||||
|  | 
 | ||||||
|  | [sub_resource type="AtlasTexture" id="AtlasTexture_fht4k"] | ||||||
|  | atlas = ExtResource("10_sjvpb") | ||||||
|  | region = Rect2(640, 0, 80, 64) | ||||||
|  | 
 | ||||||
| [sub_resource type="AtlasTexture" id="AtlasTexture_7tnm4"] | [sub_resource type="AtlasTexture" id="AtlasTexture_7tnm4"] | ||||||
| atlas = ExtResource("3_4dpty") | atlas = ExtResource("3_4dpty") | ||||||
| region = Rect2(0, 0, 48, 48) | region = Rect2(0, 0, 48, 48) | ||||||
| @ -216,6 +318,103 @@ animations = [{ | |||||||
| }, { | }, { | ||||||
| "frames": [{ | "frames": [{ | ||||||
| "duration": 1.0, | "duration": 1.0, | ||||||
|  | "texture": SubResource("AtlasTexture_4y312") | ||||||
|  | }, { | ||||||
|  | "duration": 1.0, | ||||||
|  | "texture": SubResource("AtlasTexture_lc7wi") | ||||||
|  | }, { | ||||||
|  | "duration": 1.0, | ||||||
|  | "texture": SubResource("AtlasTexture_lf13m") | ||||||
|  | }, { | ||||||
|  | "duration": 1.0, | ||||||
|  | "texture": SubResource("AtlasTexture_bkbg6") | ||||||
|  | }, { | ||||||
|  | "duration": 1.0, | ||||||
|  | "texture": SubResource("AtlasTexture_gh4du") | ||||||
|  | }, { | ||||||
|  | "duration": 1.0, | ||||||
|  | "texture": SubResource("AtlasTexture_gh4du") | ||||||
|  | }, { | ||||||
|  | "duration": 1.0, | ||||||
|  | "texture": SubResource("AtlasTexture_gh4du") | ||||||
|  | }, { | ||||||
|  | "duration": 1.0, | ||||||
|  | "texture": SubResource("AtlasTexture_gh4du") | ||||||
|  | }, { | ||||||
|  | "duration": 1.0, | ||||||
|  | "texture": SubResource("AtlasTexture_gh4du") | ||||||
|  | }, { | ||||||
|  | "duration": 1.0, | ||||||
|  | "texture": SubResource("AtlasTexture_yh84k") | ||||||
|  | }, { | ||||||
|  | "duration": 1.0, | ||||||
|  | "texture": SubResource("AtlasTexture_myi62") | ||||||
|  | }, { | ||||||
|  | "duration": 1.0, | ||||||
|  | "texture": SubResource("AtlasTexture_ba8as") | ||||||
|  | }, { | ||||||
|  | "duration": 1.0, | ||||||
|  | "texture": SubResource("AtlasTexture_nbmkv") | ||||||
|  | }, { | ||||||
|  | "duration": 1.0, | ||||||
|  | "texture": SubResource("AtlasTexture_dvg4c") | ||||||
|  | }, { | ||||||
|  | "duration": 1.0, | ||||||
|  | "texture": SubResource("AtlasTexture_0liim") | ||||||
|  | }, { | ||||||
|  | "duration": 1.0, | ||||||
|  | "texture": SubResource("AtlasTexture_em1mn") | ||||||
|  | }, { | ||||||
|  | "duration": 1.0, | ||||||
|  | "texture": SubResource("AtlasTexture_73cfr") | ||||||
|  | }, { | ||||||
|  | "duration": 1.0, | ||||||
|  | "texture": SubResource("AtlasTexture_qp1t3") | ||||||
|  | }, { | ||||||
|  | "duration": 1.0, | ||||||
|  | "texture": SubResource("AtlasTexture_rcujh") | ||||||
|  | }, { | ||||||
|  | "duration": 1.0, | ||||||
|  | "texture": SubResource("AtlasTexture_km0fj") | ||||||
|  | }], | ||||||
|  | "loop": false, | ||||||
|  | "name": &"Attack1", | ||||||
|  | "speed": 15.0 | ||||||
|  | }, { | ||||||
|  | "frames": [{ | ||||||
|  | "duration": 1.0, | ||||||
|  | "texture": SubResource("AtlasTexture_0audb") | ||||||
|  | }, { | ||||||
|  | "duration": 1.0, | ||||||
|  | "texture": SubResource("AtlasTexture_4322d") | ||||||
|  | }, { | ||||||
|  | "duration": 1.0, | ||||||
|  | "texture": SubResource("AtlasTexture_vnrrw") | ||||||
|  | }, { | ||||||
|  | "duration": 1.0, | ||||||
|  | "texture": SubResource("AtlasTexture_u7b31") | ||||||
|  | }, { | ||||||
|  | "duration": 1.0, | ||||||
|  | "texture": SubResource("AtlasTexture_mgpi0") | ||||||
|  | }, { | ||||||
|  | "duration": 1.0, | ||||||
|  | "texture": SubResource("AtlasTexture_56uqh") | ||||||
|  | }, { | ||||||
|  | "duration": 1.0, | ||||||
|  | "texture": SubResource("AtlasTexture_5mbn8") | ||||||
|  | }, { | ||||||
|  | "duration": 1.0, | ||||||
|  | "texture": SubResource("AtlasTexture_icpi6") | ||||||
|  | }, { | ||||||
|  | "duration": 1.0, | ||||||
|  | "texture": SubResource("AtlasTexture_fht4k") | ||||||
|  | }], | ||||||
|  | "loop": true, | ||||||
|  | "name": &"Attack2", | ||||||
|  | "speed": 12.0 | ||||||
|  | }, { | ||||||
|  | "frames": [{ | ||||||
|  | "duration": 1.0, | ||||||
| "texture": SubResource("AtlasTexture_7tnm4") | "texture": SubResource("AtlasTexture_7tnm4") | ||||||
| }, { | }, { | ||||||
| "duration": 1.0, | "duration": 1.0, | ||||||
| @ -372,7 +571,8 @@ script = ExtResource("1_23c20") | |||||||
| texture_filter = 1 | texture_filter = 1 | ||||||
| position = Vector2(0, -16) | position = Vector2(0, -16) | ||||||
| sprite_frames = SubResource("SpriteFrames_gvqqb") | sprite_frames = SubResource("SpriteFrames_gvqqb") | ||||||
| animation = &"AirSpin" | animation = &"Idle" | ||||||
|  | autoplay = "Idle" | ||||||
| metadata/_edit_lock_ = true | metadata/_edit_lock_ = true | ||||||
| 
 | 
 | ||||||
| [node name="CollisionShape2D" type="CollisionShape2D" parent="."] | [node name="CollisionShape2D" type="CollisionShape2D" parent="."] | ||||||
|  | |||||||
| @ -51,6 +51,11 @@ down={ | |||||||
| } | } | ||||||
| roll={ | roll={ | ||||||
| "deadzone": 0.5, | "deadzone": 0.5, | ||||||
| "events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":82,"key_label":0,"unicode":114,"echo":false,"script":null) | "events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":76,"key_label":0,"unicode":108,"echo":false,"script":null) | ||||||
|  | ] | ||||||
|  | } | ||||||
|  | attack={ | ||||||
|  | "deadzone": 0.5, | ||||||
|  | "events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":74,"key_label":0,"unicode":106,"echo":false,"script":null) | ||||||
| ] | ] | ||||||
| } | } | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user