diff --git a/art/cosmonaut.png b/art/cosmonaut.png new file mode 100644 index 0000000..17fa065 Binary files /dev/null and b/art/cosmonaut.png differ diff --git a/art/rocket.png b/art/rocket.png index f0d50fe..af6e5d6 100644 Binary files a/art/rocket.png and b/art/rocket.png differ diff --git a/art/skull.png b/art/skull.png index 6a4bd34..402d7c3 100644 Binary files a/art/skull.png and b/art/skull.png differ diff --git a/game/gui/hud/timelabel.gd b/game/gui/hud/timelabel.gd index 7905f02..205afe1 100644 --- a/game/gui/hud/timelabel.gd +++ b/game/gui/hud/timelabel.gd @@ -13,4 +13,4 @@ func _ready(): func _process(delta): time += delta - set_text(str(time)) + set_text("Time: %8.2f" % time) diff --git a/game/gui/menu/Menu.tscn b/game/gui/menu/Menu.tscn index a63a243..c254c3e 100644 --- a/game/gui/menu/Menu.tscn +++ b/game/gui/menu/Menu.tscn @@ -131,16 +131,17 @@ autoplay = "move" [node name="Label" type="Label" parent="."] -rect/scale = Vector2( 5, 5 ) +rect/scale = Vector2( 4, 4 ) focus/ignore_mouse = true focus/stop_mouse = true size_flags/horizontal = 2 size_flags/vertical = 0 -margin/left = 50.0 +margin/left = 26.0 margin/top = 30.0 -margin/right = 188.0 -margin/bottom = 44.0 -text = "Monero Moon Launch" +margin/right = 213.0 +margin/bottom = 54.0 +custom_fonts/font = ExtResource( 3 ) +text = "Wownero Moon Launch" percent_visible = 1.0 lines_skipped = 0 max_lines_visible = -1 diff --git a/game/levels/1/Level1.tscn b/game/levels/1/Level1.tscn index 7756b2c..6328fc1 100644 --- a/game/levels/1/Level1.tscn +++ b/game/levels/1/Level1.tscn @@ -1,12 +1,13 @@ -[gd_scene load_steps=9 format=1] +[gd_scene load_steps=10 format=1] [ext_resource path="res://game/levels/1/Level1.gd" type="Script" id=1] [ext_resource path="res://fonts/computerspeakfont.fnt" type="BitmapFont" id=2] [ext_resource path="res://game/gui/hud/timelabel.gd" type="Script" id=3] -[ext_resource path="res://art/sun.jpg" type="Texture" id=4] -[ext_resource path="res://game/earth/Earth.tscn" type="PackedScene" id=5] -[ext_resource path="res://game/rocket/Rocket.tscn" type="PackedScene" id=6] +[ext_resource path="res://velocitylabel.gd" type="Script" id=4] +[ext_resource path="res://art/sun.jpg" type="Texture" id=5] +[ext_resource path="res://game/earth/Earth.tscn" type="PackedScene" id=6] [ext_resource path="res://game/moon/Moon.tscn" type="PackedScene" id=7] +[ext_resource path="res://game/rocket/Rocket.tscn" type="PackedScene" id=8] [sub_resource type="ImageTexture" id=1] @@ -29,15 +30,14 @@ scale = Vector2( 1, 1 ) [node name="TimeLabel" type="Label" parent="CanvasLayer"] -rect/scale = Vector2( 2, 2 ) focus/ignore_mouse = true focus/stop_mouse = true size_flags/horizontal = 2 size_flags/vertical = 0 -margin/left = 1750.0 -margin/top = 1000.0 -margin/right = 1790.0 -margin/bottom = 1024.0 +margin/left = 600.0 +margin/top = 500.0 +margin/right = 640.0 +margin/bottom = 524.0 custom_fonts/font = ExtResource( 2 ) custom_colors/font_color = Color( 1, 1, 1, 1 ) custom_colors/font_color_shadow = Color( 0.367188, 0.367188, 0.367188, 1 ) @@ -46,6 +46,22 @@ lines_skipped = 0 max_lines_visible = -1 script/script = ExtResource( 3 ) +[node name="VelocityLabel" type="Label" parent="CanvasLayer"] + +focus/ignore_mouse = true +focus/stop_mouse = true +size_flags/horizontal = 2 +size_flags/vertical = 0 +margin/left = 600.0 +margin/top = 450.0 +margin/right = 640.0 +margin/bottom = 464.0 +custom_fonts/font = ExtResource( 2 ) +percent_visible = 1.0 +lines_skipped = 0 +max_lines_visible = -1 +script/script = ExtResource( 4 ) + [node name="ParallaxBackground" type="ParallaxBackground" parent="."] layer = -1 @@ -80,21 +96,22 @@ motion/mirroring = Vector2( 0, 0 ) [node name="Sun" type="Sprite" parent="ParallaxBackground/SunParallax"] -transform/pos = Vector2( 550.787, 1053.52 ) +transform/pos = Vector2( 95.5348, 20.8754 ) transform/scale = Vector2( 0.181912, 0.181912 ) -texture = ExtResource( 4 ) +texture = ExtResource( 5 ) -[node name="Earth" parent="." instance=ExtResource( 5 )] +[node name="Earth" parent="." instance=ExtResource( 6 )] -transform/pos = Vector2( 118.524, 868.706 ) - -[node name="Rocket" parent="." instance=ExtResource( 6 )] - -transform/pos = Vector2( 213.8, 843.193 ) -transform/rot = 290.0 +transform/pos = Vector2( 303.927, 329.078 ) [node name="Moon" parent="." instance=ExtResource( 7 )] -transform/pos = Vector2( 507.748, 533.687 ) +transform/pos = Vector2( 693.151, -5.9408 ) + +[node name="Rocket" parent="." instance=ExtResource( 8 )] + +transform/pos = Vector2( 399.203, 303.565 ) +transform/rot = -70.0 +transform/scale = Vector2( 1, 1 ) diff --git a/game/rocket/Rocket.tscn b/game/rocket/Rocket.tscn index 42ddb21..fcdfbc6 100644 --- a/game/rocket/Rocket.tscn +++ b/game/rocket/Rocket.tscn @@ -1,12 +1,13 @@ -[gd_scene load_steps=11 format=1] +[gd_scene load_steps=13 format=1] [ext_resource path="res://game/rocket/rocket.gd" type="Script" id=1] [ext_resource path="res://art/rocket.png" type="Texture" id=2] [ext_resource path="res://game/rocket/DebugDraw.tscn" type="PackedScene" id=3] [ext_resource path="res://art/skull.png" type="Texture" id=4] [ext_resource path="res://art/explosjon3.png" type="Texture" id=5] +[ext_resource path="res://art/cosmonaut.png" type="Texture" id=6] -[sub_resource type="ConvexPolygonShape2D" id=7] +[sub_resource type="ConvexPolygonShape2D" id=1] custom_solver_bias = 0.0 points = Vector2Array( -4.89815, 0.875571, -5.36714, -2.00446, -3.67879, -4.03967, -0.302076, -5.69089, 2.23045, -4.30848, 4.01261, -2.27326, 4.2002, 0.721969, 2.69944, 4.4852, -3.39739, 4.4852 ) @@ -16,9 +17,13 @@ points = Vector2Array( -4.89815, 0.875571, -5.36714, -2.00446, -3.67879, -4.0396 offsets = FloatArray( 0, 0.502924, 0.994152 ) colors = ColorArray( 0.992188, 1, 0, 1, 0.90625, 0.390511, 0.0141602, 1, 0.90625, 0.0106201, 0.0106201, 1 ) -[sub_resource type="Animation" id=3] +[sub_resource type="ColorRamp" id=3] + +offsets = FloatArray( 0, 1 ) +colors = ColorArray( 0, 0, 0, 1, 0.0656281, 0.988281, 0.253042, 1 ) + +[sub_resource type="Animation" id=4] -resource/name = "explode" length = 1.5 loop = false step = 0.1 @@ -46,7 +51,7 @@ points = Vector2Array( 3.80623, 13.3545, 4.77682, 19.1781, -4.72856, 19.2484, -3 [node name="Rocket" type="RigidBody2D"] input/pickable = false -shapes/0/shape = SubResource( 7 ) +shapes/0/shape = SubResource( 1 ) shapes/0/transform = Matrix32( 1.51812, 0, 0, 3.70819, 0.571488, 1.47728 ) shapes/0/trigger = false collision/layers = 1 @@ -71,10 +76,10 @@ __meta__ = { "_edit_group_": true } -[node name="Particles2D" type="Particles2D" parent="."] +[node name="RearThrust" type="Particles2D" parent="."] config/amount = 200 -config/lifetime = 1.2 +config/lifetime = 1.0 config/process_mode = 1 config/offset = Vector2( 0, 10 ) params/direction = 0.0 @@ -96,6 +101,32 @@ params/anim_initial_pos = 0.0 randomness/final_size = 1.0 color/color_ramp = SubResource( 2 ) +[node name="RevThrust" type="Particles2D" parent="."] + +config/amount = 200 +config/lifetime = 1.0 +config/process_mode = 1 +config/offset = Vector2( 0, 10 ) +params/direction = 180.0 +params/spread = 30.0 +params/linear_velocity = 45.0 +params/spin_velocity = 0.0 +params/orbit_velocity = 0.0 +params/gravity_direction = 0.0 +params/gravity_strength = 9.8 +params/radial_accel = 0.0 +params/tangential_accel = 0.0 +params/damping = 0.0 +params/initial_angle = 0.0 +params/initial_size = 1.0 +params/final_size = 1.17 +params/hue_variation = 2.0 +params/anim_speed_scale = 1.0 +params/anim_initial_pos = 0.0 +randomness/final_size = 1.0 +color/color = Color( 0, 0.914062, 0.121399, 1 ) +color/color_ramp = SubResource( 3 ) + [node name="RocketSprite" type="Sprite" parent="."] transform/scale = Vector2( 0.05, 0.05 ) @@ -164,7 +195,7 @@ hframes = 4 playback/process_mode = 1 playback/default_blend_time = 0.0 root/root = NodePath("..") -anims/explode = SubResource( 3 ) +anims/explode = SubResource( 4 ) playback/active = true playback/speed = 1.0 blend_times = [ ] @@ -206,4 +237,9 @@ polygon = Vector2Array( -3.63505, 13.3545, -4.72856, 19.2484, 4.77682, 19.1781, shape_range = Vector2( 0, 0 ) trigger = false +[node name="CosmonautSprite" type="Sprite" parent="."] + +transform/scale = Vector2( 0.05, 0.05 ) +texture = ExtResource( 6 ) + diff --git a/game/rocket/rocket.gd b/game/rocket/rocket.gd index f07de42..487dd83 100644 --- a/game/rocket/rocket.gd +++ b/game/rocket/rocket.gd @@ -1,34 +1,54 @@ extends RigidBody2D +# Ship control variables var thrust = Vector2(0, 350) var torque = 5000 var shipoverlaps var footoverlaps +var crashspeed = 100 +var landingspeed = 40 +# Timer variables var deathtimer +var moontimer +# Mission variables +var moonlandstart = false +var flagplaced = false + func _ready(): - #pass + # Turn on processes and monitors set_process(true) set_contact_monitor(true) set_max_contacts_reported(3) + # Setup sprites get_node("SkullSprite").hide() get_node("ExplosionSprite").hide() + get_node("CosmonautSprite").hide() + # Initialize timers deathtimer = Timer.new() deathtimer.set_wait_time(3) deathtimer.set_one_shot(true) deathtimer.connect("timeout", self, "switchtomenu") add_child(deathtimer) + moontimer = Timer.new() + moontimer.set_wait_time(1) + moontimer.set_one_shot(true) + moontimer.connect("timeout", self, "flagplanted") + add_child(moontimer) func _integrate_forces(state): if Input.is_action_pressed("thrust"): set_applied_force(state.get_total_gravity() - thrust.rotated(get_rot())) - get_node("Particles2D").show() + get_node("RearThrust").show() + get_node("RevThrust").hide() elif Input.is_action_pressed("revthrust"): set_applied_force(state.get_total_gravity() + thrust.rotated(get_rot())) - get_node("Particles2D").hide() + get_node("RearThrust").hide() + get_node("RevThrust").show() else: set_applied_force(state.get_total_gravity() + Vector2()) - get_node("Particles2D").hide() + get_node("RearThrust").hide() + get_node("RevThrust").hide() var t = Input.is_action_pressed("bear_right") - Input.is_action_pressed("bear_left") set_applied_torque(torque * t) @@ -38,26 +58,42 @@ func _process(delta): footoverlaps = get_node("FootArea").get_overlapping_bodies() if (shipoverlaps.size() > 1): print("Ship overlaps") - get_node("SkullSprite").show() get_node("RocketSprite").hide() death() else: get_node("SkullSprite").hide() for i in footoverlaps: - if (get_linear_velocity().length() > 30 and i.get_name() != "Rocket"): + if (get_linear_velocity().length() > crashspeed and i.get_name() != "Rocket"): death() - if(i.get_name() == "Moon"): - get_node("SkullSprite").show() + if(i.get_name() == "Moon" and get_linear_velocity().length() < landingspeed and flagplaced == false): + print("LANDED!") + moonland() + func death(): - set_process(false) get_node("ExplosionSprite").show() get_node("ExplosionSprite").get_node("AnimationPlayer").play("explode") + get_node("SkullSprite").show() + set_process(false) deathtimer.set_active(true) deathtimer.start() #while(deathtimer.get_wait_time() > 0.1): print(deathtimer.get_wait_time()) +func moonland(): + print("START MOONLAND") + set_process(false) + moontimer.set_active(true) + moonlandstart = true + get_tree().get_root().set_disable_input(true) + moontimer.start() + +func flagplanted(): + flagplaced = true + print("FLAG PLACED") + get_tree().get_root().set_disable_input(false) + get_node("CosmonautSprite").show() + set_process(true) func switchtomenu(): get_tree().change_scene("res://game/gui/menu/Menu.tscn") diff --git a/velocitylabel.gd b/velocitylabel.gd new file mode 100644 index 0000000..cb0d90b --- /dev/null +++ b/velocitylabel.gd @@ -0,0 +1,17 @@ +extends Label + +# class member variables go here, for example: +# var a = 2 +# var b = "textvar" +var velocity = 0.0 + +func _ready(): + # Called every time the node is added to the scene. + # Initialization here + set_process(true) + +func _process(delta): + # velocity = get_node("res://game/rocket/Rocket.tscn").get_linear_velocity() + velocity = get_node("../../Rocket").get_linear_velocity().length() + #print(velocity) + set_text("Velocity: %8.2f" % velocity)