Skip to content

Commit

Permalink
Synced Random addition
Browse files Browse the repository at this point in the history
  • Loading branch information
mbl111 committed Nov 12, 2012
1 parent 3c690b5 commit bdfd24b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
17 changes: 17 additions & 0 deletions GitHubGameJam2012/src/com/mbl111/ggo12/Util/SyncRandom.java
@@ -0,0 +1,17 @@
package com.mbl111.ggo12.Util;

import java.util.Random;

public class SyncRandom {

public static Random ran = new Random(System.currentTimeMillis());

public static int nextInt() {
return ran.nextInt();
}

public static int nextInt(int i) {
return ran.nextInt(i);
}

}
4 changes: 3 additions & 1 deletion GitHubGameJam2012/src/com/mbl111/ggo12/level/Level.java
Expand Up @@ -3,6 +3,7 @@
import java.util.ArrayList;
import java.util.List;

import com.mbl111.ggo12.Util.SyncRandom;
import com.mbl111.ggo12.entity.Entity;
import com.mbl111.ggo12.gfx.Screen;
import com.mbl111.ggo12.level.tile.Tile;
Expand All @@ -11,7 +12,7 @@ public class Level {

public byte[] data, tiles;
public int w, h;

public List<Entity>[] entitiesInTiles;
public List<Entity> entities = new ArrayList<Entity>();

Expand All @@ -22,6 +23,7 @@ public Level(int w, int h) {
this.h = h;
for (int i = 0; i < tiles.length; i++) {
tiles[i] = 0;
data[i] = (byte) SyncRandom.nextInt(4);
}
}

Expand Down

0 comments on commit bdfd24b

Please sign in to comment.