Added main menu among many things

This commit is contained in:
Paul Black 2022-03-17 15:13:55 -06:00
parent 75f93742dc
commit 34fed24f91
16 changed files with 628 additions and 6 deletions

26
Levels/Dead.gd Normal file
View file

@ -0,0 +1,26 @@
extends Control
# Declare member variables here. Examples:
# var a = 2
# var b = "text"
# 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):
# pass
func _on_Button_pressed():
Global.playerdead = 0
get_tree().change_scene(Global.beforedeathscene)
func _on_Button2_pressed():
Global.playerdead = 0
get_tree().change_scene("res://Levels/Main.tscn")

78
Levels/Dead.tscn Normal file
View file

@ -0,0 +1,78 @@
[gd_scene load_steps=5 format=2]
[ext_resource path="res://fonts/Born2bSportyV2.ttf" type="DynamicFontData" id=1]
[ext_resource path="res://Levels/Dead.gd" type="Script" id=2]
[sub_resource type="DynamicFont" id=1]
size = 144
font_data = ExtResource( 1 )
[sub_resource type="DynamicFont" id=2]
size = 92
font_data = ExtResource( 1 )
[node name="Dead" type="Control"]
anchor_right = 1.0
anchor_bottom = 1.0
script = ExtResource( 2 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="VBoxContainer" type="VBoxContainer" parent="."]
modulate = Color( 0.329412, 0.0470588, 0.0470588, 1 )
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
margin_left = -499.5
margin_top = -72.0
margin_right = 499.5
margin_bottom = 72.0
__meta__ = {
"_edit_use_anchors_": false,
"_editor_description_": ""
}
[node name="CenterContainer" type="CenterContainer" parent="VBoxContainer"]
margin_right = 999.0
margin_bottom = 144.0
[node name="Label" type="Label" parent="VBoxContainer/CenterContainer"]
margin_right = 999.0
margin_bottom = 144.0
custom_fonts/font = SubResource( 1 )
text = "You be dead bro :("
[node name="Button" type="Button" parent="."]
anchor_left = 0.5
anchor_top = 0.665
anchor_right = 0.5
anchor_bottom = 0.682
margin_left = -231.5
margin_top = -66.0
margin_right = 231.5
margin_bottom = 66.0
custom_fonts/font = SubResource( 2 )
text = "Retry Level"
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Button2" type="Button" parent="."]
anchor_left = 0.5
anchor_top = 0.801
anchor_right = 0.5
anchor_bottom = 0.823
margin_left = -231.5
margin_top = -32.0106
margin_right = 231.5
margin_bottom = 99.9894
custom_fonts/font = SubResource( 2 )
text = "Menu"
__meta__ = {
"_edit_use_anchors_": false
}
[connection signal="pressed" from="Button" to="." method="_on_Button_pressed"]
[connection signal="pressed" from="Button2" to="." method="_on_Button2_pressed"]

46
Levels/Main.tscn Normal file
View file

@ -0,0 +1,46 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://Levels/Menu.gd" type="Script" id=1]
[node name="Menu" type="Control"]
anchor_right = 1.0
anchor_bottom = 1.0
script = ExtResource( 1 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="VBoxContainer" type="VBoxContainer" parent="."]
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
margin_left = -31.0
margin_top = -34.0
margin_right = 32.0
margin_bottom = 34.0
rect_scale = Vector2( 2, 2 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="StartButton" type="Button" parent="VBoxContainer"]
margin_right = 63.0
margin_bottom = 20.0
text = "Play"
[node name="OptionsButton" type="Button" parent="VBoxContainer"]
margin_top = 24.0
margin_right = 63.0
margin_bottom = 44.0
text = "Options"
[node name="ExitButton" type="Button" parent="VBoxContainer"]
margin_top = 48.0
margin_right = 63.0
margin_bottom = 68.0
text = "Quit"
[connection signal="pressed" from="VBoxContainer/StartButton" to="." method="_on_StartButton_pressed"]
[connection signal="pressed" from="VBoxContainer/OptionsButton" to="." method="_on_OptionsButton_pressed"]
[connection signal="pressed" from="VBoxContainer/ExitButton" to="." method="_on_ExitButton_pressed"]

