First stage of development
Pre-releaseNow you can test this game
A little about:
The mechanics are crude and buggy, but playable
As you can see below, to touch the list or scroll through it,
you need to click on the button on the left
You can see a lot of boilerplate code, such as:
...
public class Construction implements MyScreen {
private ExtractSolarSys sys;
User user;
private Batch batch;
private ArrayList<MyButtons> myButtons;
private MyButtons myButton;
......
public class Inventory implements MyScreen {
...
private ExtractSolarSys sys;
User user;
private Batch batch;
private ArrayList<MyButtons> myButtons;
private MyButtons myButton;
...and:
// Construction
...
if (Gdx.input.isTouched() && isInPlaceMain(touchedX, touchedY, KNOB_X, BUTTON_HEIGHT,
KNOB_WIDTH, LIST_HEIGHT)) {
if (touchedY + knobHeight / 2 > LIST_HEIGHT + BUTTON_HEIGHT) {
touchedY = LIST_HEIGHT + BUTTON_HEIGHT - knobHeight / 2;
} else if (touchedY - knobHeight / 2 < BUTTON_HEIGHT) {
touchedY = BUTTON_HEIGHT + knobHeight / 2;
}
deltaFirstElementY = -listItems.get(0).y + (LIST_HEIGHT *
(BUTTON_HEIGHT - touchedY + knobHeight / 2) / knobHeight + BUTTON_HEIGHT);
for (int i = 0; i < listItems.size(); i++) {
listItems.get(i).y += deltaFirstElementY;
}
}
...// Research
...
if (Gdx.input.isTouched() && isInPlaceMain(touchedX, touchedY, KNOB_X, BUTTON_HEIGHT,
KNOB_WIDTH, LIST_HEIGHT)) {
if (touchedY + knobHeight / 2 > LIST_HEIGHT + BUTTON_HEIGHT) {
touchedY = LIST_HEIGHT + BUTTON_HEIGHT - knobHeight / 2;
} else if (touchedY - knobHeight / 2 < BUTTON_HEIGHT) {
touchedY = BUTTON_HEIGHT + knobHeight / 2;
}
deltaFirstElementY = -listItems.get(0).y + (LIST_HEIGHT
* (BUTTON_HEIGHT - touchedY + knobHeight / 2) / knobHeight + BUTTON_HEIGHT);
for (int i = 0; i < listItems.size(); i++) {
listItems.get(i).y += deltaFirstElementY;
}
}
...This is a bad practice.
While the classes
Inventory,Construction,Research,SelectingPlanetScreenandShopare implementations
of the once commonMy Screeninterface, which contains only one method, they use many of the same properties and methods.
This makes project less scalable and more complicated.
Also here you will find some fun things. For example, a meteorite will destroy (or not) one random building once an hour.
Here you have possibility to build buildings on several planets
Since mobile gamers like to cheat, I wanted to find a way to block any possibility of using the time-jump bug.
At that time, I saw the only option in requesting time from the server.
public static long getServerTime() throws Exception {
System.setProperty("http.agent", "Chrome");
String url = "https://time.is/Unix_time_now";
Document doc = Jsoup.parse(new URL(url).openStream(), "UTF-8", url);
String[] tags = new String[]{
"div[id=time_section]",
"div[id=clock0_bg]"
};
Elements elements = doc.select(tags[0]);
for (String tag : tags) {
elements = elements.select(tag);
}
return Long.parseLong(elements.text()) * 1000;
}


