List of usage examples for com.badlogic.gdx.graphics Color GREEN
Color GREEN
To view the source code for com.badlogic.gdx.graphics Color GREEN.
Click Source Link
From source file:kyle.game.besiege.panels.BottomPanel.java
License:Open Source License
public static void log(String text, String color) { Color fontColor;//from w w w .j a v a 2 s . co m if (color == "red") fontColor = new Color(230 / 255f, 0, 15 / 255f, 1); else if (color == "orange") fontColor = new Color(1, 60 / 255f, 0, 1); else if (color == "yellow") fontColor = Color.YELLOW; else if (color == "cyan") fontColor = Color.CYAN; else if (color == "magenta") fontColor = Color.MAGENTA; else if (color == "white") fontColor = Color.WHITE; else if (color == "green") fontColor = Color.GREEN; else if (color == "blue") fontColor = new Color(0, 70 / 255f, 1, 1); else if (color == "purple") fontColor = new Color(168 / 255f, 0, 1, 1); else fontColor = Color.WHITE; LabelStyle lsNew = new LabelStyle(ls); lsNew.fontColor = fontColor; Label temp = new Label(text, lsNew); // Memory leak, should change to have 4 or 5 fixed colors so new one is not created everytime. logTable.row(); logTable.add(temp); logging = 0; ls.fontColor = Color.WHITE; }
From source file:managers.HealthBarManager.java
public void drawHealthBar(ShapeRenderer sr, World world, Camera camera) { for (Entity e : world.getEntities(PLAYER, ENEMY)) { float x = e.get(Position.class).getX(); float y = e.get(Position.class).getY(); int eHeight = e.get(Body.class).getHeight(); sr.setColor(Color.BLACK); sr.begin(ShapeRenderer.ShapeType.Filled); sr.rect(x, y + eHeight + 9, (float) (e.get(Health.class).getMaxHp() / 2), 12); sr.setProjectionMatrix(camera.combined); sr.end();//from w w w .j av a 2 s . c om sr.setColor(Color.RED); sr.begin(ShapeRenderer.ShapeType.Filled); sr.rect(x, y + eHeight + 10, (float) (e.get(Health.class).getMaxHp() / 2), 10); sr.setProjectionMatrix(camera.combined); sr.end(); sr.setColor(Color.GREEN); sr.begin(ShapeRenderer.ShapeType.Filled); sr.rect(x, y + eHeight + 10, e.get(Health.class).getHp() / 2, 10); sr.setProjectionMatrix(camera.combined); sr.end(); } }
From source file:maze.maker.Cell.java
public void drawMazeMaker() { shape.begin(ShapeRenderer.ShapeType.Filled); shape.setColor(Color.GREEN); shape.rect(fDx, fDy, scl, scl); shape.end(); }
From source file:mobi.shad.s3lib.gui.dialog.Editor2d.java
License:Apache License
public void create(Texture areaTexture, final float startX, final float startY, final float width, final float height, final ChangeListener changeListener) { super.create(); backendWindow = GuiResource.windowBackend(); backendWindow.setColor(1f, 1f, 1f, 0f); backendWindow.setVisible(false);//from w w w.jav a 2 s . c o m S3.stage.addActor(backendWindow); mainWindow = GuiResource.window("WidgetBase", "WidgetBase"); mainWindow.setColor(1f, 1f, 1f, 0f); mainWindow.setVisible(false); mainWindow.setModal(true); mainWindow.setMovable(false); this.currentX = startX; this.currentY = startY; this.currentWidth = width; this.currentHeight = height; // // Grid Layer // Pixmap pixmap = new Pixmap(10, 10, Pixmap.Format.RGBA8888); pixmap.setColor(Color.WHITE); pixmap.fill(); gridtextureLayer = new Texture(pixmap); gridLayer = new Widget() { @Override public void draw(Batch batch, float parentAlpha) { batch.setColor(0.8f, 0.8f, 0.8f, 0.3f); batch.draw(gridtextureLayer, 0, S3Constans.gridY1, S3Screen.width, 1); batch.draw(gridtextureLayer, 0, S3Constans.gridY2, S3Screen.width, 1); batch.draw(gridtextureLayer, 0, S3Constans.gridY3, S3Screen.width, 1); batch.draw(gridtextureLayer, 0, S3Constans.gridY4, S3Screen.width, 1); batch.draw(gridtextureLayer, 0, S3Constans.gridY5, S3Screen.width, 3); batch.draw(gridtextureLayer, 0, S3Constans.gridY6, S3Screen.width, 1); batch.draw(gridtextureLayer, 0, S3Constans.gridY7, S3Screen.width, 1); batch.draw(gridtextureLayer, 0, S3Constans.gridY8, S3Screen.width, 1); batch.draw(gridtextureLayer, 0, S3Constans.gridY9, S3Screen.width, 1); batch.draw(gridtextureLayer, S3Constans.gridX1, 0, 1, S3Screen.height); batch.draw(gridtextureLayer, S3Constans.gridX2, 0, 1, S3Screen.height); batch.draw(gridtextureLayer, S3Constans.gridX3, 0, 1, S3Screen.height); batch.draw(gridtextureLayer, S3Constans.gridX4, 0, 1, S3Screen.height); batch.draw(gridtextureLayer, S3Constans.gridX5, 0, 3, S3Screen.height); batch.draw(gridtextureLayer, S3Constans.gridX6, 0, 1, S3Screen.height); batch.draw(gridtextureLayer, S3Constans.gridX7, 0, 1, S3Screen.height); batch.draw(gridtextureLayer, S3Constans.gridX8, 0, 1, S3Screen.height); batch.draw(gridtextureLayer, S3Constans.gridX9, 0, 1, S3Screen.height); } }; gridLayer.setX(0); gridLayer.setY(0); gridLayer.setWidth(S3Screen.width); gridLayer.setHeight(S3Screen.height); // // // final TextureRegion areaRegion = new TextureRegion(areaTexture); areaImage = new Widget() { @Override public void draw(Batch batch, float parentAlpha) { Color color = getColor(); batch.setColor(color.r, color.g, color.b, parentAlpha); batch.draw(areaRegion, getX(), getY(), getOriginX(), getOriginY(), getWidth(), getHeight(), getScaleX(), getScaleY(), getRotation()); } }; areaImage.setX(currentX); areaImage.setY(currentY); areaImage.setWidth(currentWidth); areaImage.setHeight(currentHeight); // // Create texture // Pixmap redPixmap = new Pixmap(32, 32, Pixmap.Format.RGBA8888); redPixmap.setColor(Color.RED); redPixmap.fillCircle(16, 16, 14); Texture redTexture = new Texture(redPixmap); Pixmap yellowPixmap = new Pixmap(32, 32, Pixmap.Format.RGBA8888); yellowPixmap.setColor(Color.YELLOW); yellowPixmap.fillCircle(16, 16, 14); Texture yellowTexture = new Texture(yellowPixmap); Pixmap greenPixmap = new Pixmap(32, 32, Pixmap.Format.RGBA8888); greenPixmap.setColor(Color.GREEN); greenPixmap.fillCircle(16, 16, 14); Texture greenTexture = new Texture(greenPixmap); // // // TextButton textButtonOk = GuiResource.textButton("Save", "Save"); TextButton textButtonFullScreen = GuiResource.textButton("Full", "Full"); TextButton textButtonCenter = GuiResource.textButton("Center", "Center"); TextButton textButtonCancel = GuiResource.textButton("Cancel", "Cancel"); // // // textButtonOk.addListener(new ChangeListener() { @Override public void changed(ChangeEvent event, Actor actor) { S3Log.log("Editor2d::textButtonOk::clicked", " event: " + event + " actor: " + actor.toString(), 2); hide(); if (changeListener != null) { changeListener.changed(event, areaImage); } } }); textButtonFullScreen.addListener(new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { S3Log.log("Editor2d::textButtonFullScreen::clicked", " event: " + event + " x: " + x + " y: " + y, 2); currentX = 0; currentY = 0; currentWidth = S3Screen.width; currentHeight = S3Screen.height; setAreaPosistion(); setTouchPosistion(); } }); textButtonCenter.addListener(new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { S3Log.log("Editor2d::textButtonCenter::clicked", " event: " + event + " x: " + x + " y: " + y, 2); currentX = S3Screen.centerX - (float) S3Screen.centerX / 2; currentY = S3Screen.centerY - (float) S3Screen.centerY / 2; currentWidth = (float) S3Screen.centerX; currentHeight = (float) S3Screen.centerY; setAreaPosistion(); setTouchPosistion(); } }); textButtonCancel.addListener(new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { S3Log.log("Editor2d::textButtonCancel::clicked", " event: " + event + " x: " + x + " y: " + y, 2); currentX = startX; currentY = startY; currentWidth = width; currentHeight = height; hide(); } }); sizeElementLabel = GuiResource.label("X: Y: Width: Height:", "sizeElementLabel"); mainWindow.row(); mainWindow.add(textButtonOk); mainWindow.add(textButtonFullScreen); mainWindow.add(textButtonCenter); mainWindow.add(textButtonCancel); mainWindow.row(); mainWindow.add(sizeElementLabel).colspan(4).left(); GuiUtil.windowPosition(mainWindow, 0, 0); S3.stage.addActor(gridLayer); S3.stage.addActor(areaImage); // // Create AreaPlot // dotLeftImage = createAreaPoint("dotLeftImage", redTexture, (int) (currentX - 16), (int) (currentY + (currentHeight / 2) - 16)); dotRightImage = createAreaPoint("dotRightImage", redTexture, (int) (currentX + currentWidth - 16), (int) (currentY + (currentHeight / 2) - 16)); dotTopImage = createAreaPoint("dotTopImage", redTexture, (int) (currentX + (currentWidth / 2) - 16), (int) (currentY + currentHeight - 16)); dotBottomImage = createAreaPoint("dotBottomImage", redTexture, (int) (currentX + (currentWidth / 2) - 16), (int) (currentY - 16)); dotTopLeftImage = createAreaPoint("dotTopLeftImage", yellowTexture, (int) (currentX - 16), (int) (currentY + currentHeight - 16)); dotTopRightImage = createAreaPoint("dotTopRightImage", yellowTexture, (int) (currentX + currentWidth - 16), (int) (currentY + currentHeight - 16)); dotBottomLeftImage = createAreaPoint("dotBottomLeftImage", yellowTexture, (int) (currentX + currentWidth - 16), (int) (currentY - 16)); dotBottomRightImage = createAreaPoint("dotBottomRightImage", yellowTexture, (int) (currentX + currentWidth - 16), (int) (currentY - 16)); dotCenterImage = createAreaPoint("dotCenter", greenTexture, (int) (currentX + (currentWidth / 2) - 16), (int) (currentY + (currentHeight / 2) - 16)); S3.stage.addActor(mainWindow); // // Assign Listener // mainWindow.addListener(new InputListener() { @Override public void touchDragged(InputEvent event, float x, float y, int pointer) { lastPointX = pointX; lastPointY = pointY; pointX = x; pointY = y; deltaX = pointX - lastPointX; deltaY = pointY - lastPointY; S3Log.log("dotCenterImage::touchDragged", " event: " + event + " x: " + x + " y: " + y + " pointer: " + pointer + " deltaX: " + deltaX + " deltaY: " + deltaY, 3); if (pointClick != null) { S3Log.log("dotCenterImage::touchDragged", " Point click: " + pointClickName + " aX: " + aspectRatioX + " aY: " + aspectRatioY, 2); if (pointClickName.equalsIgnoreCase("dotLeftImage")) { if (currentX > 0 && deltaX < 0 && currentWidth >= 32) { currentX += deltaX; currentWidth -= deltaX; } else if (currentX < S3Screen.width && deltaX > 0 && currentWidth > 32) { currentX += deltaX; currentWidth -= deltaX; } setAreaPosistion(); setTouchPosistion(); } else if (pointClickName.equalsIgnoreCase("dotRightImage")) { if (currentX + currentWidth > 0 && currentX + currentWidth < S3Screen.width && currentWidth >= 32 && currentX > -1 && deltaX > 0) { currentWidth += deltaX; } else if (currentX + currentWidth > 0 && currentX + currentWidth <= S3Screen.width && currentWidth >= 32 && currentX > -1 && deltaX < 0) { currentWidth += deltaX; } setAreaPosistion(); setTouchPosistion(); } else if (pointClickName.equalsIgnoreCase("dotTopImage")) { if (currentY + currentHeight > 0 && currentY + currentHeight < S3Screen.height && currentHeight >= 32 && currentY > -1 && deltaY > 0) { currentHeight += deltaY; } else if (currentY + currentHeight > 0 && currentY + currentHeight <= S3Screen.height && currentHeight >= 32 && currentY > -1 && deltaY < 0) { currentHeight += deltaY; } setAreaPosistion(); setTouchPosistion(); } else if (pointClickName.equalsIgnoreCase("dotBottomImage")) { if (currentY > 0 && deltaY < 0 && currentHeight >= 32) { currentY += deltaY; currentHeight -= deltaY; } else if (currentY < S3Screen.height && deltaY > 0 && currentHeight > 32) { currentY += deltaY; currentHeight -= deltaY; } setAreaPosistion(); setTouchPosistion(); } else if (pointClickName.equalsIgnoreCase("dotTopRightImage")) { float delta = (deltaX + deltaY) / 2; currentHeight += delta * aspectRatioY; currentWidth += delta * aspectRatioX; setAreaPosistion(); setTouchPosistion(); } else if (pointClickName.equalsIgnoreCase("dotBottomLeftImage")) { float delta = (deltaX + deltaY) / 2; currentX += delta * aspectRatioX; currentY += delta * aspectRatioY; currentHeight -= delta * aspectRatioY; currentWidth -= delta * aspectRatioX; setAreaPosistion(); setTouchPosistion(); } else if (pointClickName.equalsIgnoreCase("dotCenter")) { currentX += deltaX; currentY += deltaY; setAreaPosistion(); setTouchPosistion(); } else if (pointClickName.equalsIgnoreCase("dotTopLeftImage")) { float delta = (deltaX - deltaY) / 2; currentX += delta * aspectRatioY; currentHeight -= delta * aspectRatioY; currentWidth -= delta * aspectRatioY; setAreaPosistion(); setTouchPosistion(); } else if (pointClickName.equalsIgnoreCase("dotBottomRightImage")) { float delta = (deltaX - deltaY) / 2; currentY -= delta * aspectRatioY; currentHeight += delta * aspectRatioY; currentWidth += delta * aspectRatioY; setAreaPosistion(); setTouchPosistion(); } // // dotBottomRightImage } else if (isAreaImageClick) { currentX += deltaX; currentY += deltaY; setAreaPosistion(); setTouchPosistion(); } } @Override public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) { S3Log.log("dotCenterImage::touchDown", " event: " + event + " x: " + x + " y: " + y + " pointer: " + pointer + " button: " + button, 3); pointX = x; pointY = y; lastPointX = x; lastPointY = y; isAreaImageClick = checkAreaClick(x, y); pointClick = checkPointClick(x, y); return true; } @Override public void touchUp(InputEvent event, float x, float y, int pointer, int button) { S3Log.log("dotCenterImage::touchUp", " event: " + event + " x: " + x + " y: " + y + " pointer: " + pointer + " button: " + button, 2); isAreaImageClick = false; pointClick = null; pointClickName = ""; } }); setAreaPosistion(); setTouchPosistion(); }
From source file:mobi.shad.s3lib.gui.widget.HtmlView.java
License:Apache License
/** * @param node//from w ww. ja v a 2 s . co m * @return */ private CssStyle parseCssStyle(final Element node) { final CssStyle style = new CssStyle(); // // Color // String color = node.getAttribute("color", ""); if (color.equalsIgnoreCase("yellow")) { style.color = Color.YELLOW; } else if (color.equalsIgnoreCase("red")) { style.color = Color.RED; } else if (color.equalsIgnoreCase("green")) { style.color = Color.GREEN; } else if (color.equalsIgnoreCase("cyan")) { style.color = Color.CYAN; } else if (color.equalsIgnoreCase("blue")) { style.color = Color.BLUE; } else if (color.equalsIgnoreCase("gray")) { style.color = Color.GRAY; } else if (color.equalsIgnoreCase("light_gray")) { style.color = Color.LIGHT_GRAY; } else if (color.equalsIgnoreCase("dark_gray")) { style.color = Color.DARK_GRAY; } else if (color.equalsIgnoreCase("orange")) { style.color = Color.ORANGE; } else if (color.equalsIgnoreCase("magenta")) { style.color = Color.MAGENTA; } else if (color.equalsIgnoreCase("pink")) { style.color = Color.PINK; } // // Align // String align = node.getAttribute("align", ""); if (align.equalsIgnoreCase("right")) { style.align = Align.right; } else if (align.equalsIgnoreCase("left")) { style.align = Align.left; } else if (align.equalsIgnoreCase("center")) { style.align = Align.center; } else { style.align = Align.left; } // // Font // String font = node.getAttribute("font", ""); // if (font.equalsIgnoreCase("sans12")){ // style.font="sans12"; // } else if (font.equalsIgnoreCase("sans13")){ // style.font="sans13"; // } else if (font.equalsIgnoreCase("sans14")){ // style.font="sans14"; // } else if (font.equalsIgnoreCase("sans15")){ // style.font="sans15"; // } else if (font.equalsIgnoreCase("droid14")){ // style.font="droid14"; // } else if (font.equalsIgnoreCase("droid15")){ // style.font="droid15"; // } else if (font.equalsIgnoreCase("droid16")){ // style.font="droid16"; // } else if (font.equalsIgnoreCase("droid17")){ // style.font="droid17"; // } else if (font.equalsIgnoreCase("droid18")){ // style.font="droid18"; // } else if (font.equalsIgnoreCase("droid22")){ // style.font="droid22"; // } else if (font.equalsIgnoreCase("droid24")){ // style.font="droid24"; // } // // CollSpan // int collSpan = node.getIntAttribute("collspan", 1); if (collSpan > 1) { style.collSpan = collSpan; } return style; }
From source file:mobi.shad.s3libTest.G2DSimpleShapes.java
License:Apache License
@Override public void render(S3Gfx g) { g.clear(0.2f, 0.0f, 0.0f);// w w w . j a v a 2 s. c o m g.setColor(Color.YELLOW); g.drawCircle(30, 30, 20); g.setColor(Color.GREEN); g.drawFilledRectangle(80, 30, 10, 10, 0, Color.RED); g.drawFilledRectangle(80, 30, 20, 20, 0, new Color(0.5f, 0.5f, 0.5f, 0.5f)); }
From source file:name.herve.bastod.gui.screen.game.OverlayManager.java
License:Open Source License
public void renderDebugLoS(Vector pos) { Blending bck = Pixmap.getBlending(); Pixmap.setBlending(Blending.None);/* www. j a va 2 s . c o m*/ Dimension dimG = engine.getGridDimension(); Dimension dimB = engine.getBoardDimension(); Pixmap p = new Pixmap(dimB.getW() + 1, dimB.getH() + 1, Pixmap.Format.RGBA8888); Color ok = Color.GREEN; ok.a = 0.2f; Color nok = Color.ORANGE; nok.a = 0.2f; for (int x = 0; x < dimG.getW(); x++) { for (int y = 0; y < dimG.getH(); y++) { Vector v = new Vector(x, y); if (engine.lineOfSight(pos, v)) { drawTintedSquare(p, ok, engine.fromGridToBoard(v)); } else { drawTintedSquare(p, nok, engine.fromGridToBoard(v)); } } } Texture debug = new Texture(p); p.dispose(); Pixmap.setBlending(bck); batchBegin(); draw(debug, Engine._SP_SIDE, Engine._SP_BOTTOM); batchEnd(); debug.dispose(); }
From source file:name.herve.bastod.gui.screen.game.SpriteManager.java
License:Open Source License
private void renderPath(Mobile m) { if (!pathTextures.containsKey(m)) { Dimension dimB = engine.getBoardDimension(); Blending bck = Pixmap.getBlending(); Pixmap.setBlending(Blending.None); Pixmap p = new Pixmap(dimB.getW() + 1, dimB.getH() + 1, Pixmap.Format.RGBA8888); Color c = Color.GREEN.cpy(); p.setColor(c);/* w w w .ja va2 s . c o m*/ Vector current = m.getPlayer().getStartPositionOnBoard(); for (Vector next : m.getUnsmoothedPath()) { p.drawLine(current.getXInt(), dimB.getH() - current.getYInt(), next.getXInt(), dimB.getH() - next.getYInt()); current = next; } c = Color.YELLOW.cpy(); p.setColor(c); current = m.getPlayer().getStartPositionOnBoard(); for (Vector next : m.getPath()) { p.drawLine(current.getXInt(), dimB.getH() - current.getYInt(), next.getXInt(), dimB.getH() - next.getYInt()); current = next; } pathTextures.put(m, new Texture(p)); p.dispose(); Pixmap.setBlending(bck); } draw(pathTextures.get(m), Engine._SP_SIDE, Engine._SP_BOTTOM); // tPath.dispose(); }
From source file:net.k3rnel.unsealed.battle.BattleEntity.java
License:Open Source License
/** * @param status the status to set/*from w w w . j a v a2s . c o m*/ */ public void setStatus(int status) { this.status = status; switch (this.status) { case BattleEntity.statusNormal: break; case BattleEntity.statusBurned: actions = sequence(color(Color.RED), delay(0.05f), color(Color.ORANGE), delay(0.05f), color(Color.RED), delay(0.05f), color(Color.ORANGE), delay(0.05f), run(new Runnable() { @Override public void run() { setHp(getHp() - 10); } }), color(Color.RED), delay(0.05f), color(Color.ORANGE), delay(0.05f), color(Color.RED), delay(0.05f), color(Color.ORANGE), delay(0.05f), run(new Runnable() { @Override public void run() { setHp(getHp() - 10); } }), color(Color.RED), delay(0.05f), color(Color.ORANGE), delay(0.05f), color(Color.RED), delay(0.05f), color(Color.ORANGE), delay(0.05f), run(new Runnable() { @Override public void run() { setHp(getHp() - 10); } }), color(Color.WHITE), run(new Runnable() { @Override public void run() { setState(BattleEntity.statusNormal); } })); this.addAction(actions); break; case BattleEntity.statusStunned: actions = sequence(color(Color.YELLOW), delay(0.2f), color(Color.ORANGE), delay(0.1f), color(Color.YELLOW), delay(0.2f), color(Color.ORANGE), delay(0.1f), color(Color.YELLOW), delay(0.2f), color(Color.ORANGE), delay(0.1f), color(Color.YELLOW), delay(0.2f), color(Color.ORANGE), delay(0.1f), color(Color.WHITE), delay(0.1f), run(new Runnable() { @Override public void run() { setStatus(BattleEntity.statusNormal); } })); this.addAction(actions); break; case BattleEntity.statusFrozen: this.status = statusStunned; actions = sequence(color(Color.BLUE), delay(0.05f), color(Color.CLEAR), delay(0.05f), color(Color.BLUE), delay(0.05f), color(Color.CLEAR), delay(0.05f), run(new Runnable() { @Override public void run() { setHp(getHp() - 10); } }), color(Color.BLUE), delay(0.05f), color(Color.CLEAR), delay(0.05f), color(Color.BLUE), delay(0.05f), color(Color.CLEAR), delay(0.05f), run(new Runnable() { @Override public void run() { setHp(getHp() - 10); } }), color(Color.BLUE), delay(0.05f), color(Color.CLEAR), delay(0.05f), color(Color.BLUE), delay(0.05f), color(Color.CLEAR), delay(0.05f), run(new Runnable() { @Override public void run() { setHp(getHp() - 10); } }), color(Color.WHITE), run(new Runnable() { @Override public void run() { setState(BattleEntity.statusNormal); } })); this.addAction(actions); break; case BattleEntity.statusPoisoned: actions = sequence(color(Color.MAGENTA), delay(0.2f), color(Color.GREEN), delay(0.2f), color(Color.MAGENTA), delay(0.2f), color(Color.GREEN), delay(0.2f), color(Color.WHITE), fadeIn(0.3f), run(new Runnable() { @Override public void run() { setHp(getHp() - 5); } }), color(Color.MAGENTA), delay(0.2f), color(Color.GREEN), delay(0.2f), color(Color.MAGENTA), delay(0.2f), color(Color.GREEN), delay(0.2f), color(Color.WHITE), fadeIn(0.3f), run(new Runnable() { @Override public void run() { setHp(getHp() - 5); } }), color(Color.MAGENTA), delay(0.2f), color(Color.GREEN), delay(0.2f), color(Color.MAGENTA), delay(0.2f), color(Color.GREEN), delay(0.2f), color(Color.WHITE), fadeIn(0.3f), run(new Runnable() { @Override public void run() { setHp(getHp() - 5); } }), color(Color.MAGENTA), delay(0.2f), color(Color.GREEN), delay(0.2f), color(Color.MAGENTA), delay(0.2f), color(Color.GREEN), delay(0.2f), color(Color.WHITE), fadeIn(0.3f), run(new Runnable() { @Override public void run() { setHp(getHp() - 5); } }), color(Color.MAGENTA), delay(0.2f), color(Color.GREEN), delay(0.2f), color(Color.MAGENTA), delay(0.2f), color(Color.GREEN), delay(0.2f), color(Color.WHITE), fadeIn(0.3f), run(new Runnable() { @Override public void run() { setHp(getHp() - 5); } }), color(Color.WHITE), run(new Runnable() { @Override public void run() { setState(BattleEntity.statusNormal); } })); this.getActions().clear(); this.addAction(actions); break; } }
From source file:net.k3rnel.unsealed.battle.enemies.Xios.java
License:Open Source License
@Override public void setState(int state) { super.setState(state); switch (state) { case BattleEntity.stateIdle: BattleGrid.timer.scheduleTask(nextTask(), BattleGrid.random.nextInt(5)); break;//from www . ja v a2s . com case BattleEntity.stateAttacking: actions = sequence(color(Color.YELLOW), delay(0.2f), color(Color.ORANGE), delay(0.1f), color(Color.YELLOW), delay(0.2f), color(Color.ORANGE), delay(0.1f), color(Color.WHITE), delay(0.1f)); this.addAction(actions); break; case BattleEntity.stateAltAttacking: actions = sequence(color(Color.GREEN), delay(0.1f), color(Color.YELLOW), delay(0.1f), color(Color.GREEN), delay(0.1f), color(Color.YELLOW), delay(0.1f), color(Color.WHITE), delay(0.1f)); this.addAction(actions); break; } }