--- /dev/null
+extends KinematicBody
+
+
+# Declare member variables here. Examples:
+# var a = 2
+# var b = "text"
+var SPEED = 200
+var direction = Vector3.ZERO
+
+# 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):
+ translation += SPEED * direction * delta
--- /dev/null
+[gd_scene load_steps=6 format=2]
+
+[ext_resource path="res://player/bullet.gd" type="Script" id=1]
+
+[sub_resource type="BoxShape" id=1]
+extents = Vector3( 0.200265, 0.163217, 1.15937 )
+
+[sub_resource type="VisualShaderNodeColorConstant" id=2]
+constant = Color( 0.934058, 0.128752, 0, 1 )
+
+[sub_resource type="VisualShader" id=3]
+code = "shader_type spatial;
+render_mode specular_schlick_ggx, unshaded;
+
+
+
+
+void vertex() {
+// Output:0
+
+}
+
+void fragment() {
+// Color:2
+ vec3 n_out2p0 = vec3(0.934058, 0.128752, 0.000000);
+ float n_out2p1 = 1.000000;
+
+// Output:0
+ ALBEDO = n_out2p0;
+
+}
+
+void light() {
+// Output:0
+
+}
+"
+graph_offset = Vector2( 0, 20.4406 )
+flags/unshaded = true
+nodes/fragment/0/position = Vector2( 1560, 60 )
+nodes/fragment/2/node = SubResource( 2 )
+nodes/fragment/2/position = Vector2( 1040, 100 )
+nodes/fragment/connections = PoolIntArray( 2, 0, 0, 0 )
+
+[sub_resource type="ShaderMaterial" id=4]
+shader = SubResource( 3 )
+
+[node name="bullet" type="KinematicBody"]
+collision_layer = 2
+collision_mask = 0
+script = ExtResource( 1 )
+
+[node name="CollisionShape" type="CollisionShape" parent="."]
+shape = SubResource( 1 )
+
+[node name="CSGSphere" type="CSGSphere" parent="."]
+transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 11, 0, 0, 0 )
+material_override = SubResource( 4 )
+radius = 0.1
const SPEED_AIM = PI / 2
var velocity = Vector3()
+var scene_bullet = preload("res://player/bullet.tscn")
# Called when the node enters the scene tree for the first time.
func _ready():
elif Input.is_action_pressed("player_aim_right"):
rotate(Vector3.UP, -SPEED_AIM * delta)
+ # offense
+ if Input.is_action_pressed("player_fire"):
+ print("firing!")
+ fire_bullet()
+
+func fire_bullet():
+ var bullet = scene_bullet.instance()
+ $"..".add_child(bullet)
+ bullet.translation = translation - transform.basis.x * 2
+ bullet.rotation = rotation
+ bullet.direction = -transform.basis.z
func _process(delta):
# get velocity changes player asks for
extents = Vector3( 3.72203, 0.878147, 3.13957 )
[node name="arwing" type="KinematicBody"]
+collision_mask = 0
script = ExtResource( 3 )
[node name="mesh" type="Spatial" parent="."]
[node name="camera_pivot" type="Spatial" parent="."]
[node name="Camera" type="Camera" parent="camera_pivot"]
-transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 13.3084 )
+transform = Transform( 1, 0, 0, 0, 0.959634, 0.281253, 0, -0.281253, 0.959634, 0, 9.44245, 11.0721 )
+
+[node name="bullet_origin_r" type="Spatial" parent="."]
+transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, -2 )
+
+[node name="bullet_origin_l" type="Spatial" parent="."]
+transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -1, 0, -2 )