Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (477)
Games in Android Showcase (107)
games submitted by our members
Games in WIP (534)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: 1 [2] 3 4 ... 10
 11 
 on: 2014-07-28 02:56:25 
Started by tommohawkaction - Last post by tommohawkaction
How do arraylist work? I can do arrays but not list?
also would that be the entire map or just a certain part? ( I want it a certain part

 12 
 on: 2014-07-28 02:46:52 
Started by tommohawkaction - Last post by CopyableCougar4
Well then you are gonna need to do this:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
public class Biome {

    private Tile[][] tilemap;
    private static Random random = new Random();

    public Biome(int width, int height, ArrayList<Tile> possible){
        tilemap = new Tile[width][height];
        for(int x = 0; x < width; x++){
           for(int y = 0; y < height; y++){
               tilemap[x][y] = possible.get(random.nextInt(possible.size() - 1);
           }
        }
    }

}


Now if you wanted weighted chances that is much more involved.

CopyableCougar4

 13 
 on: 2014-07-28 02:38:03 
Started by tommohawkaction - Last post by tommohawkaction
I would like it random though?

 14 
 on: 2014-07-28 02:27:33 
Started by tommohawkaction - Last post by CopyableCougar4
You could start with a base class called
Biome
which contains a
Tile
object that defines the base terrain and when the biome is created set all tiles to that base Tile object and the go from there

Basic Biome class
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
public class Biome {

    private Tile[][] tilemap;
    private Tile basetile;

    public Biome(int width, int height, Tile basetile){
        tilemap = new Tile[width][height];
        for(int x = 0; x < width; x++){
           for(int y = 0; y < height; y++){
               tilemap[x][y] = basetile;
           }
        }
        this.basetile = basetile;
    }

}


CopyableCougar4

 15 
 on: 2014-07-28 02:21:40 
Started by tommohawkaction - Last post by tommohawkaction
well lets start with a massive area covered in sand?

 16 
 on: 2014-07-28 02:18:28 
Started by tommohawkaction - Last post by LostWarrior
Well, that depends on what you define a biome. You can have a biome, which is just a way of defining what kinds of terrain are generated in a particular area or chunk of the world. But maybe it decides what kind of plants and trees are being generated or what kind of animals or mobs will be spawned. You've said you only want a sand biome and a grass biome. So I think you mean that the terrain or tiles in a chunk, will be grass or sand-only? In that case you only need to fill the array with either sand or grass, which can be done by using a for loop and set every index to sand or grass.

 17 
 on: 2014-07-28 02:09:14 
Started by CopyableCougar4 - Last post by CopyableCougar4
My attempt at a description of what I'm going for:

When blood needs to be added:
1  
2  
3  
4  
5  
6  
7  
8  
9  
for(distance from 1 to the given radius){
  for(angle from 0 to 360){
    dx = cos(angle in radians)
    dy = sin(angle in radians)
    if(random chance){
       add a particle at the given position
    }
  }
}


Updating the blood
1  
2  
3  
4  
for(Particle in particle arraylist){
  if the spread distance is less than 0 it "dies"
  spread the particle to the 8 surrounding locations, by cloning and reducing the life / spread distance
}


Rendering the blood
1  
2  
3  
for(Particle in particle){
  draw colored quad
}


When a particle is added there is also a check in the constructor to see if that particle collides with a wall. I hope I was descriptive enough Smiley

CopyableCougar4

 18 
 on: 2014-07-28 02:06:35 
Started by CopyableCougar4 - Last post by Slyth2727
No offense but... its kind of easier to just use someone else's wrapper. There is no point in rolling your own. Its very much a newbie perspective on things, to do everything yourself. I'm not saying you shouldn't, you really will learn a lot, but avoid rolling everything yourself whenever possible!

Why not just use Unity then?
When you create something yourself, you learn loads more.

 19 
 on: 2014-07-28 02:00:49 
Started by Andre Lopes - Last post by Andre Lopes
You can just use different project group for every project which is composed from many smaller projects - in this way everything is much cleaner. Smiley

Still annoying.
Because when you change project group, you cant access other projects code.

 20 
 on: 2014-07-28 01:44:22 
Started by CopyableCougar4 - Last post by alesky
JAXP (SAX and DOM) is a very old model for parser

the J2EE official parser now is JAXB and it is moved to JDK since version 1.6
no more need to write any rows of code to parse an XML

JAXB create beans that have a relation with the xml and load automaticaly the xml populating for you the bean
or can automatically serialize the bean in xml in case you need to save data

what you need is just an xsd that describre the xml, that is all

so you can also use a run time to save information in case

and it is standard Java

reference oracle documentation
http://www.oracle.com/technetwork/articles/javase/index-140168.html
 



Pages: 1 [2] 3 4 ... 10
 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

pw (35 views)
2014-07-24 01:59:36

Riven (33 views)
2014-07-23 21:16:32

Riven (21 views)
2014-07-23 21:07:15

Riven (24 views)
2014-07-23 20:56:16

ctomni231 (55 views)
2014-07-18 06:55:21

Zero Volt (47 views)
2014-07-17 23:47:54

danieldean (38 views)
2014-07-17 23:41:23

MustardPeter (43 views)
2014-07-16 23:30:00

Cero (59 views)
2014-07-16 00:42:17

Riven (56 views)
2014-07-14 18:02:53
HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54

HotSpot Options
by Roquen
2014-05-06 15:03:10

Escape Analysis
by Roquen
2014-04-29 22:16:43

Experimental Toys
by Roquen
2014-04-28 13:24:22
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
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!