27
Levels/Menu.gd Normal file
View file

@ -0,0 +1,27 @@
extends Control
# Declare member variables here. Examples:
# var a = 2
# var b = "text"
# 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):
# pass
func _on_StartButton_pressed():
get_tree().change_scene("res://Levels/Level01.tscn")
func _on_OptionsButton_pressed():
get_tree().change_scene("res://Levels/Options.tscn")
func _on_ExitButton_pressed():
get_tree().quit()

20
Levels/Options.gd Normal file
View file

@ -0,0 +1,20 @@
extends Control
# Declare member variables here. Examples:
# var a = 2
# var b = "text"
# 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):
# pass
func _on_Button_pressed():
get_tree().change_scene("res://Levels/Main.tscn")

320
Levels/Options.tscn Normal file
View file

@ -0,0 +1,320 @@
[gd_scene load_steps=19 format=2]
[ext_resource path="res://fonts/Extrude.ttf" type="DynamicFontData" id=1]
[ext_resource path="res://fonts/Born2bSportyV2.ttf" type="DynamicFontData" id=2]
[ext_resource path="res://Levels/Options.gd" type="Script" id=3]
[sub_resource type="DynamicFont" id=1]
size = 222
font_data = ExtResource( 1 )
[sub_resource type="DynamicFont" id=2]
size = 118
font_data = ExtResource( 1 )
[sub_resource type="DynamicFont" id=3]
size = 73
font_data = ExtResource( 1 )
[sub_resource type="DynamicFont" id=4]
size = 43
font_data = ExtResource( 1 )
[sub_resource type="DynamicFont" id=5]
size = 37
font_data = ExtResource( 1 )
[sub_resource type="DynamicFont" id=6]
size = 35
font_data = ExtResource( 1 )
[sub_resource type="DynamicFont" id=7]
size = 35
font_data = ExtResource( 1 )
[sub_resource type="DynamicFont" id=8]
size = 73
font_data = ExtResource( 1 )
[sub_resource type="DynamicFont" id=9]
size = 40
font_data = ExtResource( 1 )
[sub_resource type="DynamicFont" id=10]
size = 35
font_data = ExtResource( 1 )
[sub_resource type="DynamicFont" id=11]
size = 37
font_data = ExtResource( 1 )
[sub_resource type="DynamicFont" id=12]
size = 33
font_data = ExtResource( 1 )
[sub_resource type="DynamicFont" id=13]
size = 50
font_data = ExtResource( 1 )
[sub_resource type="DynamicFont" id=14]
size = 50
font_data = ExtResource( 1 )
[sub_resource type="DynamicFont" id=15]
font_data = ExtResource( 2 )
[node name="Control" type="Control"]
anchor_right = 1.0
anchor_bottom = 1.0
script = ExtResource( 3 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="VBoxContainer" type="VBoxContainer" parent="."]
anchor_left = 0.5
anchor_right = 0.5
margin_left = -444.5
margin_top = 88.0
margin_right = 444.5
margin_bottom = 223.0
__meta__ = {
"_edit_use_anchors_": false
}
[node name="CenterContainer" type="CenterContainer" parent="VBoxContainer"]
margin_right = 889.0
margin_bottom = 223.0
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Label" type="Label" parent="VBoxContainer/CenterContainer"]
margin_right = 889.0
margin_bottom = 223.0
custom_fonts/font = SubResource( 1 )
text = "Options"
[node name="VBoxContainer2" type="VBoxContainer" parent="."]
anchor_left = 0.5
anchor_top = 0.324
anchor_right = 0.5
anchor_bottom = 0.324
margin_left = -291.0
margin_right = 291.0
margin_bottom = 367.0
__meta__ = {
"_edit_use_anchors_": false
}
[node name="CenterContainer2" type="CenterContainer" parent="VBoxContainer2"]
margin_right = 582.0
margin_bottom = 119.0
[node name="Label" type="Label" parent="VBoxContainer2/CenterContainer2"]
margin_right = 582.0
margin_bottom = 119.0
custom_fonts/font = SubResource( 2 )
text = "Controls"
[node name="VBoxContainer3" type="VBoxContainer" parent="."]
anchor_left = 0.344
anchor_top = 0.458
anchor_right = 0.5
anchor_bottom = 0.46
margin_left = -336.0
margin_right = 176.0
margin_bottom = 244.0
__meta__ = {
"_edit_use_anchors_": false
}
[node name="CenterContainer3" type="CenterContainer" parent="VBoxContainer3"]
margin_right = 811.0
margin_bottom = 74.0
[node name="Label" type="Label" parent="VBoxContainer3/CenterContainer3"]
margin_left = 229.0
margin_right = 581.0
margin_bottom = 74.0
custom_fonts/font = SubResource( 3 )
text = "Keyboard"
[node name="CenterContainer4" type="CenterContainer" parent="VBoxContainer3"]
margin_top = 78.0
margin_right = 811.0
margin_bottom = 122.0
[node name="Label" type="Label" parent="VBoxContainer3/CenterContainer4"]
margin_left = 280.0
margin_right = 531.0
margin_bottom = 44.0
custom_fonts/font = SubResource( 4 )
text = "W - Move Up"
[node name="CenterContainer5" type="CenterContainer" parent="VBoxContainer3"]
margin_top = 126.0
margin_right = 811.0
margin_bottom = 164.0
[node name="Label" type="Label" parent="VBoxContainer3/CenterContainer5"]
margin_left = 280.0
margin_right = 530.0
margin_bottom = 38.0
custom_fonts/font = SubResource( 5 )
text = "A - Move Left"
[node name="CenterContainer6" type="CenterContainer" parent="VBoxContainer3"]
margin_top = 168.0
margin_right = 811.0
margin_bottom = 204.0
[node name="Label" type="Label" parent="VBoxContainer3/CenterContainer6"]
margin_left = 279.0
margin_right = 531.0
margin_bottom = 36.0
custom_fonts/font = SubResource( 6 )
text = "S - Move Down"
[node name="CenterContainer7" type="CenterContainer" parent="VBoxContainer3"]
margin_top = 208.0
margin_right = 811.0
margin_bottom = 244.0
[node name="Label" type="Label" parent="VBoxContainer3/CenterContainer7"]
margin_left = 277.0
margin_right = 534.0
margin_bottom = 36.0
custom_fonts/font = SubResource( 7 )
text = "D - Move Right"
[node name="VBoxContainer4" type="VBoxContainer" parent="."]
anchor_left = 0.5
anchor_right = 0.5
margin_left = 57.0
margin_top = 660.0
margin_right = 157.5
margin_bottom = 92.0
__meta__ = {
"_edit_use_anchors_": false
}
[node name="CenterContainer" type="CenterContainer" parent="VBoxContainer4"]
margin_right = 347.0
margin_bottom = 74.0
[node name="Label" type="Label" parent="VBoxContainer4/CenterContainer"]
margin_left = 16.0
margin_right = 331.0
margin_bottom = 74.0
custom_fonts/font = SubResource( 8 )
text = "GamePad"
[node name="CenterContainer2" type="CenterContainer" parent="VBoxContainer4"]
margin_top = 78.0
margin_right = 347.0
margin_bottom = 118.0
[node name="Label" type="Label" parent="VBoxContainer4/CenterContainer2"]
margin_left = 46.0
margin_right = 300.0
margin_bottom = 40.0
custom_fonts/font = SubResource( 9 )
text = "Up - Move Up"
[node name="CenterContainer3" type="CenterContainer" parent="VBoxContainer4"]
margin_top = 122.0
margin_right = 347.0
margin_bottom = 158.0
[node name="Label" type="Label" parent="VBoxContainer4/CenterContainer3"]
margin_left = 25.0
margin_right = 321.0
margin_bottom = 36.0
custom_fonts/font = SubResource( 10 )
text = "Left - Move Left"
[node name="CenterContainer4" type="CenterContainer" parent="VBoxContainer4"]
margin_top = 162.0
margin_right = 347.0
margin_bottom = 200.0
[node name="Label" type="Label" parent="VBoxContainer4/CenterContainer4"]
margin_right = 347.0
margin_bottom = 38.0
custom_fonts/font = SubResource( 11 )
text = "Down - Move Down"
[node name="CenterContainer5" type="CenterContainer" parent="VBoxContainer4"]
margin_top = 204.0
margin_right = 347.0
margin_bottom = 238.0
[node name="Label" type="Label" parent="VBoxContainer4/CenterContainer5"]
margin_left = 15.0
margin_right = 331.0
margin_bottom = 34.0
custom_fonts/font = SubResource( 12 )
text = "Right - Move Right"
[node name="VBoxContainer5" type="VBoxContainer" parent="."]
anchor_left = 0.5
anchor_top = 0.324
anchor_right = 0.5
anchor_bottom = 0.324
margin_left = -291.0
margin_top = 646.0
margin_right = 291.0
margin_bottom = 117.0
__meta__ = {
"_edit_use_anchors_": false
}
[node name="CenterContainer" type="CenterContainer" parent="VBoxContainer5"]
margin_right = 582.0
margin_bottom = 119.0
[node name="Label" type="Label" parent="VBoxContainer5/CenterContainer"]
margin_left = 62.0
margin_right = 519.0
margin_bottom = 119.0
custom_fonts/font = SubResource( 2 )
text = "Credits"
[node name="CenterContainer2" type="CenterContainer" parent="VBoxContainer5"]
margin_top = 123.0
margin_right = 582.0
margin_bottom = 174.0
[node name="Label" type="Label" parent="VBoxContainer5/CenterContainer2"]
margin_left = 152.0
margin_right = 429.0
margin_bottom = 51.0
custom_fonts/font = SubResource( 13 )
text = "Paul Black"
[node name="CenterContainer3" type="CenterContainer" parent="VBoxContainer5"]
margin_top = 178.0
margin_right = 582.0
margin_bottom = 229.0
[node name="Label" type="Label" parent="VBoxContainer5/CenterContainer3"]
margin_left = 89.0
margin_right = 493.0
margin_bottom = 51.0
custom_fonts/font = SubResource( 14 )
text = "Noah Archuleta"
[node name="Button" type="Button" parent="."]
margin_left = 10.0
margin_top = 10.0
margin_right = 50.0
margin_bottom = 32.0
rect_scale = Vector2( 3, 3 )
custom_fonts/font = SubResource( 15 )
text = "Back"
__meta__ = {
"_edit_use_anchors_": false
}
[connection signal="pressed" from="Button" to="." method="_on_Button_pressed"]

