Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

[improvement] rails in base do u-turn #731

Merged
merged 2 commits into from

3 participants

@Elosanda

also changed levels to reflect this

see issue #724

@Elosanda

you can build a closed circle where the RailBots float without collisions. thats not possible with the old rail connection

@danielduner

The big advantage that I see is that it makes it possible (and encourages) a big loop for the rail droids. Instead of the insane back-and-forth bouncing. If we just fix #608 as well, the droids will almost be functional.

@master-lincoln
Collaborator

convinced...

@danielduner

As the response in #724 was very positive as well, I'll just go ahead and merge this. Blame me if anything goes wrong!

@danielduner danielduner merged commit c3ad102 into Maescool:develop
@master-lincoln
Collaborator

Again daniel?
Remember the last time you said that... ^^

@danielduner

The one merging a commit is responsible. I probably should test the code first, but I'm too lazy. So instead, I just jump in head first and wait for the shit to hit the fan!

@Elosanda

we must have punishment for such reckless behavior ;)
i will also look into #608

@master-lincoln
Collaborator

getting out his umbrella to shield the shit ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
View
BIN  res/levels/AsymeTrical.bmp
Binary file not shown
View
BIN  res/levels/BlackHole.bmp
Binary file not shown
View
BIN  res/levels/CataBOMB.bmp
Binary file not shown
View
BIN  res/levels/Circular Shapes.bmp
Binary file not shown
View
BIN  res/levels/DevMap.bmp
Binary file not shown
View
BIN  res/levels/RailRoads.bmp
Binary file not shown
View
BIN  res/levels/Siege.bmp
Binary file not shown
View
BIN  res/levels/TheMaze.bmp
Binary file not shown
View
BIN  res/levels/level1.bmp
Binary file not shown
View
88 src/com/mojang/mojam/level/Level.java
@@ -304,55 +304,61 @@ public void render(Screen screen, int xScroll, int yScroll) {
Notifications.getInstance().render(screen);
}
-
+
private void renderTilesAndBases(Screen screen, int x0, int y0, int x1, int y1){
- // go through each currently visible cell
+ // go through each currently visible cell
for (int y = y0; y <= y1; y++) {
- for (int x = x0; x <= x1; x++) {
-
- // draw sand outside the level
- if (x < 0 || x >= width || y < 0 || y >= height) {
- screen.blit(Art.floorTiles[5][0], x * Tile.WIDTH, y
- * Tile.HEIGHT);
- continue;
- }
-
- // if we are in the center area (4*7 Tiles): draw player bases
- int xt = x - (width / 2) + 4;
- int yt = y - 4;
- if (xt >= 0 && yt >= 0 && xt < 7 && yt < 4 && (xt != 3 || yt < 3)) {
- screen.blit(Art.getPlayerBase(getPlayerCharacter(1))[xt][yt], x * Tile.WIDTH, y
- * Tile.HEIGHT);
- continue;
- }
-
- yt = y - (height - 8);
- if (xt >= 0 && yt >= 0 && xt < 7 && yt < 4 && (xt != 3 || yt > 0)) {
- screen.blit(Art.getPlayerBase(getPlayerCharacter(0))[xt][yt], x * Tile.WIDTH, y * Tile.HEIGHT);
- if ((xt == 0 || xt == 1 || xt == 5 || xt == 6) && yt == 0) {
- screen.blit(Art.shadow_north, x * Tile.WIDTH, y * Tile.HEIGHT);
- }
- if ((xt == 2) && yt == 0) {
- screen.blit(Art.shadow_north_west, x * Tile.WIDTH, y * Tile.HEIGHT);
- }
- if ((xt == 4) && yt == 0) {
- screen.blit(Art.shadow_north_east, x * Tile.WIDTH + Tile.WIDTH - Art.shadow_east.w, y * Tile.HEIGHT);
- }
- continue;
- }
-
- if (canSee(x, y)) {
- tiles[x + y * width].render(screen);
- }
- }
- }
+ for (int x = x0; x <= x1; x++) {
+
+ // draw sand outside the level
+ if (x < 0 || x >= width || y < 0 || y >= height) {
+ screen.blit(Art.floorTiles[5][0], x * Tile.WIDTH, y
+ * Tile.HEIGHT);
+ continue;
+ }
+
+ // if we are in the center area (4*7 Tiles): draw player bases
+ int xt = x - (width / 2) + 4;
+ int yt = y - 4;
+
+ if (xt >= 0 && yt >= 0 && xt < 7 && yt < 4 && (isNotBaseRailTile(xt) || yt < 3)) {
+ screen.blit(Art.getPlayerBase(getPlayerCharacter(1))[xt][yt], x * Tile.WIDTH, y
+ * Tile.HEIGHT);
+ continue;
+ }
+
+ yt = y - (height - 8);
+ if (xt >= 0 && yt >= 0 && xt < 7 && yt < 4 && (isNotBaseRailTile(xt) || yt > 0)) {
+ screen.blit(Art.getPlayerBase(getPlayerCharacter(0))[xt][yt], x * Tile.WIDTH, y * Tile.HEIGHT);
+ if ((xt == 0 || xt == 1 || xt == 5 || xt == 6) && yt == 0) {
+ screen.blit(Art.shadow_north, x * Tile.WIDTH, y * Tile.HEIGHT);
+ }
+ if ((xt == 2) && yt == 0) {
+ screen.blit(Art.shadow_north_west, x * Tile.WIDTH, y * Tile.HEIGHT);
+ }
+ if ((xt == 4) && yt == 0) {
+ screen.blit(Art.shadow_north_east, x * Tile.WIDTH + Tile.WIDTH - Art.shadow_east.w, y * Tile.HEIGHT);
+ }
+ continue;
+ }
+
+ if (canSee(x, y)) {
+ tiles[x + y * width].render(screen);
+ }
+ }
+ }
}
-
+
private GameCharacter getPlayerCharacter(int playerID){
Player player = MojamComponent.instance.players[playerID];
if (player == null) return GameCharacter.None;
else return player.getCharacter();
}
+
+ private boolean isNotBaseRailTile(int xt){
+ return (xt != 2 && xt != 3 && xt != 4);
+ }
+
private void renderTopOfWalls(Screen screen, int x0, int y0, int x1, int y1){
for (int y = y0; y <= y1; y++) {
View
7 src/com/mojang/mojam/level/gamemode/GameMode.java
@@ -120,9 +120,10 @@ protected void setupPlayerSpawnArea() {
newLevel.addEntity(new ShopItemHarvester(32 * (newLevel.width / 2 - .5), (newLevel.height - 4.5) * 32, Team.Team1));
newLevel.addEntity(new ShopItemBomb(32 * (newLevel.width / 2 + .5), (newLevel.height - 4.5) * 32, Team.Team1));
-
- newLevel.setTile((newLevel.width / 2) - 1, 7, new UnbreakableRailTile(new SandTile()));
- newLevel.setTile((newLevel.width / 2) - 1, newLevel.height - 8, new UnbreakableRailTile(new SandTile()));
+ for (int i=0; i<3; i++){
+ newLevel.setTile((newLevel.width / 2) - i, 7, new UnbreakableRailTile(new SandTile()));
+ newLevel.setTile((newLevel.width / 2) - i, newLevel.height - 8, new UnbreakableRailTile(new SandTile()));
+ }
}
protected void setTickItems() {
Something went wrong with that request. Please try again.