Control port 1.2

This commit is contained in:
Jan Groß
2017-11-18 12:20:12 +01:00
parent 3f78b986b1
commit 178ae82723
4 changed files with 19 additions and 10 deletions

View File

@@ -27,22 +27,22 @@ points = Vector2Array( 3.84713, -7.17275, 6.42704, -3.80966, -0.326464, -6.8104,
[sub_resource type="ConvexPolygonShape2D" id=5] [sub_resource type="ConvexPolygonShape2D" id=5]
custom_solver_bias = 0.0 custom_solver_bias = 0.0
points = Vector2Array( 6.56525, 2.73226, 5.8742, 6.37177, 2.05041, 6.18749, 5.73599, 0.659113 ) points = Vector2Array( 7.80711, -1.2916, 7.64198, 8.18441, 2.46873, 7.91971, -6.74257, 4.46547, -7.99866, -0.0355129, -4.88121, -8.72659, -1.57482, -7.87638, 7.3862, -4.60423 )
[sub_resource type="ConvexPolygonShape2D" id=6] [sub_resource type="ConvexPolygonShape2D" id=6]
custom_solver_bias = 0.0 custom_solver_bias = 0.0
points = Vector2Array( 5.73599, 0.659113, -5.27712, 1.15746, -7.82946, -3.23257, -7.62617, -6.45307, -4.46126, -8.03552, -0.326464, -6.8104, 6.42704, -3.80966 ) points = Vector2Array( -9.60462, -4.09765, -9.41569, -7.97084, -4.88121, -8.72659, -7.99866, -0.0355129 )
[sub_resource type="ConvexPolygonShape2D" id=7] [sub_resource type="ConvexPolygonShape2D" id=7]
custom_solver_bias = 0.0 custom_solver_bias = 0.0
points = Vector2Array( 5.73599, 0.659113, 2.05041, 6.18749, -2.55657, 6.46391, -4.30723, 5.49644, -5.27712, 1.15746 ) points = Vector2Array( 2.46873, 7.91971, -3.8117, 8.44308, -6.74257, 4.46547 )
[sub_resource type="ConvexPolygonShape2D" id=8] [sub_resource type="ConvexPolygonShape2D" id=8]
custom_solver_bias = 0.0 custom_solver_bias = 0.0
points = Vector2Array( 3.84713, -7.17275, 6.42704, -3.80966, -0.326464, -6.8104, 1.00076, -7.62715 ) points = Vector2Array( 4.65796, -8.01454, 7.3862, -4.60423, -1.57482, -7.87638, 2.01497, -9.2934 )
[node name="Asteroid" type="KinematicBody2D"] [node name="Asteroid" type="KinematicBody2D"]
@@ -129,6 +129,7 @@ color/color_ramp = ExtResource( 3 )
[node name="CollisionArea" type="Area2D" parent="."] [node name="CollisionArea" type="Area2D" parent="."]
transform/pos = Vector2( 0.472342, -0.566811 )
input/pickable = true input/pickable = true
shapes/0/shape = SubResource( 5 ) shapes/0/shape = SubResource( 5 )
shapes/0/transform = Matrix32( 1, 0, 0, 1, 0, 0 ) shapes/0/transform = Matrix32( 1, 0, 0, 1, 0, 0 )
@@ -152,7 +153,7 @@ collision/mask = 1024
visibility/visible = false visibility/visible = false
build_mode = 0 build_mode = 0
polygon = Vector2Array( -7.82946, -3.23257, -5.27712, 1.15746, -4.30723, 5.49644, -2.55657, 6.46391, 2.05041, 6.18749, 5.8742, 6.37177, 6.56525, 2.73226, 5.73599, 0.659113, 6.42704, -3.80966, 3.84713, -7.17275, 1.00076, -7.62715, -0.326464, -6.8104, -4.46126, -8.03552, -7.62617, -6.45307 ) polygon = Vector2Array( -9.60462, -4.09765, -7.99866, -0.0355129, -6.74257, 4.46547, -3.8117, 8.44308, 2.46873, 7.91971, 7.64198, 8.18441, 7.80711, -1.2916, 7.3862, -4.60423, 4.65796, -8.01454, 2.01497, -9.2934, -1.57482, -7.87638, -4.88121, -8.72659, -9.41569, -7.97084 )
shape_range = Vector2( 0, 3 ) shape_range = Vector2( 0, 3 )
trigger = true trigger = true

View File

@@ -16,6 +16,7 @@ constant_angular_velocity = 0.0
friction = 1.0 friction = 1.0
bounce = 0.0 bounce = 0.0
script/script = ExtResource( 1 ) script/script = ExtResource( 1 )
rotation_speed_mult = 1
health = 100 health = 100
reload_time = 0.8 reload_time = 0.8

View File

@@ -6,6 +6,7 @@ var missile_scn = preload("res://scenes/missile.tscn")
var states = {"STATE_AIMING": StateAiming, "STATE_FIRING": StateFiring} var states = {"STATE_AIMING": StateAiming, "STATE_FIRING": StateFiring}
var cannon_rotation = 90 var cannon_rotation = 90
var cannon_rot_dir = 0 var cannon_rot_dir = 0
export var rotation_speed_mult = 1
export var health = 100 export var health = 100
export var reload_time = 0.8 export var reload_time = 0.8
@@ -14,6 +15,7 @@ signal state_change
func _ready(): func _ready():
set_state("STATE_AIMING") set_state("STATE_AIMING")
set_process_input(true) set_process_input(true)
set_fixed_process(true)
set_process(true) set_process(true)
local_health = health local_health = health
@@ -21,11 +23,11 @@ func _process(delta):
state.update(delta) state.update(delta)
func _fixed_process(delta): func _fixed_process(delta):
if state.has_method("fixed_update"): if state.has_method("fixed_process"):
state.fixed_process(delta) state.fixed_process(delta)
func _input(event): func _input(event):
print(event.type) print(cannon_rot_dir)
if state.has_method("input"): if state.has_method("input"):
state.input(event) state.input(event)
@@ -105,9 +107,9 @@ class StateAiming:
print("We fire") print("We fire")
base.set_state("STATE_FIRING") base.set_state("STATE_FIRING")
if event.is_action("ui_left") or event.is_action("J_left"): if event.is_action("ui_left") or event.is_action("J_left"):
base.cannon_rot_dir = 1 base.cannon_rot_dir = 1 * base.rotation_speed_mult
if event.is_action("ui_right") or event.is_action("J_right"): if event.is_action("ui_right") or event.is_action("J_right"):
base.cannon_rot_dir = -1 base.cannon_rot_dir = -1 * base.rotation_speed_mult
if event.is_action_released("ui_right") or event.is_action_released("ui_left") or event.is_action_released("J_right") or event.is_action_released("J_left"): if event.is_action_released("ui_right") or event.is_action_released("ui_left") or event.is_action_released("J_right") or event.is_action_released("J_left"):
base.cannon_rot_dir = 0 base.cannon_rot_dir = 0

View File

@@ -82,6 +82,7 @@ tracks/0/keys = {
script/source = "extends TextureButton script/source = "extends TextureButton
func _ready(): func _ready():
set_process_input(true)
if not game_manager.state == game_manager.STATE_STARTUP: on_button_clicked() if not game_manager.state == game_manager.STATE_STARTUP: on_button_clicked()
connect(\"button_down\", self, \"on_button_clicked\") connect(\"button_down\", self, \"on_button_clicked\")
var anim_player = get_node(\"AnimationPlayer\") var anim_player = get_node(\"AnimationPlayer\")
@@ -91,9 +92,12 @@ func _ready():
func anim_finished(): func anim_finished():
print(\"SETTING QTIME SACALE\") print(\"SETTING QTIME SACALE\")
OS.set_time_scale(0) OS.set_time_scale(0)
func on_button_clicked():
pass
func _input(event): func _input(event):
if(event.is_action_pressed(\"Coin\")): if event.is_action(\"Coin\") or event.is_action(\"Coin2\"):
OS.set_time_scale(1) OS.set_time_scale(1)
hide() hide()
" "
@@ -103,6 +107,7 @@ func _input(event):
[node name="Base" parent="." instance=ExtResource( 1 )] [node name="Base" parent="." instance=ExtResource( 1 )]
transform/pos = Vector2( 211, 240 ) transform/pos = Vector2( 211, 240 )
rotation_speed_mult = 1
[node name="Background" type="CanvasLayer" parent="."] [node name="Background" type="CanvasLayer" parent="."]