Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (522)
Games in Android Showcase (127)
games submitted by our members
Games in WIP (590)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
   Home   Help   Search   Login   Register   
  Show Posts
Pages: [1]
1  Game Development / Game Play & Game Design / Re: SUI on: 2012-03-27 23:36:03
thank you davedes
2  Game Development / Game Play & Game Design / Re: SUI on: 2012-03-27 16:04:02
From a JFrame constructor call:

1  
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);



i need code that work in SlickUI
3  Game Development / Game Play & Game Design / SUI on: 2012-03-27 15:16:05
Do someone know how to close window or frame by button from window self?
4  Game Development / Newbie & Debugging Questions / Re: Serialize Image on: 2012-02-05 17:49:16
it work , thank you


how i couldn't get it early ?
5  Game Development / Newbie & Debugging Questions / Re: Serialize Image on: 2012-02-05 16:47:42
Actually i want to know how to save info about image into file.

I think about saving path,but how i can then restore it when i create object ?
6  Game Development / Newbie & Debugging Questions / Serialize Image on: 2012-02-05 15:06:04
Hi people !
i have a problem with this class.
I use class Pedestrian for creating units of different types, it inherited from class Unit ,what describe vehicles and units.
PTD is ingame "dictionary" of units, but actually I want to use it for creating "dictionaries" on hdd.
As you can see i tried use ObjectOutputStream/ObjectInputStream , IDe said:"Nope".
So how i can serialize it?

Unit
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  
import java.io.Serializable;
import org.newdawn.slick.Image;


abstract class Unit implements Serializable
{
    protected String uName;
    protected String uSpecName;
    protected String uRace;
    protected String uType;
    protected Image uActiveImage;
    protected String uActiveImageDest;
    protected Image uNorImage;
    protected String uNorImageDest;
    protected Image uSelImage;
    protected String uSelImageDest;
    protected String uComment;
    protected boolean uChosen=false;
    protected boolean uMoved;
    protected boolean uAttacked;
    protected int uFormCoordX;
    protected int uFormCoordY;
    protected int uCurCoordX;
    protected int uCurCoordY;
    protected String uAttacker;
    protected String uDefender;
   
    Unit()
    {
       
    }
}


Pedestrian
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  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
import java.io.IOException;
import java.io.Serializable;
import org.newdawn.slick.Image;
import org.newdawn.slick.Input;
import org.newdawn.slick.MouseListener;
import org.newdawn.slick.SlickException;
import org.newdawn.slick.util.pathfinding.Mover;

public class Pedestrian extends Unit implements Serializable, Mover
{
    private boolean pRunned=false;
    private int pWS;
    private int pBS;
    private int pS;
    private int pT;
    private int pW;
    private int pI;
    private int pA;
    private int pLD;
    private int pSV;
    private int pNSW;
    private Weapon pActiveWeapon;
   
    Pedestrian ()
    {
    }
    Pedestrian (String name,String type,String race,String image,String selimage,int pws,int pbs,int ps,int pt,int pw,int pi,int pa,int pld,int psv,int pnsw ) throws SlickException
    {
        uName=name;
        uRace=race;
        uType=type;
        uNorImageDest=image;
        uSelImageDest=selimage;
        uNorImage=new Image(uNorImageDest);
        uSelImage=new Image(uSelImageDest);
        pWS=pws;
        pBS=pbs;
        pS=ps;
        pT=pt;
        pW=pw;
        pI=pi;
        pA=pa;
        pLD=pld;
        pSV=psv;
        pNSW=pnsw;
    }
    Pedestrian (String name,String type,String race,String image,String selimage,int pws,int pbs,int ps,int pt,int pw,int pi,int pa,int pld,int psv,int pnsw,int cordX,int cordY) throws SlickException
    {
        uName=name;
        uRace=race;
        uType=type;
        uNorImage=new Image(image);
        uSelImage=new Image(selimage);
        pWS=pws;
        pBS=pbs;
        pS=ps;
        pT=pt;
        pW=pw;
        pI=pi;
        pA=pa;
        pLD=pld;
        pSV=psv;
        pNSW=pnsw;
        uCurCoordX=cordX;
        uCurCoordY=cordY;
    }

}


PTD
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  
35  
36  
37  
38  
39  
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.zip.GZIPInputStream;
import java.util.zip.GZIPOutputStream;
import org.newdawn.slick.SlickException;

public class PTD
{
    protected Pedestrian warior;
    protected Tech mahina;
    protected Weapon gun;
    protected List<Pedestrian> street = new ArrayList();
    protected List<Tech> warfare = new ArrayList();
    protected List<Weapon> weaponry = new ArrayList();
   
    PTD() throws SlickException, FileNotFoundException, IOException, ClassNotFoundException
    {
///=========PEDESTRIAN====
    //=pimp Tau=      
        chuvak = new Pedestrian("Fire Warrior", "Pedestrian", "Tau Empire", "Resources/Graphic/Tau/Firewarrior.png", "Resources/Graphic/Tau/FirewarriorSel.png", 2, 3, 5, 4, 2, 2, 2, 8, 2, 0);
        street.add(chuvak);
        FileOutputStream fos = new FileOutputStream("tau.Infantry");
        GZIPOutputStream gzos = new GZIPOutputStream(fos);
        ObjectOutputStream out = new ObjectOutputStream(fos);
        out.writeObject(warior);
        out.flush();
        out.close();
        FileInputStream fis = new FileInputStream("tau.Infantry");
        GZIPInputStream gzis = new GZIPInputStream(fis);
        ObjectInputStream in = new ObjectInputStream(fis);
        Pedestrian gelezen_veld = (Pedestrian)in.readObject();
        in.close();
}


7  Game Development / Newbie & Debugging Questions / Re: Right mouse button move on: 2011-11-15 20:37:28
thanks ra4king
8  Game Development / Newbie & Debugging Questions / Right mouse button move on: 2011-11-14 20:40:09
Hello people , again.

Thanks for you answers.

Now i have next question : Slick2d. How can i check if i press RBM and move it , how to calculate how much i move?
I mean x and y coordinates.
9  Game Development / Newbie & Debugging Questions / Re: Check colliding 1 unit with another on: 2011-11-01 20:49:58
rectangle vs rectangle
10  Game Development / Newbie & Debugging Questions / Check colliding 1 unit with another on: 2011-11-01 20:37:11
Hey people , i need your help .

I am making RTS i have 1 problem : how to check if 1 unit is colliding with another unit.

Give me idea  how to solve this problem.

Thnk you.
11  Game Development / Newbie & Debugging Questions / Re: Slick2d transitions on: 2011-11-01 19:55:25
Thanks Kova.
12  Game Development / Newbie & Debugging Questions / Slick2d transitions on: 2011-10-23 21:17:02
People , how to make transition from menu "Options" to menu " credits" using slick2d's states.
Pages: [1]
 

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

The first screenshot will be displayed as a thumbnail.

trollwarrior1 (29 views)
2014-11-22 12:13:56

xFryIx (71 views)
2014-11-13 12:34:49

digdugdiggy (50 views)
2014-11-12 21:11:50

digdugdiggy (44 views)
2014-11-12 21:10:15

digdugdiggy (38 views)
2014-11-12 21:09:33

kovacsa (62 views)
2014-11-07 19:57:14

TehJavaDev (67 views)
2014-11-03 22:04:50

BurntPizza (65 views)
2014-11-03 18:54:52

moogie (80 views)
2014-11-03 06:22:04

CopyableCougar4 (80 views)
2014-11-01 23:36:41
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06
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!