Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.mygdx.game;
- import com.badlogic.gdx.Gdx;
- import com.badlogic.gdx.graphics.Color;
- import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
- import com.badlogic.gdx.graphics.glutils.ShapeRenderer.ShapeType;
- public class Cube {
- float d;
- float f;
- float widght;
- float height;
- float time_delta;
- float time;
- Color color;
- ShapeRenderer shape;
- boolean moving = true;
- boolean is_destroyed = false;
- public void create() {
- shape = new ShapeRenderer();
- d = 50;
- f = 50;
- widght = 50;
- height = 50;
- time = 0;
- }
- public void update() {
- time_delta = Gdx.graphics.getDeltaTime();
- time += time_delta;
- if (moving == true) {
- d += 2;
- }
- if (time > 2) {
- moving = false;
- }
- }
- public void render() {
- update();
- shape.begin(ShapeType.Filled);
- shape.setColor(Color.CHARTREUSE);
- shape.rect(d = 100, f = 10, widght, height);
- shape.rect(d = 200, f = 10, widght, height);
- shape.end();
- }
- public void dispose() {
- shape.dispose();
- }
- public void setPos(float new_d, float new_f) {
- d = new_d;
- f = new_f;
- }
- public void destroy() {
- is_destroyed = true;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement