You too
This commit is contained in:
		
							parent
							
								
									827abde68f
								
							
						
					
					
						commit
						30aad69fff
					
				
					 17 changed files with 677 additions and 0 deletions
				
			
		
							
								
								
									
										26
									
								
								assets/particles/BrakeSmoke.tscn
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										26
									
								
								assets/particles/BrakeSmoke.tscn
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,26 @@ | |||
| [gd_scene load_steps=3 format=2] | ||||
| 
 | ||||
| [sub_resource type="Curve" id=5] | ||||
| _data = [ Vector2( 0, 1 ), 0.0, -1.0, 0, 1, Vector2( 1, 0 ), -1.0, 0.0, 1, 0 ] | ||||
| 
 | ||||
| [sub_resource type="Gradient" id=6] | ||||
| colors = PoolColorArray( 0.761719, 0.701047, 0.493927, 1, 0.242188, 0.230288, 0.198669, 1 ) | ||||
| 
 | ||||
| [node name="BrakeSmoke" type="CPUParticles2D"] | ||||
| position = Vector2( 0, 12 ) | ||||
| emitting = false | ||||
| amount = 32 | ||||
| lifetime = 0.5 | ||||
| local_coords = false | ||||
| emission_shape = 4 | ||||
| emission_points = PoolVector2Array( -3, 0, 3, 0 ) | ||||
| emission_normals = PoolVector2Array( -1, 0, 1, 0 ) | ||||
| emission_colors = PoolColorArray(  ) | ||||
| spread = 10.0 | ||||
| gravity = Vector2( 0, 0 ) | ||||
| initial_velocity = 16.0 | ||||
| angle = 360.0 | ||||
| angle_random = 1.0 | ||||
| scale_amount = 3.0 | ||||
| scale_amount_curve = SubResource( 5 ) | ||||
| color_ramp = SubResource( 6 ) | ||||
							
								
								
									
										29
									
								
								assets/particles/Fire.tscn
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										29
									
								
								assets/particles/Fire.tscn
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,29 @@ | |||
| [gd_scene load_steps=3 format=2] | ||||
| 
 | ||||
| [sub_resource type="Curve" id=3] | ||||
| _data = [ Vector2( 0, 1 ), 0.0, 0.0123287, 0, 0, Vector2( 1, 0 ), -0.102436, 0.0, 0, 0 ] | ||||
| 
 | ||||
| [sub_resource type="Gradient" id=4] | ||||
| offsets = PoolRealArray( 0, 0.678967 ) | ||||
| colors = PoolColorArray( 1, 0.939697, 0.035156, 1, 0.890625, 0.0834959, 0.0834959, 1 ) | ||||
| 
 | ||||
| [node name="Fire" type="CPUParticles2D"] | ||||
| position = Vector2( 0, 12 ) | ||||
| emitting = false | ||||
| amount = 32 | ||||
| lifetime = 0.25 | ||||
| fract_delta = false | ||||
| emission_shape = 4 | ||||
| emission_points = PoolVector2Array( -4, 0, -2.5, 0, -1, 0, 0, 0, 1, 0, 2.5, 0, 4, 0 ) | ||||
| emission_normals = PoolVector2Array( -1, 0.5, -1, 0.25, -1, 0.2, -1, 0, -1, -0.2, -1, -0.25, -1, -0.5 ) | ||||
| emission_colors = PoolColorArray(  ) | ||||
| direction = Vector2( 0, 1 ) | ||||
| spread = 0.0 | ||||
| gravity = Vector2( 0, 0 ) | ||||
| initial_velocity = 32.0 | ||||
| angle = 360.0 | ||||
| angle_random = 1.0 | ||||
| scale_amount = 3.0 | ||||
| scale_amount_random = 1.0 | ||||
| scale_amount_curve = SubResource( 3 ) | ||||
| color_ramp = SubResource( 4 ) | ||||
							
								
								
									
										23
									
								
								assets/particles/Smoke.tscn
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								assets/particles/Smoke.tscn
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,23 @@ | |||
| [gd_scene load_steps=3 format=2] | ||||
| 
 | ||||
| [sub_resource type="Curve" id=1] | ||||
| _data = [ Vector2( 0, 1 ), 0.0, -1.0, 0, 1, Vector2( 1, 0 ), -1.0, 0.0, 1, 0 ] | ||||
| 
 | ||||
| [sub_resource type="Gradient" id=2] | ||||
| colors = PoolColorArray( 0.304688, 0.276049, 0.221374, 1, 0.128906, 0.125393, 0.119339, 1 ) | ||||
| 
 | ||||
