Added random background on _ready()
This commit is contained in:
		
							
								
								
									
										10
									
								
								Main_menu.gd
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								Main_menu.gd
									
									
									
									
									
								
							| @ -48,6 +48,16 @@ func _process(_delta): | ||||
|  | ||||
| # When everything is loaded, | ||||
| func _ready(): | ||||
| 	# Randomize | ||||
| 	var random = RandomNumberGenerator.new() | ||||
| 	random.randomize() | ||||
| 	 | ||||
| 	# Choose a background | ||||
| 	var background_num = random.randi_range(1, 2) | ||||
| 	 | ||||
| 	# Set the background | ||||
| 	$Background.texture = load("res://textures/backgrounds/background"+str(background_num)+".png") | ||||
| 	 | ||||
| 	# Determine the os_name | ||||
| 	if OS.get_name() == "X11": # X11 is linuxy-based | ||||
| 		os_name = "linux" | ||||
|  | ||||
| @ -1,6 +1,6 @@ | ||||
| [gd_scene load_steps=13 format=2] | ||||
|  | ||||
| [ext_resource path="res://textures/backgrounds/background1.png" type="Texture" id=1] | ||||
| [ext_resource path="res://textures/backgrounds/background2.png" type="Texture" id=1] | ||||
| [ext_resource path="res://fonts/SPACEBAR.ttf" type="DynamicFontData" id=2] | ||||
| [ext_resource path="res://Main_menu.gd" type="Script" id=3] | ||||
| [ext_resource path="res://fonts/Title-font.tres" type="DynamicFont" id=4] | ||||
| @ -50,7 +50,7 @@ margin_bottom = 1501.0 | ||||
| rect_scale = Vector2( 0.512202, 0.399751 ) | ||||
| texture = ExtResource( 1 ) | ||||
| expand = true | ||||
| stretch_mode = 1 | ||||
| stretch_mode = 7 | ||||
|  | ||||
| [node name="Header" type="Label" parent="."] | ||||
| anchor_right = 1.0 | ||||
|  | ||||
		Reference in New Issue
	
	Block a user