Added a Default Player Scene
This commit is contained in:
		
							parent
							
								
									e36ef90462
								
							
						
					
					
						commit
						7644862ffa
					
				
					 4 changed files with 94 additions and 0 deletions
				
			
		
							
								
								
									
										
											BIN
										
									
								
								godot/Default Orange.png
									 (Stored with Git LFS)
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								godot/Default Orange.png
									 (Stored with Git LFS)
										
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										35
									
								
								godot/Default Orange.png.import
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										35
									
								
								godot/Default Orange.png.import
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,35 @@ | |||
| [remap] | ||||
| 
 | ||||
| importer="texture" | ||||
| type="CompressedTexture2D" | ||||
| uid="uid://d3lvqr08li31r" | ||||
| path.s3tc="res://.godot/imported/Default Orange.png-063fb7fe49baee9d7764c022a207ac3a.s3tc.ctex" | ||||
| metadata={ | ||||
| "imported_formats": ["s3tc_bptc"], | ||||
| "vram_texture": true | ||||
| } | ||||
| 
 | ||||
| [deps] | ||||
| 
 | ||||
| source_file="res://Default Orange.png" | ||||
| dest_files=["res://.godot/imported/Default Orange.png-063fb7fe49baee9d7764c022a207ac3a.s3tc.ctex"] | ||||
| 
 | ||||
| [params] | ||||
| 
 | ||||
| compress/mode=2 | ||||
| compress/high_quality=false | ||||
| compress/lossy_quality=0.7 | ||||
| compress/hdr_compression=1 | ||||
| compress/normal_map=0 | ||||
| compress/channel_pack=0 | ||||
| mipmaps/generate=true | ||||
| 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=0 | ||||
							
								
								
									
										31
									
								
								godot/Player.gd
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										31
									
								
								godot/Player.gd
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,31 @@ | |||
| extends CharacterBody3D | ||||
| 
 | ||||
| 
 | ||||
| const SPEED = 5.0 | ||||
| const JUMP_VELOCITY = 4.5 | ||||
| 
 | ||||
| # Get the gravity from the project settings to be synced with RigidBody nodes. | ||||
| var gravity = ProjectSettings.get_setting("physics/3d/default_gravity") | ||||
| 
 | ||||
| 
 | ||||
| func _physics_process(delta): | ||||
| 	# Add the gravity. | ||||
| 	if not is_on_floor(): | ||||
| 		velocity.y -= gravity * delta | ||||
| 
 | ||||
| 	# Handle Jump. | ||||
| 	if Input.is_action_just_pressed("ui_accept") and is_on_floor(): | ||||
| 		velocity.y = JUMP_VELOCITY | ||||
| 
 | ||||
| 	# Get the input direction and handle the movement/deceleration. | ||||
| 	# As good practice, you should replace UI actions with custom gameplay actions. | ||||
| 	var input_dir = Input.get_vector("ui_left", "ui_right", "ui_up", "ui_down") | ||||
| 	var direction = (transform.basis * Vector3(input_dir.x, 0, input_dir.y)).normalized() | ||||
| 	if direction: | ||||
| 		velocity.x = direction.x * SPEED | ||||
| 		velocity.z = direction.z * SPEED | ||||
| 	else: | ||||
| 		velocity.x = move_toward(velocity.x, 0, SPEED) | ||||
| 		velocity.z = move_toward(velocity.z, 0, SPEED) | ||||
| 
 | ||||
| 	move_and_slide() | ||||
							
								
								
									
										25
									
								
								godot/player.tscn
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								godot/player.tscn
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,25 @@ | |||
| [gd_scene load_steps=6 format=3 uid="uid://dbqnafgsttwth"] | ||||
| 
 | ||||
| [ext_resource type="Script" path="res://Player.gd" id="1_7gpdp"] | ||||
| [ext_resource type="Texture2D" uid="uid://d3lvqr08li31r" path="res://Default Orange.png" id="2_s5i4o"] | ||||
| 
 | ||||
| [sub_resource type="CapsuleShape3D" id="CapsuleShape3D_kb4ms"] | ||||
| 
 | ||||
| [sub_resource type="CapsuleMesh" id="CapsuleMesh_1e11l"] | ||||
| 
 | ||||
| [sub_resource type="StandardMaterial3D" id="StandardMaterial3D_npbs0"] | ||||
| albedo_texture = ExtResource("2_s5i4o") | ||||
| 
 | ||||
| [node name="Player" type="CharacterBody3D"] | ||||
| script = ExtResource("1_7gpdp") | ||||
| 
 | ||||
| [node name="CollisionShape3D" type="CollisionShape3D" parent="."] | ||||
| shape = SubResource("CapsuleShape3D_kb4ms") | ||||
| 
 | ||||
| [node name="MeshInstance3D" type="MeshInstance3D" parent="."] | ||||
| mesh = SubResource("CapsuleMesh_1e11l") | ||||
| surface_material_override/0 = SubResource("StandardMaterial3D_npbs0") | ||||
| 
 | ||||
| [node name="PlayerCam" type="Camera3D" parent="."] | ||||
| transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 5) | ||||
| fov = 105.5 | ||||
		Loading…
	
	Add table
		
		Reference in a new issue