| [node name="Smoke" type="CPUParticles2D"] | ||||
| position = Vector2( 0, 12 ) | ||||
| emitting = false | ||||
| amount = 32 | ||||
| local_coords = false | ||||
| emission_shape = 2 | ||||
| emission_rect_extents = Vector2( 1, 0 ) | ||||
| direction = Vector2( 0, 1 ) | ||||
| gravity = Vector2( 0, 0 ) | ||||
| initial_velocity = 32.0 | ||||
| angle = 720.0 | ||||
| angle_random = 1.0 | ||||
| scale_amount = 3.0 | ||||
| scale_amount_curve = SubResource( 1 ) | ||||
| color_ramp = SubResource( 2 ) | ||||
							
								
								
									
										27
									
								
								assets/particles/Sparks.tscn
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								assets/particles/Sparks.tscn
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,27 @@ | |||
| [gd_scene load_steps=3 format=2] | ||||
| 
 | ||||
| [sub_resource type="Curve" id=3] | ||||
| _data = [ Vector2( 0, 1 ), 0.0, -1.0, 0, 1, Vector2( 1, 0 ), -1.0, 0.0, 1, 0 ] | ||||
| 
 | ||||
| [sub_resource type="Gradient" id=4] | ||||
| offsets = PoolRealArray( 0, 0.170068, 0.62585, 1 ) | ||||
| colors = PoolColorArray( 1, 1, 1, 1, 1, 0.981354, 0.0820312, 1, 0.961719, 0.764515, 0.108945, 1, 0.836719, 0.0947846, 0.0947846, 1 ) | ||||
| 
 | ||||
| [node name="Sparks" type="CPUParticles2D"] | ||||
| position = Vector2( 0, 10 ) | ||||
| emitting = false | ||||
| amount = 32 | ||||
| fract_delta = false | ||||
| local_coords = false | ||||
| emission_shape = 2 | ||||
| emission_rect_extents = Vector2( 2, 0 ) | ||||
| direction = Vector2( 0, 1 ) | ||||
| spread = 90.0 | ||||
| gravity = Vector2( 0, 0 ) | ||||
| initial_velocity = 32.0 | ||||
| angle = 360.0 | ||||
| angle_random = 1.0 | ||||
| scale_amount = 3.0 | ||||
| scale_amount_random = 1.0 | ||||
| scale_amount_curve = SubResource( 3 ) | ||||
| color_ramp = SubResource( 4 ) | ||||
							
								
								
									
										
											BIN
										
									
								
								assets/ships/disky/disky.png
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								assets/ships/disky/disky.png
									
										
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 291 B | 
							
								
								
									
										34
									
								
								assets/ships/disky/disky.png.import
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										34
									
								
								assets/ships/disky/disky.png.import
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,34 @@ | |||
| [remap] | ||||
| 
 | ||||
| importer="texture" | ||||
| type="StreamTexture" | ||||
| path="res://.import/disky.png-f242c4e5faf06dc8bf05c7130abd8c5d.stex" | ||||
| metadata={ | ||||
| "vram_texture": false | ||||
| } | ||||
| 
 | ||||
| [deps] | ||||
| 
 | ||||