View file

@ -42,7 +42,7 @@ func _ready():
func _physics_process(delta):
velocity = Vector3.ZERO
if ablewalk == 0:
if ablewalk == 1:
_walk_towards_player()
$CollisionShapeBottom.rotation.y = lerp_angle($CollisionShapeBottom.rotation.y, atan2(velocity.x, velocity.z), delta * angular_acceleration)
_look_at_player()
@ -60,12 +60,14 @@ func _bullet_fire():
func _walk_towards_player():
if player != null: # Makes sure player is not an empty variable (not equal to nill/null)
velocity = (player.transform.origin - transform.origin).normalized() * speed # make velocity direction equal to player direction
if Global.playerdead == 0:
velocity = (player.transform.origin - transform.origin).normalized() * speed # make velocity direction equal to player direction
velocity = move_and_slide(velocity) # Move AI towards player
func _look_at_player():
if player != null:
$CollisionShapeTop.look_at(Vector3(player.global_transform.origin.x, global_transform.origin.y, player.global_transform.origin.z), Vector3(0,1,0)) # Look at player
if Global.playerdead == 0:
$CollisionShapeTop.look_at(Vector3(player.global_transform.origin.x, global_transform.origin.y, player.global_transform.origin.z), Vector3(0,1,0)) # Look at player
func _walk_towards_player_timer():
walkingrandomnum.randomize()

