Java-Gaming.org Hi !
 Featured games (91) games approved by the League of Dukes Games in Showcase (762) Games in Android Showcase (229) games submitted by our members Games in WIP (847) games currently in development
 News: Read the Java Gaming Resources, or peek at the official Java tutorials
JavaGaming.org - Pastebin

Author: hobbles (posted 2013-08-03 18:11:33, viewed 243 times)

 1   2   3   4   5   6   7   8   9   10   11   12   13   14   15   16   17   18   19   20   21   22   23   24   25   26   27   28   29   30   31   32   33   34 ```public boolean generateHeightMap(short x, short y, short xx, short yy) { if(xx - x < 2 || yy - y < 2) return false; short midX = (short) ((x + xx)/ 2); short midY = (short) ((y + yy)/ 2); rand = (x + xx)/ 2; if(map[midX][midY] == 0) map[midX][midY] = ((map[x][y] + map[x][yy] + map[xx][y] + map[xx][yy])/ 4) + noise(); try{ if(map[x][midY] == 0) map[x][midY] = ((map[x][y] + map[x][yy] + map[midX][midY] + map[x - midX][midY]) / 4) + noise(); // This aint working }catch(Exception e){if(map[x][midY] == 0) map[x][midY] = ((map[x][y] + map[x][yy] + map[midX][midY]) / 3) + noise();} //This is for going out of bounds in the array it only does 3 points try{ if(map[midX][y] == 0) map[midX][y] = ((map[x][y] + map[xx][y] + map[midX][midY] + map[midX][y - midY]) / 4) + noise(); }catch(Exception e){if(map[midX][y] == 0) map[midX][y] = ((map[x][y] + map[xx][y] + map[midX][midY]) / 3) + noise();} try{ if(map[xx][midY] == 0) map[xx][midY] = ((map[xx][y] + map[xx][yy] + map[midX][midY] + map[xx + midX][midY]) / 4) + noise(); }catch(Exception e){if(map[xx][midY] == 0) map[xx][midY] = ((map[xx][y] + map[xx][yy] + map[midX][midY]) / 3) + noise();} try{ if(map[midX][yy] == 0) map[midX][yy] = ((map[x][yy] + map[xx][yy] + map[midX][midY] + map[midX][yy + midY]) / 4) + noise(); }catch(Exception e){if(map[midX][yy] == 0) map[midX][yy] = ((map[x][yy] + map[xx][yy] + map[midX][midY]) / 3) + noise();} generateHeightMap(x, y, midX, midY); generateHeightMap(midX, y, xx, midY); generateHeightMap(x, midY, midX, yy); generateHeightMap(midX, midY, xx, yy); return true; }```

Special syntax:
• To highlight a line (yellow background), prefix it with '@@'
• To indicate that a line should be removed (red background), prefix it with '-'
• To indicate that a line should be added (green background), prefix it with '+'
• To post multiple snippets, seperate them by '~~~~'
EOF
 EgonOlsen (364 views) 2018-06-10 19:43:48 EgonOlsen (364 views) 2018-06-10 19:43:44 EgonOlsen (304 views) 2018-06-10 19:43:20 DesertCoockie (540 views) 2018-05-13 18:23:11 nelsongames (871 views) 2018-04-24 18:15:36 nelsongames (854 views) 2018-04-24 18:14:32 ivj94 (1306 views) 2018-03-24 14:47:39 ivj94 (426 views) 2018-03-24 14:46:31 ivj94 (1089 views) 2018-03-24 14:43:53 Solater (445 views) 2018-03-17 05:04:08
 Java Gaming Resourcesby philfrei2017-12-05 19:38:37Java Gaming Resourcesby philfrei2017-12-05 19:37:39Java Gaming Resourcesby philfrei2017-12-05 19:36:10Java Gaming Resourcesby philfrei2017-12-05 19:33:10List of Learning Resourcesby elect2017-03-13 14:05:44List of Learning Resourcesby elect2017-03-13 14:04:45SF/X Librariesby philfrei2017-03-02 08:45:19SF/X Librariesby philfrei2017-03-02 08:44:05
 java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org