You are viewing our Forum Archives. To view or take place in current topics click here.
[JAVA] Basic Pokemon RPG
Posted:
[JAVA] Basic Pokemon RPGPosted:
Status: Offline
Joined: Apr 06, 201014Year Member
Posts: 120
Reputation Power: 9
A basic Pokemon RPG game when the map changes it's because i hit the 'm' key which changes the map this is the code used for maps atm until i can think of a better way of doing it.
package org.requa.pokemon.maps;
import java.awt.Graphics2D;
import java.awt.Toolkit;
import java.util.HashMap;
import org.requa.pokemon.objects.ObjectType;
public class Map0 {
static HashMap<Integer, ObjectType> objects = new HashMap<Integer, ObjectType>();
public static String[] objectType = {
"Background", "Clipped", "Clipped", "Clipped"
};
public static String[] locations = {
"C:/sprites/background.png", "C:/sprites/sprites/1.png",
"C:/sprites/sprites/3.png", "C:/sprites/sprites/2.png"
} ;
public static int[] x = {
0, 100, 300, 400
};
public static int[] y = {
0, 150, 100, 60
};
public static boolean mapIsLoaded = false;
public static void drawMap(Graphics2D g) {
for(int i = 0; i < objects.size(); i++) {
g.drawImage(Toolkit.getDefaultToolkit().getImage(objects.get(i).image), objects.get(i).x, objects.get(i).y, null);
if(i == objects.size()) {
mapIsLoaded = true;
}
}
}
public static void loadMap(Graphics2D g) {
if(!mapIsLoaded) {
for(int i = 0; i < locations.length; i++) {
objects.put(i, new ObjectType(locations[i], x[i], y[i], objectType[i]));
}
drawMap(g);
}
}
}
#2. Posted:
Status: Offline
Joined: May 22, 201113Year Member
Posts: 235
Reputation Power: 9
Status: Offline
Joined: May 22, 201113Year Member
Posts: 235
Reputation Power: 9
nice, but your code is next to useless, because we do not have the package that contains the maps. We also do not have your images.
- 0useful
- 0not useful
#3. Posted:
Status: Offline
Joined: Apr 06, 201014Year Member
Posts: 120
Reputation Power: 9
I weren't giving the code out, but I was giving a demonstration of how i make maps.
- 0useful
- 0not useful
#4. Posted:
Status: Offline
Joined: May 22, 201113Year Member
Posts: 235
Reputation Power: 9
Status: Offline
Joined: May 22, 201113Year Member
Posts: 235
Reputation Power: 9
I see. If/when you are done could you let me see some of the code, to study it. I am pretty good, but I can not do animations and such when the picture changes. Also I would like to know the best way to communicate between multiple classes at once. If you wouldn't mind I would appreciate it. And I hope you continue this nice work.
- 0useful
- 0not useful
#5. Posted:
Status: Offline
Joined: Apr 06, 201014Year Member
Posts: 120
Reputation Power: 9
If you give me your MSN or something I could help you if you want it.
- 0useful
- 0not useful
You are viewing our Forum Archives. To view or take place in current topics click here.