View file

@ -18,6 +18,9 @@ func _physics_process(delta):
print ("Found Player Tank")
self.queue_free()
body.queue_free()
Global.playerdead = 1
Global.beforedeathscene = get_tree().current_scene.filename
get_tree().change_scene("res://Levels/Dead.tscn")
else:
if get_overlapping_bodies():
if body.has_node("TankAI"):

View file

@ -10,7 +10,6 @@ var angular_acceleration = 7 # How fast the player rotates
var velocity = Vector3.ZERO
func _physics_process(delta):
Global.player = self # Makes the player variable in the global script equal to self
var direction = Vector3.ZERO
### Input management
if Input.is_action_pressed("move_right"):

0
click/.gdignore Normal file
View file

35
click/icon.png.import Normal file
View file

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/icon.png-48fcc5e8ec849ca7ca2a3dab10f71f87.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://click/icon.png"
dest_files=[ "res://.import/icon.png-48fcc5e8ec849ca7ca2a3dab10f71f87.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
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

View file

@ -22,3 +22,68 @@ texture_format/s3tc=true
texture_format/etc=false
texture_format/etc2=false
texture_format/no_bptc_fallbacks=true
[preset.1]
name="Mac OSX"
platform="Mac OSX"
runnable=true
custom_features=""
export_filter="all_resources"
include_filter=""
exclude_filter=""
export_path="export/.dmg"
script_export_mode=1
script_encryption_key=""
[preset.1.options]
custom_template/debug=""
custom_template/release=""
application/name=""
application/info="Made with Godot Engine"
application/icon=""
application/identifier=""
application/signature=""
application/app_category="Games"
application/short_version="1.0"
application/version="1.0"
application/copyright=""
display/high_res=false
privacy/camera_usage_description=""
privacy/microphone_usage_description=""
codesign/enable=true
codesign/identity=""
codesign/timestamp=true
codesign/hardened_runtime=true
codesign/replace_existing_signature=true
codesign/entitlements/custom_file=""
codesign/entitlements/allow_jit_code_execution=false
codesign/entitlements/allow_unsigned_executable_memory=false
codesign/entitlements/allow_dyld_environment_variables=false
codesign/entitlements/disable_library_validation=false
codesign/entitlements/audio_input=false
codesign/entitlements/camera=false
codesign/entitlements/location=false
codesign/entitlements/address_book=false
codesign/entitlements/calendars=false
codesign/entitlements/photos_library=false
codesign/entitlements/apple_events=false
codesign/entitlements/debugging=false
codesign/entitlements/app_sandbox/enabled=false
codesign/entitlements/app_sandbox/network_server=false
codesign/entitlements/app_sandbox/network_client=false
codesign/entitlements/app_sandbox/device_usb=false
codesign/entitlements/app_sandbox/device_bluetooth=false
codesign/entitlements/app_sandbox/files_downloads=0
codesign/entitlements/app_sandbox/files_pictures=0
codesign/entitlements/app_sandbox/files_music=0
codesign/entitlements/app_sandbox/files_movies=0
codesign/custom_options=PoolStringArray( )
notarization/enable=false
notarization/apple_id_name=""
notarization/apple_id_password=""
notarization/apple_team_id=""
texture_format/s3tc=true
texture_format/etc=false
texture_format/etc2=false

BIN
fonts/Born2bSportyV2.ttf Normal file

Binary file not shown.

BIN
fonts/Extrude.ttf Normal file

Binary file not shown.

View file

@ -1,3 +1,4 @@
extends Node
var player
var playerdead = 0
var beforedeathscene

View file

@ -21,7 +21,7 @@ _global_script_class_icons={
[application]
config/name="Tank Blaster"
run/main_scene="res://Levels/Level01.tscn"
run/main_scene="res://Levels/Main.tscn"
boot_splash/image="res://2D Art/Splash Screen/Tank Blaster Splash.png"
config/icon="res://icon.png"