mirror of
				https://github.com/mightypanders/GMTKJam2021.git
				synced 2025-11-04 02:59:50 +01:00 
			
		
		
		
	important features: Sam sprite
also; some physics
This commit is contained in:
		
							
								
								
									
										23
									
								
								Guest.gd
									
									
									
									
									
								
							
							
						
						
									
										23
									
								
								Guest.gd
									
									
									
									
									
								
							@@ -12,8 +12,8 @@ signal dropped_off_idle
 | 
				
			|||||||
signal dropped_off_fail
 | 
					signal dropped_off_fail
 | 
				
			||||||
 | 
					
 | 
				
			||||||
var rng = RandomNumberGenerator.new()
 | 
					var rng = RandomNumberGenerator.new()
 | 
				
			||||||
onready var sprite = $Sprite
 | 
					 | 
				
			||||||
onready var exclusionZoneShape = $ExclusionZone/CollisionShape2D
 | 
					onready var exclusionZoneShape = $ExclusionZone/CollisionShape2D
 | 
				
			||||||
 | 
					var sprite
 | 
				
			||||||
 | 
					
 | 
				
			||||||
enum states {
 | 
					enum states {
 | 
				
			||||||
	waiting,
 | 
						waiting,
 | 
				
			||||||
@@ -38,8 +38,20 @@ var names = [
 | 
				
			|||||||
]
 | 
					]
 | 
				
			||||||
var currentState = states.waiting
 | 
					var currentState = states.waiting
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					var follow_node = null
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func _physics_process(delta):
 | 
					func _physics_process(delta):
 | 
				
			||||||
	linear_velocity = linear_velocity.clamped(100)
 | 
						
 | 
				
			||||||
 | 
						if false:
 | 
				
			||||||
 | 
							if follow_node != null:
 | 
				
			||||||
 | 
								currentState = states.tethered
 | 
				
			||||||
 | 
								mode = RigidBody2D.MODE_STATIC
 | 
				
			||||||
 | 
								var rot_dir = get_angle_to(follow_node.global_position)
 | 
				
			||||||
 | 
								rotation += (rot_dir)
 | 
				
			||||||
 | 
								var distance = follow_node.global_position.distance_to(global_position)
 | 
				
			||||||
 | 
								global_position = (follow_node.global_position + Vector2(10,0) ) 
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						#linear_velocity = linear_velocity.clamped(100)
 | 
				
			||||||
	if currentState == states.waiting:
 | 
						if currentState == states.waiting:
 | 
				
			||||||
		linear_velocity.move_toward(Vector2.ZERO,5.0)
 | 
							linear_velocity.move_toward(Vector2.ZERO,5.0)
 | 
				
			||||||
	elif currentState == states.tethered:
 | 
						elif currentState == states.tethered:
 | 
				
			||||||
@@ -48,6 +60,13 @@ func _physics_process(delta):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
func _ready():
 | 
					func _ready():
 | 
				
			||||||
	rng.randomize()
 | 
						rng.randomize()
 | 
				
			||||||
 | 
						var spriteNum = rng.randi_range(0,100)
 | 
				
			||||||
 | 
						if spriteNum % 2 == 0:
 | 
				
			||||||
 | 
							$SpriteMarkus.visible = true
 | 
				
			||||||
 | 
							sprite = $SpriteMarkus
 | 
				
			||||||
 | 
						if spriteNum % 2 != 0:
 | 
				
			||||||
 | 
							$SpriteSam.visible = true
 | 
				
			||||||
 | 
							sprite = $SpriteSam	
 | 
				
			||||||
	var n = rng.randi_range(0,4)
 | 
						var n = rng.randi_range(0,4)
 | 
				
			||||||
	destinationColor = colorList[n]
 | 
						destinationColor = colorList[n]
 | 
				
			||||||
	sprite.modulate = destinationColor
 | 
						sprite.modulate = destinationColor
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										20
									
								
								Guest.tscn
									
									
									
									
									
								
							
							
						
						
									
										20
									
								
								Guest.tscn
									
									
									
									
									
								
							@@ -1,17 +1,18 @@
 | 
				
			|||||||
[gd_scene load_steps=7 format=2]
 | 
					[gd_scene load_steps=8 format=2]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[ext_resource path="res://assets/Figur1.png" type="Texture" id=1]
 | 
					[ext_resource path="res://assets/Figur1.png" type="Texture" id=1]
 | 
				
			||||||
[ext_resource path="res://Guest.gd" type="Script" id=2]
 | 
					[ext_resource path="res://Guest.gd" type="Script" id=2]
 | 
				
