protected virtual void LoseFocus(object sender, EventArgs args) { if (UseFocusFormatting) { Color = lastColor; TextBoard.SetFormatting(TextBoard.Format.WithColor(lastTextColor)); } }
/// <summary> /// Removes the text currently highlighted from the textbox. /// </summary> private void DeleteSelection() { if (!selectionBox.Empty) { TextBoard.RemoveRange(selectionBox.Start, selectionBox.End); selectionBox.ClearSelection(); } }
public Transit(int score) { _score = score; blackF = new Sprite("blackpng.png"); blackF.alpha = 0.8f; AddChild(blackF); scoreBroad = new TextBoard(600, 400); scoreBroad.x += game.width / 2f - 300; scoreBroad.y += game.height / 2f - 250; AddChild(scoreBroad); }
/// <summary> /// Removes the character immediately preceeding the caret. /// </summary> private void RemoveLastChar() { if (TextBoard.Count > 0 && TextBoard[caret.Index.X].Count > 0) { DeleteSelection(); if (caret.Index.Y >= 0) { TextBoard.RemoveAt(ClampIndex(caret.Index)); } caret.Move(new Vector2I(0, -1)); } }
protected override void CursorEnter(object sender, EventArgs args) { if (HighlightEnabled) { if (!(UseFocusFormatting && MouseInput.HasFocus)) { lastColor = Color; lastTextColor = TextBoard.Format.Color; } TextBoard.SetFormatting(TextBoard.Format.WithColor(lastTextColor)); Color = HighlightColor; } }
protected virtual void GainFocus(object sender, EventArgs args) { if (UseFocusFormatting) { if (!MouseInput.IsMousedOver) { lastColor = Color; lastTextColor = TextBoard.Format.Color; } Color = FocusColor; TextBoard.SetFormatting(TextBoard.Format.WithColor(FocusTextColor)); } }
protected override void CursorExit(object sender, EventArgs args) { if (HighlightEnabled) { if (UseFocusFormatting && MouseInput.HasFocus) { Color = FocusColor; TextBoard.SetFormatting(TextBoard.Format.WithColor(FocusTextColor)); } else { Color = lastColor; TextBoard.SetFormatting(TextBoard.Format.WithColor(lastTextColor)); } } }
// Use this for initialization void Start() { State = transform.FindChild("GameState").GetComponent <GameState>(); Enemys = GameObject.Find("Enemys"); Cannon = GameObject.Find("Cannon"); Bullets = GameObject.Find("Bullets"); Barrel = Cannon.transform.FindChild("Barrel").gameObject; TextBorad = GameObject.Find("TextBoard").GetComponent <TextBoard>(); MousePos = new Vector3(); SetGameState(GameState.STAT_START); gameObject.AddComponent <StageView>(); }
/// <summary> /// Inserts the given character to the right of the caret. /// </summary> private void AddChar(char ch) { DeleteSelection(); TextBoard.Insert(ch, caret.Index + new Vector2I(0, 1)); caret.Move(new Vector2I(0, 1)); }
public Level(int numberOfLevel, float pSoundVolume) : base() { levelSound = new Sound("level_music_v2.mp3", true, true); soundChannel = levelSound.Play(); soundChannel.Volume = pSoundVolume; _cursorIMG = new Sprite("HUD/cursor_PNG50.png"); scoreBoard = new Sprite("HUD/score_board.png"); fon = new Sprite("Level background hazy.png"); fonblack = new Sprite("blackpng.png"); AddChild(fon); level = numberOfLevel; thatlevel = this; magwf = new Sprite("magnet.png"); trampwf = new Sprite("trampoline.png"); shlfwf = new Sprite("shelfBig.png"); levelC = new LevelChanger("bucket.png"); _ball = new Ball(30, ballStartPos, thatlevel); crane = new AnimationSprite("spritesheet.png", 6, 1); magwf.SetXY(-500, -500); trampwf.SetXY(-500, -500); shlfwf.SetXY(-500, -500); levelC.SetXY(-500, -500); _lines = new List <NLineSegment>(); _tramps = new List <Trampoline>(); _magas = new List <Magnit>(); _shelves = new List <Shelf>(); _boxes = new List <Sprite>(); boardWothScore = new TextBoard(220, 200); boardWothScore.x += game.width / 2 - 110; boardWothScore.y += game.height - 175; scoreBoard.SetXY(game.width / 2 - scoreBoard.width / 2, game.height - scoreBoard.height); menuButton = new Sprite("HUD/exit.png"); menuButton.SetXY(game.width - menuButton.width * 1.5f, 15); _hud = new Constructor(); oldBallDistance = 0; LoadScene(level); //LoadScene(4); AddChild(shlfwf); AddChild(magwf); AddChild(trampwf); AddChild(scoreBoard); AddChild(boardWothScore); AddChild(menuButton); AddChild(levelC); AddChild(crane); AddChild(_hud); //AddChild(fonblack); _clickSound = new Sound("1.mp3"); crane.SetFrame(0); AddChild(_cursorIMG); //fonblack.alpha = 0.1f; }
protected virtual void Start() { board = FindObjectOfType <TextBoard>(); health = max_health;//allows non-standard health }
public Label(HudParentBase parent) : base(parent) { _textBoard = new TextBoard(); _textBoard.Format = GlyphFormat.White; _textBoard.SetText("NewLabel"); }
public Menu(int numberOfLevel, float pSoundVolume) : base() { BATOOT = new Sprite("BATOOT.png"); soundVolume = pSoundVolume; _cursorIMG = new Sprite("HUD/cursor_PNG50.png"); backgroundMusic = new Sound("music_for_menu.mp3", true, true); soundChannel = backgroundMusic.Play(); _numberOfLevel = numberOfLevel; _clickSound = new Sound("1.mp3"); _fon = new Sprite("fon.png"); _startButton = new Sprite("HUD/main_menu/start/1_start_deactiv.png"); _startButton.SetOrigin(_startButton.width / 2f, _startButton.height / 2f); _startButton.SetXY(game.width / 2f, 300); _startButtonActive = new Sprite("HUD/main_menu/start/1_start_active.png"); _startButtonActive.SetOrigin(_startButtonActive.width / 2f, _startButtonActive.height / 2f); _startButtonActive.SetXY(game.width / 2f - 10000, 300 - 10000); _optionsButton = new Sprite("HUD/main_menu/options/2_options_deactiv.png"); _optionsButton.SetOrigin(_optionsButton.width / 2f, _optionsButton.height / 2f); _optionsButton.SetXY(game.width / 2f, 500); _optionsButtonActive = new Sprite("HUD/main_menu/options/2_options_active.png"); _optionsButtonActive.SetOrigin(_optionsButtonActive.width / 2f, _optionsButtonActive.height / 2f); _optionsButtonActive.SetXY(game.width / 2f, 500 - 10000); _exitButton = new Sprite("HUD/main_menu/exit/3_exit_deactiv.png"); _exitButton.SetOrigin(_exitButton.width / 2f, _exitButton.height / 2f); _exitButton.SetXY(game.width / 2f, 700); _exitButtonActive = new Sprite("HUD/main_menu/exit/3_exit_active.png"); _exitButtonActive.SetOrigin(_exitButtonActive.width / 2f, _exitButtonActive.height / 2f); _exitButtonActive.SetXY(game.width / 2f, 700 - 10000); _minusButton = new Sprite("HUD/main_menu/options/minus.png"); _minusButton.SetOrigin(_minusButton.width / 2f, _minusButton.height / 2f); _minusButton.SetXY(game.width / 2f - 200 + 10000, game.height / 2f + 100); _minusButtonActive = new Sprite("HUD/main_menu/options/minus_active.png"); _minusButtonActive.SetOrigin(_minusButtonActive.width / 2f, _minusButtonActive.height / 2f); _minusButtonActive.SetXY(game.width / 2f - 200 + 10000, game.height / 2f + 100); _plusButton = new Sprite("HUD/main_menu/options/plus.png"); _plusButton.SetOrigin(_plusButton.width / 2f, _plusButton.height / 2f); _plusButton.SetXY(game.width / 2f + 200 + 10000, game.height / 2f + 100); _plusButtonActive = new Sprite("HUD/main_menu/options/plus_active.png"); _plusButtonActive.SetOrigin(_plusButtonActive.width / 2f, _plusButtonActive.height / 2f); _plusButtonActive.SetXY(game.width / 2f + 200 + 10000, game.height / 2f + 100); _goBackButton = new Sprite("HUD/main_menu/options/go_back.png"); _goBackButton.SetOrigin(_goBackButton.width / 2f, _goBackButton.height / 2f); _goBackButton.SetXY(game.width / 2f + 10000, game.height / 2f + 300); _goBackButtonActive = new Sprite("HUD/main_menu/options/go_back_active.png"); _goBackButtonActive.SetOrigin(_goBackButtonActive.width / 2f, _goBackButtonActive.height / 2f); _goBackButtonActive.SetXY(game.width / 2f + 10000, game.height / 2f + 300); _aKakButton = new Sprite("question_mark_PNG52.png"); _aKakButton.SetOrigin(_aKakButton.width / 2f, _aKakButton.height / 2f); _aKakButton.SetXY(1830, 60); _obratnoButton = new Sprite("HUD/main_menu/options/go_back.png"); _obratnoButton.SetOrigin(_obratnoButton.width / 2f, _obratnoButton.height / 2f); _obratnoButton.SetXY(game.width / 2f + 10000, game.height / 2f + 300); _obratnoButtonActive = new Sprite("HUD/main_menu/options/go_back_active.png"); _obratnoButtonActive.SetOrigin(_obratnoButtonActive.width / 2f, _obratnoButtonActive.height / 2f); _obratnoButtonActive.SetXY(game.width / 2f + 10000, game.height / 2f + 300); _tutor = new TextBoard(600, 400); _tutor.x += -10000; _tutor.y += game.height / 2f - 250; _sVolume = new TextBoard(220, 200); _sVolume.x += -10000; _sVolume.y += game.height / 2f - 150; BATOOT.SetOrigin(BATOOT.width / 2, BATOOT.height / 2); BATOOT.SetXY(game.width / 2, 90); AddChild(_fon); AddChild(_aKakButton); AddChild(_obratnoButton); AddChild(BATOOT); AddChild(_tutor); AddChild(_sVolume); AddChild(_startButton); AddChild(_startButtonActive); AddChild(_optionsButton); AddChild(_optionsButtonActive); AddChild(_exitButton); AddChild(_exitButtonActive); AddChild(_goBackButton); AddChild(_minusButton); AddChild(_minusButtonActive); AddChild(_plusButton); AddChild(_plusButtonActive); AddChild(_goBackButtonActive); AddChild(_obratnoButtonActive); AddChild(_cursorIMG); }
private void TextBoard_TextChanged(object sender, System.Windows.Controls.TextChangedEventArgs e) { TextBoard.ScrollToEnd(); }
public void LPClient() { string name = "ZMQsocket"; using (var context = new ZContext()) { ZSocket requester = null; try { // using (requester) ZError error; if (null == (requester = LPClient_CreateZSocket(context, name, out error))) { if (error == ZError.ETERM) { return; // Interrupted } throw new ZException(error); } int sequence = 10; int retries_left = LPClient_RequestRetries; var poll = ZPollItem.CreateReceiver(); while (retries_left > 0) { // We send a request, then we work to get a reply using (var outgoing = ZFrame.Create(4)) { outgoing.Write(sequence); if (!requester.Send(outgoing, out error)) { if (error == ZError.ETERM) { return; // Interrupted } throw new ZException(error); } } ZMessage incoming; // Here we process a server reply and exit our loop // if the reply is valid. // If we didn't a reply, we close the client socket // and resend the request. We try a number of times // before finally abandoning: // Poll socket for a reply, with timeout if (requester.PollIn(poll, out incoming, out error, LPClient_RequestTimeout)) { using (incoming) { // We got a reply from the server int incoming_sequence = incoming[0].ReadInt32(); if (incoming_sequence >= 0 && incoming_sequence <= 9) { TextBoard.AppendText(DateTime.Now.TimeOfDay.ToString() + String.Format(": I: Сервер ответил: ({0}) \n", incoming_sequence)); } else { TextBoard.AppendText(DateTime.Now.TimeOfDay.ToString() + String.Format(": E: Ошибка на стороне сервера: ({0}) \n", incoming_sequence)); } retries_left = LPClient_RequestRetries; break; } } else { if (error == ZError.EAGAIN) { if (--retries_left == 0) { TextBoard.AppendText(DateTime.Now.TimeOfDay.ToString() + String.Format(": E: Сервер недоступен \n")); break; } TextBoard.AppendText(DateTime.Now.TimeOfDay.ToString() + String.Format(": W: Нет ответа от сервера, переподключение... \n")); // Old socket is confused; close it and open a new one requester.Dispose(); if (null == (requester = LPClient_CreateZSocket(context, name, out error))) { if (error == ZError.ETERM) { return; // Interrupted } throw new ZException(error); } TextBoard.AppendText(DateTime.Now.TimeOfDay.ToString() + String.Format(": I: Переподключение \n")); // Send request again, on new socket using (var outgoing = ZFrame.Create(4)) { outgoing.Write(sequence); if (!requester.Send(outgoing, out error)) { if (error == ZError.ETERM) { return; // Interrupted } throw new ZException(error); } } continue; } if (error == ZError.ETERM) { return; // Interrupted } throw new ZException(error); } } } catch { TextBoard.AppendText(DateTime.Now.TimeOfDay.ToString() + String.Format(": E: Ошибка запроса. \n")); } finally { if (requester != null) { requester.Dispose(); requester = null; } } } }
private void TextBench(string[] args) { int iterations = 1; bool benchAssign = false, benchDraw = false; bool.TryParse(args[0], out benchDraw); bool.TryParse(args[1], out benchAssign); if (args.Length > 2) { int.TryParse(args[2], out iterations); } if (textBoard == null) { textBoard = new TextBoard() { AutoResize = true, BuilderMode = TextBuilderModes.Lined }; textBoard.SetText(loremIpsum); } int charCount = 0; for (int i = 0; i < textBoard.Count; i++) { charCount += textBoard[i].Count; } var timer = new Stopwatch(); timer.Start(); if (benchAssign) { for (int i = 0; i < iterations; i++) { textBoard.SetText(loremIpsum); } } if (benchDraw) { for (int i = 0; i < iterations; i++) { textBoard.Draw(Vector2.Zero); } } timer.Stop(); ExceptionHandler.SendChatMessage ( $"Text Bench:\n" + $"\tBencDraw: {benchDraw}\n" + $"\tBenchAssign: {benchAssign}\n" + $"\tCharCount: {charCount}\n" + $"\tTime: {(timer.ElapsedTicks / (double)TimeSpan.TicksPerMillisecond):G6} ms\n" + $"\tIsHighResolution: {Stopwatch.IsHighResolution}\n" + $"\tIterations: {iterations}" ); }
protected override void HandleInput(Vector2 cursorPos) { // MouseInput is running behind this because its a child element bool useInput = allowInput || (MouseInput.HasFocus && HudMain.InputMode == HudInputMode.Full); if (EnableEditing && IsMousedOver && HudMain.InputMode == HudInputMode.CursorOnly) { HudMain.Cursor.RegisterToolTip(warningToolTip); } if (useInput && EnableEditing) { textInput.HandleInput(); if (SharedBinds.Cut.IsNewPressed && !selectionBox.Empty && EnableHighlighting) { RichText text = TextBoard.GetTextRange(selectionBox.Start, selectionBox.End); DeleteSelection(); caret.Move(new Vector2I(0, -GetRichTextMinLength(text))); HudMain.ClipBoard = text; } if (SharedBinds.Paste.IsNewPressed) { if (!HudMain.ClipBoard.Equals(default(RichText))) { Vector2I insertIndex = caret.Index + new Vector2I(0, 1); insertIndex.X = MathHelper.Clamp(insertIndex.X, 0, TextBoard.Count); DeleteSelection(); TextBoard.Insert(HudMain.ClipBoard, insertIndex); int length = GetRichTextMinLength(HudMain.ClipBoard); if (caret.Index.Y == -1) { length++; } caret.Move(new Vector2I(0, length)); } } } InputOpen = useInput && (EnableHighlighting || EnableEditing); caret.Visible = InputOpen; if (useInput && EnableHighlighting) { bool isCursorHighlighting = false; if (UseCursor) { if (SharedBinds.LeftButton.IsNewPressed) { cursorStart = cursorPos; selectionBox.ClearSelection(); } // Require some movement before enabling highlighting else if (!canHighlight && SharedBinds.LeftButton.IsPressed && (cursorPos - cursorStart).LengthSquared() > 16f) { canHighlight = true; isCursorHighlighting = true; } else if (SharedBinds.LeftButton.IsReleased) { canHighlight = false; } } if (!isCursorHighlighting) { canHighlight = SharedBinds.Shift.IsPressed; } if (SharedBinds.SelectAll.IsNewPressed) { selectionBox.SetSelection(Vector2I.Zero, new Vector2I(TextBoard.Count - 1, TextBoard[TextBoard.Count - 1].Count - 1)); } else if (SharedBinds.Escape.IsNewPressed) { selectionBox.ClearSelection(); } if (SharedBinds.Copy.IsNewPressed && !selectionBox.Empty) { HudMain.ClipBoard = TextBoard.GetTextRange(selectionBox.Start, selectionBox.End); } } else { canHighlight = false; } }
private RichHudDebug() : base(false, true) { if (instance == null) { instance = this; } else { throw new Exception($"Only one instance of {GetType().Name} can exist at any given time."); } statsText = new TextPage() { Name = "Statistics", HeaderText = "Debug Statistics", SubHeaderText = "Update Times and API Usage", }; statsText.TextBuilder.BuilderMode = TextBuilderModes.Lined; statsBuilder = new StringBuilder(); updateTimer = new Stopwatch(); updateTimer.Start(); stats = new UpdateStats(); overlayPos = new Vector2(0.5f, 0.5f); enableOverlay = false; EnableDebug = false; overlay = new TextBoard() { AutoResize = true, BuilderMode = TextBuilderModes.Lined, Scale = 0.8f, Format = new GlyphFormat(new Color(255, 191, 0)) }; pageCategory = new TerminalPageCategory() { Name = "Debug", Enabled = false, PageContainer = { new DemoPage() { Name = "Demo", }, statsText, new ControlPage() { Name = "Settings", CategoryContainer = { new ControlCategory() { HeaderText = "Debug Settings", SubheaderText = "", TileContainer = { new ControlTile() { new TerminalCheckbox() { Name = "Enable Overlay", Value = enableOverlay, ControlChangedHandler = (obj, args) => { var element = obj as TerminalCheckbox; enableOverlay = element.Value; } }, new TerminalDragBox() { Name = "Set Overlay Pos", Value = overlayPos, AlignToEdge = true, ControlChangedHandler = (obj, args) => { var element = obj as TerminalDragBox; overlayPos = element.Value; } } }, } } } } } }; RichHudTerminal.Root.Add(pageCategory); }
void LoadScene(int sceneNumber) { _startSceneNumber = sceneNumber; isGameStarted = false; // remove previous scene: foreach (NLineSegment lineAng in _lines) { lineAng.Destroy(); } _lines.Clear(); foreach (Trampoline trampoline in _tramps) { trampoline.Destroy(); } _tramps.Clear(); foreach (Magnit maga in _magas) { maga.Destroy(); } _magas.Clear(); foreach (Shelf polka in _shelves) { polka.Destroy(); } _shelves.Clear(); foreach (Sprite korobka in _boxes) { korobka.Destroy(); } _boxes.Clear(); // boundary: AddTrampoline(new Vec2(213131, 12312312), new Vec2(12313123, 123131), 0); AddMagnete(new Vec2(12312, 123132), new Vec2(123123, 123123), 0); AddShelf(new Vec2(12312, 123132), new Vec2(123123, 123123), 0); levelC.LateDestroy(); _ball.LateDestroy(); _hud.LateDestroy(); crane.LateDestroy(); _cursorIMG.LateDestroy(); //fonblack.LateDestroy(); //scoreBoard.LateDestroy(); //boardWothScore.LateDestroy(); //menuButton.LateDestroy(); switch (sceneNumber) { case 1: // level two AddBox(new Vec2(-5, -5)); AddBox(new Vec2(-5, 125)); AddBox(new Vec2(-5, 255)); AddBox(new Vec2(-5, 385)); AddBox(new Vec2(-5, 515)); AddBox(new Vec2(-5, 645)); AddBox(new Vec2(-5, 775)); AddBox(new Vec2(-5, 905)); AddBox(new Vec2(-5, 1035)); //AddBox(new Vec2(game.width - 125, -5)); AddBox(new Vec2(1870, 125)); AddBox(new Vec2(1870, 255)); AddBox(new Vec2(1870, 385)); AddBox(new Vec2(1870, 515)); AddBox(new Vec2(1870, 645)); AddBox(new Vec2(1870, 775)); AddBox(new Vec2(1870, 905)); //AddBox(new Vec2(game.width - 125, 1035)); AddBox(new Vec2(120, -5)); AddBox(new Vec2(245, -5)); AddBox(new Vec2(370, -5)); AddBox(new Vec2(495, -5)); AddBox(new Vec2(620, -5)); AddBox(new Vec2(745, -5)); AddBox(new Vec2(870, -5)); AddBox(new Vec2(995, -5)); AddBox(new Vec2(1120, -5)); AddBox(new Vec2(1245, -5)); AddBox(new Vec2(1370, -5)); AddBox(new Vec2(1495, -5)); AddBox(new Vec2(1620, -5)); AddBox(new Vec2(1745, -5)); AddBox(new Vec2(1870, -5)); AddBox(new Vec2(120, 905)); AddBox(new Vec2(245, 905)); AddBox(new Vec2(370, 905)); AddBox(new Vec2(495, 905)); AddBox(new Vec2(620, 905)); AddBox(new Vec2(745, 905)); AddBox(new Vec2(870, 905)); AddBox(new Vec2(995, 905)); AddBox(new Vec2(1120, 905)); AddBox(new Vec2(1245, 905)); AddBox(new Vec2(1370, 905)); AddBox(new Vec2(1495, 905)); AddBox(new Vec2(1620, 905)); AddBox(new Vec2(1745, 905)); AddBox(new Vec2(1870, 905)); AddBox(new Vec2(120, 1035)); AddBox(new Vec2(245, 1035)); AddBox(new Vec2(370, 1035)); AddBox(new Vec2(495, 1035)); AddBox(new Vec2(620, 1035)); AddBox(new Vec2(745, 1035)); AddBox(new Vec2(870, 1035)); AddBox(new Vec2(995, 1035)); AddBox(new Vec2(1120, 1035)); AddBox(new Vec2(1245, 1035)); AddBox(new Vec2(1370, 1035)); AddBox(new Vec2(1495, 1035)); AddBox(new Vec2(1620, 1035)); AddBox(new Vec2(1745, 1035)); AddBox(new Vec2(1870, 1035)); AddLine(new Vec2(game.width - 50, game.height - 175), new Vec2(129, game.height - 175)); AddLine(new Vec2(129, game.height - 175), new Vec2(129, 134)); AddLine(new Vec2(129, 134), new Vec2(game.width - 50, 134)); AddLine(new Vec2(game.width - 50, 134), new Vec2(game.width - 50, game.height - 175)); //AddLine(new Vec2(1179, game.height / 2 - 100), new Vec2(800, game.height / 2 - 100)); //AddLine(new Vec2(800, game.height / 2 + 34), new Vec2(1179, game.height / 2 + 34)); //AddLine(new Vec2(800, game.height / 2 - 100), new Vec2(800, game.height / 2 + 34)); //AddLine(new Vec2(1179, game.height / 2 + 34), new Vec2(1179, game.height / 2 - 100)); _hud = new Constructor(); levelC = new LevelChanger("bucket.png"); levelC.SetXY(1750, 820); ballStartPos = new Vec2(290, 240); //crane = new AnimationSprite("spritesheet.png", 3, 2); crane = new AnimationSprite("spritesheet.png", 6, 1); crane.SetFrame(0); crane.SetXY(185, 30); _ball = new Ball(30, ballStartPos, thatlevel); AddChild(levelC); AddChild(_hud); AddChild(_ball); AddChild(crane); score = 1000; boardWothScore = new TextBoard(220, 200); boardWothScore.x += game.width / 2 - 110; boardWothScore.y += game.height - 175; scoreBoard.SetXY(game.width / 2 - scoreBoard.width / 2, game.height - scoreBoard.height); menuButton = new Sprite("HUD/exit.png"); menuButton.SetXY(game.width - menuButton.width * 1.5f, 15); AddChild(scoreBoard); AddChild(boardWothScore); AddChild(menuButton); _cursorIMG = new Sprite("HUD/cursor_PNG50.png"); AddChild(_cursorIMG); break; case 2: // level one AddBox(new Vec2(800, game.height / 2 - 100)); AddBox(new Vec2(925, game.height / 2 - 100)); AddBox(new Vec2(1050, game.height / 2 - 100)); AddLine(new Vec2(1179, game.height / 2 - 100), new Vec2(800, game.height / 2 - 100)); AddLine(new Vec2(800, game.height / 2 + 34), new Vec2(1179, game.height / 2 + 34)); AddLine(new Vec2(800, game.height / 2 - 100), new Vec2(800, game.height / 2 + 34)); AddLine(new Vec2(1179, game.height / 2 + 34), new Vec2(1179, game.height / 2 - 100)); crane = new AnimationSprite("spritesheet.png", 6, 1); crane.SetFrame(0); crane.SetXY(785, 30); _hud = new Constructor(); levelC = new LevelChanger("bucket.png"); levelC.SetXY(960, 870); ballStartPos = new Vec2(890, 240); _ball = new Ball(30, ballStartPos, thatlevel); AddChild(levelC); AddChild(_hud); AddChild(_ball); AddChild(crane); score = 100; _cursorIMG = new Sprite("HUD/cursor_PNG50.png"); AddChild(_cursorIMG); break; case 3: // level two AddBox(new Vec2(900, -5)); AddBox(new Vec2(900, 125)); AddBox(new Vec2(900, 255)); AddLine(new Vec2(900, -5), new Vec2(900, 255 + 134)); AddLine(new Vec2(1029, 255 + 134), new Vec2(1029, -5)); AddLine(new Vec2(900, 255 + 134), new Vec2(1029, 255 + 134)); AddLine(new Vec2(1029, -5), new Vec2(900, -5)); levelC = new LevelChanger("bucket.png"); AddBox(new Vec2(1735, 690)); AddBox(new Vec2(1735, 820)); AddBox(new Vec2(1735, 950)); AddLine(new Vec2(1735 + 129, 690), new Vec2(1735, 690)); AddLine(new Vec2(1735, 690), new Vec2(1735, 950 + 134)); AddLine(new Vec2(1735 + 129, 950 + 134), new Vec2(1735 + 129, 690)); crane = new AnimationSprite("spritesheet.png", 6, 1); crane.SetFrame(0); crane.SetXY(565, 30); _hud = new Constructor(); levelC.SetXY(1800, 620); ballStartPos = new Vec2(670, 240); _ball = new Ball(30, ballStartPos, thatlevel); AddChild(levelC); AddChild(_hud); AddChild(_ball); AddChild(crane); score = 150; _cursorIMG = new Sprite("HUD/cursor_PNG50.png"); AddChild(_cursorIMG); break; case 4: // level one AddBox(new Vec2(900, -5)); AddBox(new Vec2(900, 125)); AddBox(new Vec2(900, 255)); AddLine(new Vec2(900, -5), new Vec2(900, 255 + 134)); AddLine(new Vec2(1029, 255 + 134), new Vec2(1029, -5)); AddLine(new Vec2(900, 255 + 134), new Vec2(1029, 255 + 134)); AddLine(new Vec2(1029, -5), new Vec2(900, -5)); AddBox(new Vec2(1235, -5)); AddBox(new Vec2(1235, 125)); AddBox(new Vec2(1235, 255)); AddLine(new Vec2(1235, -5), new Vec2(1235, 255 + 134)); AddLine(new Vec2(1235 + 129, 255 + 134), new Vec2(1235 + 129, -5)); AddLine(new Vec2(1235, 255 + 134), new Vec2(1235 + 129, 255 + 134)); AddLine(new Vec2(1235 + 129, -5), new Vec2(1235, -5)); AddBox(new Vec2(900, 810)); AddLine(new Vec2(900, 810), new Vec2(900, 810 + 134)); AddLine(new Vec2(1029, 810 + 134), new Vec2(1029, 810)); AddLine(new Vec2(900, 810 + 134), new Vec2(1029, 810 + 134)); AddLine(new Vec2(1029, 810), new Vec2(900, 810)); levelC = new LevelChanger("bucket.png"); AddBox(new Vec2(1235, 690)); AddBox(new Vec2(1235, 820)); AddBox(new Vec2(1235, 950)); AddLine(new Vec2(1235 + 129, 690), new Vec2(1235, 690)); AddLine(new Vec2(1235, 690), new Vec2(1235, 950 + 134)); AddLine(new Vec2(1235 + 129, 950 + 134), new Vec2(1235 + 129, 690)); crane = new AnimationSprite("spritesheet.png", 6, 1); crane.SetFrame(0); crane.SetXY(1395, 60); //levelC.SetXY(1800, 620); levelC.SetXY(750, 920); AddBox(new Vec2(685, 990)); ballStartPos = new Vec2(1500, 270); _ball = new Ball(30, ballStartPos, thatlevel); _hud = new Constructor(); AddChild(levelC); AddChild(_hud); AddChild(_ball); AddChild(crane); score = 150; _cursorIMG = new Sprite("HUD/cursor_PNG50.png"); AddChild(_cursorIMG); break; default: // break; } }