| source_file="res://assets/ships/disky/disky.png" | ||||
| dest_files=[ "res://.import/disky.png-f242c4e5faf06dc8bf05c7130abd8c5d.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=false | ||||
| 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=false | ||||
| svg/scale=1.0 | ||||
							
								
								
									
										
											BIN
										
									
								
								assets/ships/quills/quills.png
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								assets/ships/quills/quills.png
									
										
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 351 B | 
							
								
								
									
										34
									
								
								assets/ships/quills/quills.png.import
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										34
									
								
								assets/ships/quills/quills.png.import
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,34 @@ | |||
| [remap] | ||||
| 
 | ||||
| importer="texture" | ||||
| type="StreamTexture" | ||||
| path="res://.import/quills.png-b1aaba71cbbfa07459cfd05af3db0494.stex" | ||||
| metadata={ | ||||
| "vram_texture": false | ||||
| } | ||||
| 
 | ||||
| [deps] | ||||
| 
 | ||||
| source_file="res://assets/ships/quills/quills.png" | ||||
| dest_files=[ "res://.import/quills.png-b1aaba71cbbfa07459cfd05af3db0494.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=false | ||||
| 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=false | ||||
| svg/scale=1.0 | ||||
							
								
								
									
										103
									
								
								objects/Ship.gd
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										103
									
								
								objects/Ship.gd
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,103 @@ | |||
| extends KinematicBody2D | ||||
| 
 | ||||
| export (String, "player_1", "player_2", "player_3", "player_4") var player_number: String = "player_1" | ||||
| 
 | ||||
| export var thrust_power: float | ||||
| export var max_speed: float | ||||
| export var brake_power: float | ||||
| export var velocity_damp: float | ||||
| 
 | ||||
| export var turning_power: float | ||||
| export var max_turning: float | ||||
| export var turning_damp: float | ||||
| 
 | ||||
| export var bounce_damp: float | ||||
| 
 | ||||
| export var max_health: float | ||||
| export var max_energy: float | ||||
| export var energy_regen: float | ||||
| 
 | ||||
| onready var health: float = max_health | ||||
| onready var energy: float = max_energy | ||||
| 
 | ||||
| var heading: float = 0 | ||||
| var turning: float = 0 | ||||
| var velocity: Vector2 = Vector2(0, 0) | ||||
| 
 | ||||
| var using_energy: bool = false | ||||
| 
 | ||||
| func _physics_process(delta): | ||||
| 	# Turning | ||||
| 	apply_turning(delta) | ||||
| 	rotation = stepify(heading, 2*PI/16) | ||||
| 	 | ||||
| 	var tp = false | ||||
| 	if Input.is_action_pressed(player_number + "_up"): | ||||
| 		tp = apply_thrust(delta) | ||||
| 	$Graphics/ThrustParticles.emitting = tp | ||||
| 	 | ||||
| 	# Brakes | ||||
| 	var bp = false | ||||
| 	if Input.is_action_pressed(player_number + "_down"): | ||||
| 		bp = apply_brake(delta) | ||||
| 	$Graphics/BrakeParticles.emitting = bp | ||||
| 	 | ||||
| 	# Damping n' Clamping | ||||
| 	if !tp: | ||||
| 		velocity *= pow(velocity_damp, delta) | ||||
| 	velocity = velocity.clamped(max_speed) | ||||
| 	 | ||||
| 	# Move and process collisions | ||||
| 	var coll = move_and_collide(velocity * delta) | ||||
| 	if coll: | ||||
| 		velocity = velocity.bounce(coll.normal) * bounce_damp | ||||
| 		if coll.collider.has_method("impact"): | ||||
| 			coll.collider.impact(coll.normal*-velocity.length()) | ||||
| 	 | ||||
| 	# Regenerate energy | ||||
| 	if !using_energy: | ||||
| 		energy = min(energy + energy_regen * delta, max_energy) | ||||
| 	using_energy = false | ||||
| 
 | ||||
| func _input(event): | ||||
| 	if event.is_action_pressed(player_number + "_primary"): | ||||
| 		$PrimaryAction.activate() | ||||
| 	if event.is_action_released(player_number + "_primary"): | ||||
| 		$PrimaryAction.deactivate() | ||||
| 	if event.is_action_pressed(player_number + "_secondary"): | ||||
| 		$SecondaryAction.activate() | ||||
| 	if event.is_action_released(player_number + "_secondary"): | ||||
| 		$SecondaryAction.deactivate() | ||||
| 
 | ||||
| func apply_turning(delta: float): | ||||
| 	var new_turn_force = false | ||||
| 	if Input.is_action_pressed(player_number + "_left"): | ||||
| 		turning -= turning_power * delta | ||||
| 		new_turn_force = true | ||||
| 	if Input.is_action_pressed(player_number + "_right"): | ||||
| 		turning += turning_power * delta | ||||
| 		new_turn_force = true | ||||
| 	if !new_turn_force: | ||||
| 		turning *= pow(turning_damp, delta) | ||||
| 	turning = clamp(turning, -max_turning, max_turning) | ||||
| 	heading += turning * delta | ||||
| 
 | ||||
| func apply_thrust(delta: float) -> bool: | ||||
| 	# Direction vector and relative velocity | ||||
| 	var direction = Vector2(0, -1).rotated(heading) | ||||
| 	velocity += direction * thrust_power * delta | ||||
| 	 | ||||
| 	return true | ||||
| 
 | ||||
| func apply_brake(delta: float) -> bool: | ||||
| 	velocity *= pow(1/brake_power, delta) | ||||
| 	return true | ||||
| 
 | ||||
| func impact(force: Vector2): | ||||
| 	velocity += force | ||||
| 
 | ||||
| func set_energy(new_energy) -> bool: | ||||
| 	if new_energy < energy: | ||||
| 		using_energy = true | ||||
| 	energy = clamp(new_energy, 0, max_energy) | ||||
| 	return !(energy == 0)  | ||||
							
								
								
									
										55
									
								
								objects/Ship.tscn
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										55
									
								
								objects/Ship.tscn
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,55 @@ | |||
| [gd_scene load_steps=4 format=2] | ||||
| 
 | ||||
| [ext_resource path="res://objects/Ship.gd" type="Script" id=1] | ||||
| 
 | ||||
| [sub_resource type="GDScript" id=1] | ||||
| script/source = "extends Node2D | ||||
| 
 | ||||
| onready var children: Array = get_children() | ||||
| 
 | ||||
| func activate(): | ||||
| 	for child in children: | ||||
| 		child.activate() | ||||
| 
 | ||||
| func deactivate(): | ||||
| 	for child in children: | ||||
| 		child.deactivate() | ||||
| " | ||||
| 
 | ||||
| [sub_resource type="GDScript" id=2] | ||||
| script/source = "extends Node2D | ||||
| 
 | ||||
| onready var children: Array = get_children() | ||||
| 
 | ||||
| var emitting: bool = false setget set_emitting | ||||
| 
 | ||||
| func set_emitting(val: bool): | ||||
| 	if val == emitting: | ||||
| 		return | ||||
| 	emitting = val | ||||
| 	for node in children: | ||||
| 		node.emitting = val | ||||
| " | ||||
| 
 | ||||
| [node name="Ship" type="KinematicBody2D"] | ||||
| collision_layer = 3 | ||||
| collision_mask = 6 | ||||
| script = ExtResource( 1 ) | ||||
| 
 | ||||
| [node name="PrimaryAction" type="Node2D" parent="."] | ||||
| script = SubResource( 1 ) | ||||
| 
 | ||||
| [node name="SecondaryAction" type="Node2D" parent="."] | ||||
| script = SubResource( 1 ) | ||||
| 
 | ||||
| [node name="Graphics" type="Node2D" parent="."] | ||||
| 
 | ||||
| [node name="Sprite" type="Sprite" parent="Graphics"] | ||||
| 
 | ||||
| [node name="ThrustParticles" type="Node2D" parent="Graphics"] | ||||
| z_index = -1 | ||||
| script = SubResource( 2 ) | ||||
| 
 | ||||
| [node name="BrakeParticles" type="Node2D" parent="Graphics"] | ||||
| z_index = -1 | ||||
| script = SubResource( 2 ) | ||||
							
								
								
									
										25
									
								
								objects/actions/StaticShield.gd
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								objects/actions/StaticShield.gd
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,25 @@ | |||
| extends Area2D | ||||
| 
 | ||||
| export var ship_path: NodePath | ||||
| export var energy_usage: float | ||||
| export var min_energy: float | ||||
| 
 | ||||
| onready var ship: Node = get_node(ship_path) | ||||
| 
 | ||||
| var active = false | ||||
| 
 | ||||
| func activate(): | ||||
| 	if ship.energy > min_energy: | ||||
| 		active = true | ||||
| 		$Static.visible = true | ||||
| 		$Shape.disabled = false | ||||
| 
 | ||||
| func deactivate(): | ||||
| 	active = false | ||||
| 	$Static.visible = false | ||||
| 	$Shape.disabled = true | ||||
| 
 | ||||
| func _physics_process(delta): | ||||
| 	if active: | ||||
| 		if !ship.set_energy(ship.energy - energy_usage * delta): | ||||
| 			deactivate() | ||||
							
								
								
									
										212
									
								
								objects/actions/StaticShield.tscn
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										212
									
								
								objects/actions/StaticShield.tscn
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,212 @@ | |||
| [gd_scene load_steps=6 format=2] | ||||
| 
 | ||||
| [ext_resource path="res://icon.png" type="Texture" id=1] | ||||
| [ext_resource path="res://objects/actions/StaticShield.gd" type="Script" id=2] | ||||
| 
 | ||||
| [sub_resource type="Shader" id=1] | ||||
| code = "shader_type canvas_item; | ||||
| 
 | ||||
| uniform vec2 offset; | ||||
| uniform float scale:hint_range(0.5, 1000.0); | ||||
| // jitter cell ceneters. less gives more regular pattern | ||||
| uniform float jitter:hint_range(0.0, 1.0); | ||||
| 
 | ||||
| uniform vec4 color: hint_color = vec4(1,1,1,1); | ||||
| uniform float speed = 1.0; | ||||
| 
 | ||||
| // Cellular noise (\\\"Worley noise\\\") in 3D in GLSL. | ||||
| // Copyright (c) Stefan Gustavson 2011-04-19. All rights reserved. | ||||
| // This code is released under the conditions of the MIT license. | ||||
| // See LICENSE file for details. | ||||
| // https://github.com/stegu/webgl-noise | ||||
| 
 | ||||
| // Modulo 289 without a division (only multiplications) | ||||
| vec3 mod289(vec3 x) { | ||||
|     return x - floor(x * (1.0 / 289.0)) * 289.0; | ||||
| } | ||||
| 
 | ||||
| // Modulo 7 without a division | ||||
| vec3 mod7(vec3 x) { | ||||
|     return x - floor(x * (1.0 / 7.0)) * 7.0; | ||||
| } | ||||
| 
 | ||||
| // Permutation polynomial: (34x^2 + x) mod 289 | ||||
| vec3 permute(vec3 x) { | ||||
|     return mod289((34.0 * x + 1.0) * x); | ||||
| } | ||||
| 
 | ||||
| // Cellular noise, returning F1 and F2 in a vec2. | ||||
| // 3x3x3 search region for good F2 everywhere, but a lot | ||||
| // slower than the 2x2x2 version. | ||||
| // The code below is a bit scary even to its author, | ||||
| // but it has at least half decent performance on a | ||||
| // modern GPU. In any case, it beats any software | ||||
| // implementation of Worley noise hands down. | ||||
| 
 | ||||
| vec2 cellular3d(vec3 P) { | ||||
|     float K = 0.142857142857; // 1/7 | ||||
|     float Ko = 0.428571428571; // 1/2-K/2 | ||||
|     float K2 = 0.020408163265306; // 1/(7*7) | ||||
|     float Kz = 0.166666666667; // 1/6 | ||||
|     float Kzo = 0.416666666667; // 1/2-1/6*2 | ||||
|      | ||||
|     vec3 Pi = mod289(floor(P)); | ||||
|     vec3 Pf = fract(P) - 0.5; | ||||
|      | ||||
|     vec3 Pfx = Pf.x + vec3(1.0, 0.0, -1.0); | ||||
|     vec3 Pfy = Pf.y + vec3(1.0, 0.0, -1.0); | ||||
|     vec3 Pfz = Pf.z + vec3(1.0, 0.0, -1.0); | ||||
|      | ||||
|     vec3 p = permute(Pi.x + vec3(-1.0, 0.0, 1.0)); | ||||
|     vec3 p1 = permute(p + Pi.y - 1.0); | ||||
|     vec3 p2 = permute(p + Pi.y); | ||||
|     vec3 p3 = permute(p + Pi.y + 1.0); | ||||
|      | ||||
|     vec3 p11 = permute(p1 + Pi.z - 1.0); | ||||
|     vec3 p12 = permute(p1 + Pi.z); | ||||
|     vec3 p13 = permute(p1 + Pi.z + 1.0); | ||||
|      | ||||
|     vec3 p21 = permute(p2 + Pi.z - 1.0); | ||||
|     vec3 p22 = permute(p2 + Pi.z); | ||||
|     vec3 p23 = permute(p2 + Pi.z + 1.0); | ||||
|      | ||||
|     vec3 p31 = permute(p3 + Pi.z - 1.0); | ||||
|     vec3 p32 = permute(p3 + Pi.z); | ||||
|     vec3 p33 = permute(p3 + Pi.z + 1.0); | ||||
|      | ||||
|     vec3 ox11 = fract(p11*K) - Ko; | ||||
|     vec3 oy11 = mod7(floor(p11*K))*K - Ko; | ||||
|     vec3 oz11 = floor(p11*K2)*Kz - Kzo; // p11 < 289 guaranteed | ||||
|      | ||||
|     vec3 ox12 = fract(p12*K) - Ko; | ||||
|     vec3 oy12 = mod7(floor(p12*K))*K - Ko; | ||||
|     vec3 oz12 = floor(p12*K2)*Kz - Kzo; | ||||
|      | ||||
|     vec3 ox13 = fract(p13*K) - Ko; | ||||
|     vec3 oy13 = mod7(floor(p13*K))*K - Ko; | ||||
|     vec3 oz13 = floor(p13*K2)*Kz - Kzo; | ||||
|      | ||||
|     vec3 ox21 = fract(p21*K) - Ko; | ||||
|     vec3 oy21 = mod7(floor(p21*K))*K - Ko; | ||||
|     vec3 oz21 = floor(p21*K2)*Kz - Kzo; | ||||
|      | ||||
|     vec3 ox22 = fract(p22*K) - Ko; | ||||
|     vec3 oy22 = mod7(floor(p22*K))*K - Ko; | ||||
|     vec3 oz22 = floor(p22*K2)*Kz - Kzo; | ||||
|      | ||||
|     vec3 ox23 = fract(p23*K) - Ko; | ||||
|     vec3 oy23 = mod7(floor(p23*K))*K - Ko; | ||||
|     vec3 oz23 = floor(p23*K2)*Kz - Kzo; | ||||
|      | ||||
|     vec3 ox31 = fract(p31*K) - Ko; | ||||
|     vec3 oy31 = mod7(floor(p31*K))*K - Ko; | ||||
|     vec3 oz31 = floor(p31*K2)*Kz - Kzo; | ||||
|      | ||||
|     vec3 ox32 = fract(p32*K) - Ko; | ||||
|     vec3 oy32 = mod7(floor(p32*K))*K - Ko; | ||||
|     vec3 oz32 = floor(p32*K2)*Kz - Kzo; | ||||
|      | ||||
|     vec3 ox33 = fract(p33*K) - Ko; | ||||
|     vec3 oy33 = mod7(floor(p33*K))*K - Ko; | ||||
|     vec3 oz33 = floor(p33*K2)*Kz - Kzo; | ||||
|      | ||||
|     vec3 dx11 = Pfx + jitter*ox11; | ||||
|     vec3 dy11 = Pfy.x + jitter*oy11; | ||||
|     vec3 dz11 = Pfz.x + jitter*oz11; | ||||
|      | ||||
|     vec3 dx12 = Pfx + jitter*ox12; | ||||
|     vec3 dy12 = Pfy.x + jitter*oy12; | ||||
|     vec3 dz12 = Pfz.y + jitter*oz12; | ||||
|      | ||||
|     vec3 dx13 = Pfx + jitter*ox13; | ||||
|     vec3 dy13 = Pfy.x + jitter*oy13; | ||||
|     vec3 dz13 = Pfz.z + jitter*oz13; | ||||
|      | ||||
|     vec3 dx21 = Pfx + jitter*ox21; | ||||
|     vec3 dy21 = Pfy.y + jitter*oy21; | ||||
|     vec3 dz21 = Pfz.x + jitter*oz21; | ||||
|      | ||||
|     vec3 dx22 = Pfx + jitter*ox22; | ||||
|     vec3 dy22 = Pfy.y + jitter*oy22; | ||||
|     vec3 dz22 = Pfz.y + jitter*oz22; | ||||
|      | ||||
|     vec3 dx23 = Pfx + jitter*ox23; | ||||
|     vec3 dy23 = Pfy.y + jitter*oy23; | ||||
|     vec3 dz23 = Pfz.z + jitter*oz23; | ||||
|      | ||||
|     vec3 dx31 = Pfx + jitter*ox31; | ||||
|     vec3 dy31 = Pfy.z + jitter*oy31; | ||||
|     vec3 dz31 = Pfz.x + jitter*oz31; | ||||
|      | ||||
|     vec3 dx32 = Pfx + jitter*ox32; | ||||
|     vec3 dy32 = Pfy.z + jitter*oy32; | ||||
|     vec3 dz32 = Pfz.y + jitter*oz32; | ||||
|      | ||||
|     vec3 dx33 = Pfx + jitter*ox33; | ||||
|     vec3 dy33 = Pfy.z + jitter*oy33; | ||||
|     vec3 dz33 = Pfz.z + jitter*oz33; | ||||
|      | ||||
|     vec3 d11 = dx11 * dx11 + dy11 * dy11 + dz11 * dz11; | ||||
|     vec3 d12 = dx12 * dx12 + dy12 * dy12 + dz12 * dz12; | ||||
|     vec3 d13 = dx13 * dx13 + dy13 * dy13 + dz13 * dz13; | ||||
|     vec3 d21 = dx21 * dx21 + dy21 * dy21 + dz21 * dz21; | ||||
|     vec3 d22 = dx22 * dx22 + dy22 * dy22 + dz22 * dz22; | ||||
|     vec3 d23 = dx23 * dx23 + dy23 * dy23 + dz23 * dz23; | ||||
|     vec3 d31 = dx31 * dx31 + dy31 * dy31 + dz31 * dz31; | ||||
|     vec3 d32 = dx32 * dx32 + dy32 * dy32 + dz32 * dz32; | ||||
|     vec3 d33 = dx33 * dx33 + dy33 * dy33 + dz33 * dz33; | ||||
|      | ||||
|     // Sort out the two smallest distances (F1, F2) | ||||
| // F1 only block | ||||
|     vec3 d1 = min(min(d11,d12), d13); | ||||
|     vec3 d2 = min(min(d21,d22), d23); | ||||
|     vec3 d3 = min(min(d31,d32), d33); | ||||
|     vec3 d = min(min(d1,d2), d3); | ||||
|     d.x = min(min(d.x,d.y),d.z); | ||||
|     return vec2(sqrt(d.x)); // F1 duplicated, no F2 computed | ||||
| // End of F1 only block | ||||
| } | ||||
| 
 | ||||
| void fragment() { | ||||
|     vec2 n = cellular3d(vec3((UV+offset)*scale, TIME*speed)); | ||||
|      | ||||
|     //using F1 for output | ||||
|     //COLOR.rgb = vec3(n.x); | ||||
|     //using F2 for output | ||||
|     //COLOR.rgb = vec3(1.0-n.y); | ||||
|     //using both, keep experimenting with them :) | ||||
| //    COLOR.rgb = vec3(smoothstep(0, .2, n.y-n.x)); | ||||
| 	COLOR = mix(color, vec4(0), smoothstep(1.0, 0.5, n.x)); | ||||
| //	COLOR.a *= smoothstep(1.0,0.0,length(UV-vec2(0.5))*1.0); | ||||
| }" | ||||
| 
 | ||||
| [sub_resource type="ShaderMaterial" id=2] | ||||
| shader = SubResource( 1 ) | ||||
| shader_param/offset = Vector2( 0, 0 ) | ||||
| shader_param/scale = 4.0 | ||||
| shader_param/jitter = 1.0 | ||||
| shader_param/color = Color( 1, 0.964706, 0.45098, 1 ) | ||||
| shader_param/speed = 3.0 | ||||
| 
 | ||||
| [sub_resource type="CircleShape2D" id=3] | ||||
| radius = 17.0294 | ||||
| 
 | ||||
| [node name="StaticShield" type="Area2D"] | ||||
| script = ExtResource( 2 ) | ||||
| energy_usage = 5.0 | ||||
| min_energy = 5.0 | ||||
| 
 | ||||
| [node name="Static" type="Polygon2D" parent="."] | ||||
| visible = false | ||||
| material = SubResource( 2 ) | ||||
| position = Vector2( 0, -4 ) | ||||
| scale = Vector2( 3, 3 ) | ||||
| z_index = 1 | ||||
| texture = ExtResource( 1 ) | ||||
| polygon = PoolVector2Array( -3, 5, -5, 3, -5.66667, 0, -5, -3, -3, -5, 0, -5.66667, 3, -5, 5, -3, 5.66667, 0, 5, 3, 3, 5, 0, 5.66667 ) | ||||
| uv = PoolVector2Array( 14.274, 55.0982, 4.58411, 45.4083, 1.35414, 30.8735, 4.58411, 16.3386, 14.274, 6.64873, 28.8089, 3.41877, 43.3437, 6.64873, 53.0336, 16.3386, 57.8786, 30.8735, 53.0336, 45.4083, 43.3437, 55.0982, 28.8089, 58.3282 ) | ||||
| 
 | ||||
| [node name="Shape" type="CollisionShape2D" parent="."] | ||||
| position = Vector2( 0, -4 ) | ||||
| shape = SubResource( 3 ) | ||||
| disabled = true | ||||
							
								
								
									
										40
									
								
								objects/ships/Disky.tscn
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										40
									
								
								objects/ships/Disky.tscn
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,40 @@ | |||
| [gd_scene load_steps=7 format=2] | ||||
| 
 | ||||
| [ext_resource path="res://objects/Ship.tscn" type="PackedScene" id=1] | ||||
| [ext_resource path="res://assets/ships/disky/disky.png" type="Texture" id=2] | ||||
| [ext_resource path="res://assets/particles/Sparks.tscn" type="PackedScene" id=3] | ||||
| [ext_resource path="res://objects/actions/StaticShield.tscn" type="PackedScene" id=4] | ||||
| 
 | ||||
| [sub_resource type="CircleShape2D" id=1] | ||||
| radius = 5.0 | ||||
| 
 | ||||
| [sub_resource type="RectangleShape2D" id=2] | ||||
| extents = Vector2( 3, 5 ) | ||||
| 
 | ||||
| [node name="Disky" instance=ExtResource( 1 )] | ||||
| thrust_power = 200.0 | ||||
| max_speed = 80.0 | ||||
| brake_power = 1.0 | ||||
| velocity_damp = 0.5 | ||||
| turning_power = 18.849 | ||||
| max_turning = 6.0 | ||||
| turning_damp = 0.01 | ||||
| bounce_damp = 0.7 | ||||
| max_energy = 10.0 | ||||
| energy_regen = 5.0 | ||||
| 
 | ||||
| [node name="StaticShield" parent="SecondaryAction" index="0" instance=ExtResource( 4 )] | ||||
| ship_path = NodePath("../..") | ||||
| 
 | ||||
| [node name="Sprite" parent="Graphics" index="0"] | ||||
| texture = ExtResource( 2 ) | ||||
| 
 | ||||
| [node name="Sparks" parent="Graphics/ThrustParticles" index="0" instance=ExtResource( 3 )] | ||||
| 
 | ||||
| [node name="HeadShape" type="CollisionShape2D" parent="." index="3"] | ||||
| position = Vector2( 0, -4 ) | ||||
| shape = SubResource( 1 ) | ||||
| 
 | ||||
| [node name="BodyShape" type="CollisionShape2D" parent="." index="4"] | ||||
| position = Vector2( 0, 4 ) | ||||
| shape = SubResource( 2 ) | ||||
							
								
								
									
										35
									
								
								objects/ships/Quills.tscn
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										35
									
								
								objects/ships/Quills.tscn
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,35 @@ | |||
| [gd_scene load_steps=7 format=2] | ||||
| 
 | ||||
| [ext_resource path="res://objects/Ship.tscn" type="PackedScene" id=1] | ||||
| [ext_resource path="res://assets/ships/quills/quills.png" type="Texture" id=2] | ||||
| [ext_resource path="res://assets/particles/Fire.tscn" type="PackedScene" id=3] | ||||
| [ext_resource path="res://assets/particles/Smoke.tscn" type="PackedScene" id=4] | ||||
| [ext_resource path="res://assets/particles/BrakeSmoke.tscn" type="PackedScene" id=5] | ||||
| 
 | ||||
| [sub_resource type="RectangleShape2D" id=7] | ||||
| extents = Vector2( 2, 7 ) | ||||
| 
 | ||||
| [node name="Quills" instance=ExtResource( 1 )] | ||||
| thrust_power = 80.0 | ||||
| max_speed = 80.0 | ||||
| brake_power = 8.0 | ||||
| velocity_damp = 0.9 | ||||
| turning_power = 18.849 | ||||
| max_turning = 18.849 | ||||
| bounce_damp = 0.4 | ||||
| 
 | ||||
| [node name="Sprite" parent="Graphics" index="0"] | ||||
| texture = ExtResource( 2 ) | ||||
| 
 | ||||
| [node name="Smoke" parent="Graphics/ThrustParticles" index="0" instance=ExtResource( 4 )] | ||||
| 
 | ||||
| [node name="Fire" parent="Graphics/ThrustParticles" index="1" instance=ExtResource( 3 )] | ||||
| 
 | ||||
| [node name="BrakeSmoke" parent="Graphics/BrakeParticles" index="0" instance=ExtResource( 5 )] | ||||
| 
 | ||||
| [node name="BodyCollider" type="CollisionShape2D" parent="." index="3"] | ||||
| position = Vector2( 0, 3 ) | ||||
| shape = SubResource( 7 ) | ||||
| 
 | ||||
| [node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="." index="4"] | ||||
| polygon = PoolVector2Array( 5, -4, -5, -4, 0, -12 ) | ||||
							
								
								
									
										1
									
								
								scenes/MainMenu.gd
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								scenes/MainMenu.gd
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1 @@ | |||
| extends Control | ||||
							
								
								
									
										11
									
								
								scenes/MainMenu.tscn
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								scenes/MainMenu.tscn
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,11 @@ | |||
| [gd_scene load_steps=2 format=2] | ||||
| 
 | ||||
| [ext_resource path="res://scenes/MainMenu.gd" type="Script" id=1] | ||||
| 
 | ||||
| [node name="MainMenu" type="Control"] | ||||
| anchor_right = 1.0 | ||||
| anchor_bottom = 1.0 | ||||
| script = ExtResource( 1 ) | ||||
| __meta__ = { | ||||
| "_edit_use_anchors_": false | ||||
| } | ||||
							
								
								
									
										22
									
								
								scenes/TestScene.tscn
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								scenes/TestScene.tscn
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,22 @@ | |||
| [gd_scene load_steps=4 format=2] | ||||
| 
 | ||||
| [ext_resource path="res://objects/ships/Disky.tscn" type="PackedScene" id=1] | ||||
| [ext_resource path="res://objects/ships/Quills.tscn" type="PackedScene" id=2] | ||||
| 
 | ||||
| [sub_resource type="GDScript" id=1] | ||||
| script/source = "extends Node2D | ||||
| 
 | ||||
| func _process(delta): | ||||
| 	if Input.is_action_just_pressed(\"debug_reset\"): | ||||
| 		get_tree().change_scene(\"res://scenes/TestScene.tscn\") | ||||
| " | ||||
| 
 | ||||
| [node name="TestScene" type="Node2D"] | ||||
| script = SubResource( 1 ) | ||||
| 
 | ||||
| [node name="Quills" parent="." instance=ExtResource( 2 )] | ||||
| position = Vector2( 106.783, 173.39 ) | ||||
| player_number = "player_2" | ||||
| 
 | ||||
| [node name="Disky" parent="." instance=ExtResource( 1 )] | ||||
| position = Vector2( 210.244, 143.66 ) | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue