Results 1 to 1 of 1
Thread: import sprite
- 08-28-2011, 12:15 PM #1
Member
- Join Date
- Aug 2011
- Posts
- 31
- Rep Power
- 0
import sprite
ok so ive been trying to create a simple meteor game, so far ive got a background and wanted to upload a sprite in the centre on the screen.
Java Code:package meteorz; import javax.swing.ImageIcon; import javax.swing.JFrame; import javax.swing.JLabel; /** * @author Bimz */ public class Meteorz extends JFrame { private JLabel lblBackground; private ImageIcon Background; Meteorz() { Background = new ImageIcon(getClass().getResource("http://www.java-forums.org/images/background.png")); lblBackground = new JLabel(Background); add(lblBackground); } public static void main(String[] args){ Meteorz Board = new Meteorz(); Board.setVisible(true); Board.setTitle("Meteorz - Bimz"); Board.setLocation(100, 60); Board.setSize(800, 600); Board.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Board.setResizable(false); } }
when i run the program the background pops up. However i got lost and dont have the slightest clue on what to do next and im assuming that i need getters and setters for all of the arguments in the 'Player' class. xPos being the x position on the screen, yPos is same. Width is width of my sprite(32 pixels), height(32 pixels) and img being the image of the sprite.Java Code:package meteorz; /** * @author Bimz */ public class Player { //tringle is 32x32 resolution public Player(final int xPos, final int yPos, final int width, final int height, final String img) { this.xPos = xPos; this.yPos = yPos; this.width = width; this.height = height; this.img = img; } public int setXPos() { } public int getXPos() { } public int setYPos() { } public int getYPos() { } public int setWidth() { } public int getWidth() { } public int setHeight() { } public int getHeight() { } public int setImg() { } public int getImg() { } }
help would be apreciated.gif)
Bimz
Similar Threads
-
Sprite-sheet vs individual images
By David M. in forum Java GamingReplies: 9Last Post: 08-13-2011, 08:02 PM -
Confisuion about sprite.getX() and sprite.getY()
By Basit781 in forum Java GamingReplies: 0Last Post: 01-10-2011, 06:16 AM -
Help with import
By eel in forum New To JavaReplies: 2Last Post: 09-19-2010, 10:51 AM -
Sprite Movement
By Curtiz in forum Java GamingReplies: 1Last Post: 04-26-2010, 01:31 PM -
[j2me] sprite rotation with degrees
By Rooneyz in forum CLDC and MIDPReplies: 0Last Post: 07-06-2009, 03:40 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks