Tiled Map With Three Layers
Sep 10, 2014
I am programming a tiled map with three layers, where I want to draw Tiles by Zorder, smallest - largest, I have got it to work for the top of the map, however the further you go down the other tiles end up always drawing over the character I have on screen:
map.jpg
What I should be defining my ZOrder value at, currently they are:
m_nZOrder = this.m_nLayer *(m_Image.getLocation().y + m_Image.getHeight());
I have also tried just doing it by using this as well:
m_nZOrder = m_Image.getLocation().y;
which gets problems like this : map1.jpg
View Replies
May 10, 2014
I'm trying to create a tile based map JPanel but all I get is a white screen. I'm fairly new to the Java Swing and AWT package so I've been watching tutorials on YouTube so learn as much as I can.
I've got three classes: Window.java which includes the Main method, Panel.java which is the JPanel and Tile.java to draw all the images into an array.
Window.java:
import javax.swing.JFrame;
public class Window extends JFrame {
public Window() {
setTitle("Project");
setSize(500, 400);
[Code] .....
I've checked through everything and still cannot find what I'm doing wrong. I did try different codes but I just got errors instead.
View Replies
View Related
May 10, 2014
I'm trying to create a tile based map JPanel but all I get is a white screen. I'm fairly new to the Java Swing and AWT package so I've been watching tutorials on YouTube so learn as much as I can. I don't know where I'm going wrong.
I've got three classes: Window.java which includes the Main method, Panel.java which is the JPanel and Tile.java to draw all the images into an array.
Window.java:
import javax.swing.JFrame;
public class Window extends JFrame {
public Window() {
setTitle("Project");
setSize(500, 400);
setLocationRelativeTo(null);
[Code] ....
Panel.java:
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Image;
import javax.swing.JPanel;
public class Panel extends JPanel implements Runnable {
private Image dbImage;
[code]....
I've checked through everything and still cannot find what I'm doing wrong. I did try different codes but I just got errors instead.
View Replies
View Related
Nov 21, 2014
I'm trying to make a method that takes an image and turns it into a tile image. So if the original image looks like this:
[URL] ....
then the output image should look like this:
[URL] ....
Here's a method that's supposed to do that but for some reason the output image looks the same as the original:
public static int[][] tile(int[][] arr){
int[][] tile = new int[arr.length][arr[0].length];
for (int i = 0; i < arr.length; i++) {
tile[i]=arr[i];
}
return tile;
}
I recently changed the method and the error message I'm getting is "bad operand types for binary operator '+'. Here's the method:
public static int[][] tile(int[][] arr){
int[][] tile = new int[arr.length][arr[0].length];
for (int i = 0; i < arr.length; i++) {
for(int j=0; j<arr[i].length;j++){
tile[j]=(tile[j])+(arr[i]);
}
}
return tile;
}
View Replies
View Related