public override void _Ready() { DownloadShareware.Main(new string[] { Folder }); Assets = new Assets(Folder); VisualServer.SetDefaultClearColor(new Color(Assets.BackgroundColor)); Level level = new Level() { Assets = Assets, Map = Assets.Maps[0], }; AddChild(level); AddChild(new Label() { Text = "Dopefish lives!", Theme = new Theme() { DefaultFont = Assets.Fonts[0], }, }); }
public override void _Ready() { VisualServer.SetDefaultClearColor(Color.Color8(0, 0, 0, 255)); Camera camera = new Camera() { Current = true, }; camera.SetScript(ResourceLoader.Load("res://maujoe.camera_control/camera_control.gd") as GDScript); AddChild(camera); AddChild(new WorldEnvironment() { Environment = new Godot.Environment() { BackgroundColor = Color.Color8(85, 85, 85, 255), BackgroundMode = Godot.Environment.BGMode.Color, }, }); AddChild(DosScreen = new DosScreen() { GlobalTransform = new Transform(Basis.Identity, new Vector3(0, 0, -2)), }); }
public override void _Ready() { // Base default clear color VisualServer.SetDefaultClearColor(DefaultClearColor); background = GetNode <ColorRect>("Background"); launcherUI = GetNode <VBoxContainer>("Margin/VBox"); backButton = GetNode <Button>("Margin/BackButton"); examplesButton = GetNode <Button>("Margin/VBox/Margin/Buttons/ExamplesButton"); ecosystemButton = GetNode <Button>("Margin/VBox/Margin/Buttons/EcosystemButton"); quitButton = GetNode <Button>("Margin/VBox/Margin/Buttons/QuitButton"); links = GetNode <RichTextLabel>("Margin/VBox/Margin/Links"); drawSpace = GetNode <Control>("DrawSpace"); fpsLabel = GetNode <Label>("Margin/FPS"); versionLabel = GetNode <Label>("Margin/Version"); examplesButton.Connect("pressed", this, nameof(LoadSceneExplorer)); ecosystemButton.Connect("pressed", this, nameof(LoadEcosystem)); quitButton.Connect("pressed", this, nameof(Quit)); backButton.Connect("pressed", this, nameof(ReloadLauncher)); links.Connect("meta_clicked", this, nameof(LinkClicked)); // Set version versionLabel.Text = "Version " + VERSION; if (OS.GetName() == "HTML5") { quitButton.Hide(); } ToggleBackUI(false); }
public override void _Ready() { _originalOffset = Offset; _colorRect = GetNode <ColorRect>("HitEffectLayer/ColorRect"); _tween = GetNode <Tween>("HitEffectLayer/Tween"); _camera = this; VisualServer.SetDefaultClearColor(new Color(15f / 255f, 15f / 255f, 15f / 255f, 1f)); }
public override void _Ready() { this.level_select_scene = ResourceLoader.Load <PackedScene>("res://knytt/ui/LevelSelection.tscn"); this.settings_scene = ResourceLoader.Load <PackedScene>("res://knytt/ui/SettingsScreen.tscn"); fade = GetNode <FadeLayer>("MenuLayer/Fade"); GetNode <HBoxContainer>("MenuLayer/ButtonRow").GrabFocus(); VisualServer.SetDefaultClearColor(new Color(0, 0, 0)); }
public override void _Ready() { VisualServer.SetDefaultClearColor(Color.Color8(0, 0, 0, 255)); AddChild(ARVROrigin = new ARVROrigin()); ARVROrigin.AddChild(ARVRCamera = new ARVRCamera() { Current = true, }); ARVROrigin.AddChild(LeftController = new ARVRController() { ControllerId = 1, }); LeftController.AddChild(GD.Load <PackedScene>("res://OQ_Toolkit/OQ_ARVRController/models3d/OculusQuestTouchController_Left.gltf").Instance()); ARVROrigin.AddChild(RightController = new ARVRController() { ControllerId = 2, }); RightController.AddChild(GD.Load <PackedScene>("res://OQ_Toolkit/OQ_ARVRController/models3d/OculusQuestTouchController_Right.gltf").Instance()); AddChild(new WorldEnvironment() { Environment = new Godot.Environment() { BackgroundColor = Color.Color8(0, 0, 0, 255), BackgroundMode = Godot.Environment.BGMode.Color, }, }); AddChild(DosScreen = new DosScreen() { GlobalTransform = new Transform(Basis.Identity, new Vector3(0, 0, -2)), }); DosScreen.Screen.WriteLine("Platform detected: " + OS.GetName()); switch (OS.GetName()) { case "Android": Path = "/storage/emulated/0/"; ARVRInterface = ARVRServer.FindInterface("OVRMobile"); State = PermissionsGranted ? LoadingState.DOWNLOAD_SHAREWARE : LoadingState.ASK_PERMISSION; break; default: ARVRInterface = ARVRServer.FindInterface("OpenVR"); State = LoadingState.DOWNLOAD_SHAREWARE; break; } if (ARVRInterface != null && ARVRInterface.Initialize()) { GetViewport().Arvr = true; } LeftController.Connect("button_pressed", this, nameof(ButtonPressed)); RightController.Connect("button_pressed", this, nameof(ButtonPressed)); }
public override void _Ready() { viewUtils = new ViewportUtils(GetViewport()); viewUtils.OnViewportResize += new ViewportUtils.OnViewportResizeDelegate(OnViewportResize); table = new Table(viewUtils, Piles); deck = new Deck(viewUtils, Cards); cardPositions = new CardPositions(viewUtils); VisualServer.SetDefaultClearColor(BackgroundColor); }
public override void _Ready() { fadeAnimationPlayer = GetNode <AnimationPlayer>("FadeAnimationPlayer"); Instance = this; Viewport root = GetTree().Root; CurrentScene = root.GetChild(root.GetChildCount() - 1); FadeIn(); VisualServer.SetDefaultClearColor(Color.Color8(0, 0, 0, 255)); }
public override void _Ready() { _noise = new OpenSimplexNoise(); _noise.Seed = (int)Main.RNG.Randi(); _noise.Octaves = 4; _noise.Period = .2f; VisualServer.SetDefaultClearColor(_clearColor); GameEventDispatcher.Instance.Connect(nameof(GameEventDispatcher.WeaponFired), this, nameof(OnWeaponFired)); GameEventDispatcher.Instance.Connect(nameof(GameEventDispatcher.EnemyStruck), this, nameof(OnEnemyStruck)); GameEventDispatcher.Instance.Connect(nameof(GameEventDispatcher.CameraShaken), this, nameof(OnCameraShaken)); }
public void LoadTheme(Resource themeSet) { VisualServer.SetDefaultClearColor((Color)themeSet.Get("background_color")); Array themeables = GetTree().GetNodesInGroup(Groups.Themeable); foreach (Node node in themeables) { if (node is IThemeable themeable) { themeable.UpdateTheme(themeSet); } } EmitSignal(nameof(ThemeSetChanged), themeSet); }
public override void _Ready() { VisualServer.SetDefaultClearColor(BackgroundColor); AddChild(new WorldEnvironment() { Environment = new Godot.Environment() { BackgroundColor = BackgroundColor, BackgroundMode = Godot.Environment.BGMode.Color, }, }); AddChild(ARVROrigin = new ARVROrigin()); ARVROrigin.AddChild(ARVRCamera = new ARVRCamera() { Current = true, }); ARVROrigin.AddChild(LeftController = new ARVRController() { ControllerId = 1, }); ARVROrigin.AddChild(RightController = new ARVRController() { ControllerId = 2, }); LeftController.AddChild((Spatial)GD.Load <PackedScene>("res://OQ_Toolkit/OQ_ARVRController/models3d/OculusQuestTouchController_Left.gltf").Instance()); RightController.AddChild((Spatial)GD.Load <PackedScene>("res://OQ_Toolkit/OQ_ARVRController/models3d/OculusQuestTouchController_Right.gltf").Instance()); ARVRInterface = ARVRServer.FindInterface(OS.GetName().Equals("Android") ? "OVRMobile" : "OpenVR"); if (ARVRInterface != null && ARVRInterface.Initialize()) { GetViewport().Arvr = true; } AddChild(VirtualScreen = new VirtualScreen() { Transform = new Transform(Basis.Identity, new Vector3(0f, VirtualScreen.Height / 2f, -1f)), }); AddChild(Line3D = new Line3D() { Color = Color.Color8(255, 0, 0, 255), }); AddChild(Cube); }
public override void _Ready() { VisualServer.SetDefaultClearColor(new Color(color_background)); ui_controller = GetNode <ui_game_controller>("ui_game_controller"); }
public override void _Ready() { VisualServer.SetDefaultClearColor(new Color(background_color_name)); }
public override void _Ready() { play_area.Clear(); VisualServer.SetDefaultClearColor(Colors.Black); HashSet <int2> rocks = new HashSet <int2>(); int2 start = new int2(); play_area.Add(start); rocks.Add(start); int loop = 0; while (loop < 4)// && loop < 100) { //loop++; switch (Rand.Int(3)) { case 0: start.x += 1; break; case 1: start.x -= 1; break; default: start.y += 1; break; } if (!play_area.Contains(start)) { play_area.Add(start); rocks.Add(start); } if (start.y == 100) { loop++; start = new int2(); } } int minX = 0, maxX = 0; foreach (var position in play_area) { for (int x = position.x - 5; x < position.x + 6; ++x) { for (int y = position.y - 1; y < position.y + 2; ++y) { if (x < minX) { minX = x; } if (x > maxX) { maxX = x; } if (rocks.Contains(new int2(x, y))) { continue; } rocks.Add(new int2(x, y)); if (y > 100) { continue; } var wall = Corals.Wall_Prefabs.GetRandom()(); wall.GlobalPosition = new Vector2(x, y) * block_width; wall.ZIndex += 10; } } } List <int2> caves = new List <int2>(), sides = new List <int2>(), open_areas = new List <int2>(), grounded = new List <int2>(); foreach (var position in play_area) { int obstruction_count = 0; int cave_count = 0; int side_count = 0; bool is_grounded = false; for (int x = position.x - 1; x < position.x + 2; ++x) { for (int y = position.y - 1; y < position.y + 2; ++y) { if (y >= 100) { continue; } bool obstructed = !play_area.Contains(new int2(x, y)); if (obstructed) { obstruction_count++; if (y == position.y + 1 && x == position.x) { is_grounded = true; } if (y == position.y || x == position.x) { cave_count++; } if (y == position.x) { side_count++; } } } } if (is_grounded) { grounded.Add(position); } if (position.y < 5) { continue; } if (obstruction_count == 0) { open_areas.Add(position); } if (side_count == 0) { sides.Add(position); } if (cave_count == 3 && is_grounded) { caves.Add(position); } } spawn_puffers(grounded); spawn_spikes(grounded); spawn_sharks(open_areas, play_area); spawn_corpses(caves, play_area); spawn_edge_boundaries(minX, maxX); spawn_weeds(grounded); }
private void _UpdateBackgroundHue() { VisualServer.SetDefaultClearColor(Color.FromHsv(backgroundHue, 0.4f, 1f)); backgroundHue += 0.0001f * (float)Math.Pow(BackendInstance.Game.CurrentLevel, 3); }
void LoadLevel (int number) { currentLevel = number; //GODOT: how on earth do I load a text file? //var resource = GD.Load($"res://Levels/{number}.txt"); //this took 30mins to figure out. every operation is different than the //C# BCL version and the docs are not helpful var f = new File(); f.Open($"res://Levels/{number}.txt", (int)File.ModeFlags.Read); var lines = new System.Collections.Generic.List<string>(); while(!f.EofReached()) { lines.Add(f.GetLine()); } //var lines = System.IO.File.ReadAllLines(System.IO.Path.Combine("Levels", $"{number}.txt")); var boardDef = lines[0].Split('|'); int boardSize = int.Parse(boardDef[0]); if (boardDef.Length == 6) { TileColor = new Color(boardDef[1]); if (string.IsNullOrEmpty(boardDef[2])) { StaticTileColor = TileColor.Darkened(0.2f); } else { StaticTileColor = new Color(boardDef[2]); } BoardColor = new Color(boardDef[3]); if (string.IsNullOrEmpty(boardDef[4])) { BackgroundColor = Colors.Black; } else { BackgroundColor = new Color(boardDef[4]); } LineHighlightColor = new Color(boardDef[5]); } else { TileColor = new Color("e017c2"); StaticTileColor = TileColor.Darkened(0.2f); BoardColor = new Color("bdf0ec"); BackgroundColor = Colors.Black; LineHighlightColor = Colors.Yellow; } VisualServer.SetDefaultClearColor(BackgroundColor); CreateLevel(boardSize); for (int i = 1; i < lines.Count; i++) { var line = lines[i]; if (string.IsNullOrWhiteSpace(line)) { continue; } int commaIdx = line.IndexOf(','); int q = int.Parse(line.Substring(0,commaIdx)); var pipeIdx = line.IndexOf('|'); int r = int.Parse(line.Substring(commaIdx + 1, pipeIdx - commaIdx - 1)); int[] desc = new int[6]; for (int j = 0; j < 6; j++) { desc[j] = line[pipeIdx+ 1+j] - '0'; } //offset due to the map we're using to figure out positions int offset = Math.Max(0, 4 - boardSize); var coord = new HexCoord(q, r - offset); var tile = new PuzzleTileHex { LineDescriptions = desc, Position = coord.Position() }; tile.IsStatic = true; map.SetCell(new CellInfo(coord, tile)); board.AddChild(tile); tile.CalculatePaths(this, coord); } var c = TileColor; c.a = 0.6f; hexCursor.Modulate = c; Rescale(); }