			||||||
 | 
					[ext_resource path="res://assets/Sam.png" type="Texture" id=3]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[sub_resource type="PhysicsMaterial" id=4]
 | 
					[sub_resource type="PhysicsMaterial" id=7]
 | 
				
			||||||
absorbent = true
 | 
					absorbent = true
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[sub_resource type="CircleShape2D" id=5]
 | 
					[sub_resource type="CircleShape2D" id=5]
 | 
				
			||||||
radius = 124.702
 | 
					radius = 124.702
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[sub_resource type="CapsuleShape2D" id=3]
 | 
					[sub_resource type="CapsuleShape2D" id=3]
 | 
				
			||||||
radius = 8.77205
 | 
					radius = 6.0
 | 
				
			||||||
height = 12.6548
 | 
					height = 9.75
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[sub_resource type="CapsuleShape2D" id=6]
 | 
					[sub_resource type="CapsuleShape2D" id=6]
 | 
				
			||||||
radius = 4.71085
 | 
					radius = 4.71085
 | 
				
			||||||
@@ -23,7 +24,7 @@ height = 5.19882
 | 
				
			|||||||
collision_layer = 3
 | 
					collision_layer = 3
 | 
				
			||||||
collision_mask = 3
 | 
					collision_mask = 3
 | 
				
			||||||
mass = 10.0
 | 
					mass = 10.0
 | 
				
			||||||
physics_material_override = SubResource( 4 )
 | 
					physics_material_override = SubResource( 7 )
 | 
				
			||||||
gravity_scale = 0.0
 | 
					gravity_scale = 0.0
 | 
				
			||||||
angular_damp = 100.0
 | 
					angular_damp = 100.0
 | 
				
			||||||
script = ExtResource( 2 )
 | 
					script = ExtResource( 2 )
 | 
				
			||||||
@@ -39,14 +40,19 @@ show_behind_parent = true
 | 
				
			|||||||
shape = SubResource( 5 )
 | 
					shape = SubResource( 5 )
 | 
				
			||||||
disabled = true
 | 
					disabled = true
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[node name="Sprite" type="Sprite" parent="."]
 | 
					[node name="SpriteMarkus" type="Sprite" parent="."]
 | 
				
			||||||
 | 
					visible = false
 | 
				
			||||||
scale = Vector2( 0.1, 0.1 )
 | 
					scale = Vector2( 0.1, 0.1 )
 | 
				
			||||||
texture = ExtResource( 1 )
 | 
					texture = ExtResource( 1 )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[node name="SpriteSam" type="Sprite" parent="."]
 | 
				
			||||||
 | 
					visible = false
 | 
				
			||||||
 | 
					scale = Vector2( 0.25, 0.25 )
 | 
				
			||||||
 | 
					texture = ExtResource( 3 )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
 | 
					[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
 | 
				
			||||||
modulate = Color( 0, 1, 0.976471, 1 )
 | 
					modulate = Color( 0, 1, 0.976471, 1 )
 | 
				
			||||||
shape = SubResource( 3 )
 | 
					shape = SubResource( 3 )
 | 
				
			||||||
disabled = true
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
[node name="PickUpArea" type="Area2D" parent="."]
 | 
					[node name="PickUpArea" type="Area2D" parent="."]
 | 
				
			||||||
modulate = Color( 1, 0, 0.984314, 1 )
 | 
					modulate = Color( 1, 0, 0.984314, 1 )
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										
											BIN
										
									
								
								assets/Sam.png
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								assets/Sam.png
									
									
									
									
									
										Executable file
									
								
							
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 1.2 KiB  | 
							
								
								
									
										34
									
								
								assets/Sam.png.import
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										34
									
								
								assets/Sam.png.import
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,34 @@
 | 
				
			|||||||
 | 
					[remap]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					importer="texture"
 | 
				
			||||||
 | 
					type="StreamTexture"
 | 
				
			||||||
 | 
					path="res://.import/Sam.png-93ab49ac51285cb745c147e0294117dc.stex"
 | 
				
			||||||
 | 
					metadata={
 | 
				
			||||||
 | 
					"vram_texture": false
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[deps]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					source_file="res://assets/Sam.png"
 | 
				
			||||||
 | 
					dest_files=[ "res://.import/Sam.png-93ab49ac51285cb745c147e0294117dc.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
 | 
				
			||||||
 | 
					stream=false
 | 
				
			||||||
 | 
					size_limit=0
 | 
				
			||||||
 | 
					detect_3d=true
 | 
				
			||||||
 | 
					svg/scale=1.0
 | 
				
			||||||
		Reference in New Issue
	
	Block a user