HELP PLZ...SCROLLING CUBES
k i have this cube and i have it scrolling down i need it to be set up as a bunch of random cubes scrolling from the left is there someone that can help me on this...here is the coding if u r able to help me out that will be very cool im stuck and this is really challenging me and i really want this to work...thank you very much
import java.awt.*;
public class Cube
private final int xLeft; // Left margin for cubes
private final int cubeSize;
private int cubeX, cubeY; // Cube coordinates (upper left corner)
private int yStep; // Distance (in pixels) to move down
// in one timer cycle
private int xStep;
public Cube(int size)
cubeSize = size;
xLeft = cubeSize / 2;
yStep = cubeSize / 8;
xStep = cubeSize / 8;
cubeX = -cubeSize; // off the board --
cubeY = -cubeSize; // not displayed
public void start()
//int i = (int)(Math.random() * letters.length());
//randomLetter = letters.charAt(i);
cubeX = 0;
cubeY = -cubeSize; // above the board for smooth entry
public boolean moveDown()
if (cubeY < 9 * cubeSize) // board's height is 10 * cubesize
cubeY += yStep;
return true;
else // land this cube:
return false;
public boolean moveRight()
cubeX += xLeft;
return true;
public boolean moveLeft()
cubeX -= xLeft;
return true;
public void draw(Graphics g)
int x = xLeft + cubeX;
int y = cubeY;
g.setColor(Color.gray);
g.fill3DRect(x, y, cubeSize-1, cubeSize-1, true);
//g.setColor(Color. white);
//g.fillRoundRect(x + 5, y + 5, cubeSize - 10, cubeSize - 10,
// cubeSize/2 - 5, cubeSize/2 - 5);
//g.setColor(Color.darkGray);
}
ok here is all of my coding i need to make some sort of blocks or cubes a platform im guessing like that helicopter game where u have to dodge the random platforms and or blocks that come from tha left of the screen i kno its a scroll...im just tryin to basically make the same game for my class and its for a grade and im stuck i have the files one is called cube.java GamePanel.java and Tetrus.java it has nothin to do with tetris tho idk y my group named it that but wut we r tryin to do is get a scrolling platform with random cubes of some sort and when the object that we r making hits this cube or platform it says game over or wutever we will make it....if u need more info plz contact me on my AIM SN or E-Mail Address thank you sooo much
AIM SN: DialectInsn & KonphuzedArsnist
E-Mail: [email protected] & [email protected]
here r the files that u asked for too....
cube.java
import java.awt.*;
public class Cube
private final int xLeft; // Left margin for cubes
private final int cubeSize;
private int cubeX, cubeY; // Cube coordinates (upper left corner)
private int yStep; // Distance (in pixels) to move down
// in one timer cycle
private int xStep;
public Cube(int size)
cubeSize = size;
xLeft = cubeSize / 2;
yStep = cubeSize / 8;
xStep = cubeSize / 8;
cubeX = -cubeSize; // off the board --
cubeY = -cubeSize; // not displayed
public void start()
//int i = (int)(Math.random() * letters.length());
//randomLetter = letters.charAt(i);
cubeX = 0;
cubeY = -cubeSize; // above the board for smooth entry
public boolean moveDown()
if (cubeY < 9 * cubeSize) // board's height is 10 * cubesize
cubeY += yStep;
return true;
else // land this cube:
return false;
public boolean moveRight()
cubeX += xLeft;
return true;
public boolean moveLeft()
cubeX -= xLeft;
return true;
public void draw(Graphics g)
int x = xLeft + cubeX;
int y = cubeY;
g.setColor(Color.gray);
g.fill3DRect(x, y, cubeSize-1, cubeSize-1, true);
//g.setColor(Color. white);
//g.fillRoundRect(x + 5, y + 5, cubeSize - 10, cubeSize - 10,
// cubeSize/2 - 5, cubeSize/2 - 5);
//g.setColor(Color.darkGray);
}GamePanel.java
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class GamePanel extends JPanel
implements ActionListener, KeyListener
private Cube cube;
private final int CUBESIZE = 25;
private final int delay = 80;
private Timer t;
public GamePanel()
cube = new Cube(CUBESIZE);
t = new Timer(delay, this);
addKeyListener(this);
public void dropCube()
cube.start();
t.start();
* Processes timer events
public void actionPerformed(ActionEvent e)
boolean moved = cube.moveDown();
if (!moved) // "If not moved... "
t.stop();
repaint();
this.grabFocus();
public void paintComponent(Graphics g)
super.paintComponent(g); // call JPanel's paintComponent
cube.draw(g);
public void keyTyped(KeyEvent e)
public void keyPressed(KeyEvent e)
public void keyReleased(KeyEvent e)
int id = e.getKeyCode();
if( id == KeyEvent.VK_RIGHT )
cube.moveRight();
repaint();
else if( id == KeyEvent.VK_LEFT )
cube.moveLeft();
repaint();
else
}Tetris.java -remember has nothing to do with the tetris game....it is just the game board....
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class Tetris extends JFrame
implements ActionListener
private GamePanel gameboard;
private JButton go;
public Tetris()
gameboard = new GamePanel();
gameboard.setBackground(Color.black );
go = new JButton("Go");
go.addActionListener(this);
Container c = getContentPane();
c.add(gameboard, BorderLayout.CENTER);
c.add(go, BorderLayout.SOUTH);
super.setSize(1000,1000);
super.setTitle("MAZE");
super.setVisible(true);
super.setResizable(false);
public static void main(String args[])
Tetris r = new Tetris();
public void actionPerformed(ActionEvent e)
gameboard.dropCube();
}thanks for all your help....
Similar Messages
-
Hello, While I compile my java file I get the :
I:\............. >javac ObjCreatorV1.java
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.After that : i get the:
I:\........................>javac -Xlint ObjCreatorV1.java
ObjCreatorV1.java:40: warning: [serial] serializable class ObjCreatorV1 has no definition of serialVersionUID
public class ObjCreatorV1 extends JFrame {
^
1 warningWhat does it mean?? It´s ok, I can still run it, and it´s just fine, but I´m wondering if that warning is the reason why I can´t make a .jar out of it.
Actually I create the .jar file but it doesn´t run, it just makes a ding noise, and nothing more.
Some help plz... =)I just put
public static final long serialVersionUID = 1L; in all my classes and now I get the following....:
I:\Documents and Settings\Universidad\Mis documentos\ObjCreator v1.0>javac -Xlint ObjCreatorV1.java
.\Point.java:58: warning: [deprecation] readLine() in java.io.DataInputStream has been deprecated inLine=dis.readLine();
^
.\Cube.java:38: warning: [deprecation] readLine() in java.io.DataInputStream has been deprecated inLine=dis.readLine();
^
.\SimpleLine.java:33: warning: [deprecation] readLine() in java.io.DataInputStream has been deprecated inLine=dis.readLine();
^
.\Line.java:35: warning: [deprecation] readLine() in java.io.DataInputStream has been deprecated inLine=dis.readLine();
^
.\Pyramid.java:35: warning: [deprecation] readLine() in java.io.DataInputStream has been deprecated inLine=dis.readLine();
^
.\Cone2.java:80: warning: [deprecation] readLine() in java.io.DataInputStream has been deprecated inLine=dis.readLine();
^
.\Cylinder1.java:88: warning: [deprecation] readLine() in java.io.DataInputStream has been deprecated inLine=dis.readLine();
^
.\Plane.java:35: warning: [deprecation] readLine() in java.io.DataInputStream has been deprecated inLine=dis.readLine();
^
.\PlaneV.java:33: warning: [deprecation] readLine() in java.io.DataInputStream has been deprecated inLine=dis.readLine();
^
.\PlaneH.java:33: warning: [deprecation] readLine() in java.io.DataInputStream has been deprecated inLine=dis.readLine();
^
.\PlaneP.java:31: warning: [deprecation] readLine() in java.io.DataInputStream has been deprecated inLine=dis.readLine();
^
.\Parallelepiped.java:32: warning: [deprecation] readLine() in java.io.DataInputStream has been deprecated inLine=dis.readLine();
^
.\Prisma6.java:31: warning: [deprecation] readLine() in java.io.DataInputStream has been deprecated inLine=dis.readLine();
^
13 warningspfffff
I also tried to use
BufferedReader dis = new BufferedReader(new InputStreamReader(in));But that gives me errors that i can´t solve either...
help...... :S
Edited by: epp1227 on Mar 18, 2009 4:46 AM -
Im new to the 5g ipod help plz
will the ipod turn off if i leave it on pause? i know i have a really stupid question but help plz thx
Yes.
-
My Apple TV is not working. On tv display, I'm getting a message 'unsupported signal. Check your device output. ' Can anyone help plz.
connect it to a tv which support full hd and go into the settings and lower the resolution as much as possible and then connect it with your tv once more
-
I have just getting a new phone and I have forgot my password an Apple ID what I made new for the new phone now I cannot get on it because asking for id and password what should I do help plz thank u
Try
https://iforgot.apple.com -
i lost my phone and i got an unlocked 4s from my gf she used it before an its still connected to her icloud is there a way i can restore my icloud back up to replace hers without messing up the unlock also my latest backup isnt showing on my pc help plz!!
Please please help me, if you know how.
-
I cant get voice over to work on my 4G shuffle it clicks off every time help plz
i need help plz it wont work
Hello,
Welcome to Adobe Forums.
Try uninstalling Adobe Flash Player from Flash Player uninstaller : http://helpx.adobe.com/flash-player/kb/uninstall-flash-player-mac-os.html#main_uninstall
Try a clean installation using this KB : http://helpx.adobe.com/content/help/en/flash-player/kb/installation-problems-flash-player- mac.html
Thanks,
Vikram -
Help Plz.......!!!!its urgent
hi nokia users
flash lite on my 5530 only plays youtube videos,and when tried to play videos on other sites then it says flash player is required............do ui use any software that supports web videos...???
help plz.....
thanks in advanceFalshplayer vedio cant acces in your device?
-
help plz so my gf said she block me and we txt back to back but later on i sent her a messages and it said it was read so am I blocked
The proper way to close Firefox is through the File menu "Exit" or the equivalent with the Firefox button.
More detail in item '''#38 Firefox already running '''
of
[http://dmcritchie.mvps.org/firefox/firefox-problems.htm#fx4interface Fix Firefox 4.0 toolbar user interface, problems (Make Firefox 4.0 look like 3.6) (#fx4interface)]
Firefox already running, to properly shutdown Firefox when closing the last window use File → Exit/Quit (or Firefox button → Exit). Closing Firefox with the [X] in the upper right corner closes the window ("Ctrl+W") but that does not necessarily close Firefox if it has subtasks running. If you want to close and reopen Firefox use the "Restart" within Add-ons if you made a change requiring a restart, or install "[https://addons.mozilla.org/firefox/addon/restartless-restart/ Restartless Restart]" ("Ctrl+Alt+R") which will allow you to take Firefox down and restart without having to check the Windows Task Manager to see if Firefox first actually ended. [http://kb.mozillazine.org/Firefox_hangs Firefox hangs] -
Help plz, i need back up my phone
Help plz, i have iphone 4 i still have icloud on my itunes and i need to update it to the new one but i dont want to lose any of my pictues of my kids im not sure if ive backed it up before if i have it would of been a long time ago plz help me thanks
jennyspeedy* wrote:
i dont want to lose any of my pictues of my kids im not sure if ive backed it up before if i have it would of been a long time ago plz help me thanks
Then use the device as designed. Copy the pictures off the device to the computer. For any pictures that you desire to keep on the device, simply sync them via iTunes.
Failure to copy the pictures off the device is only asking for problems. If the device is ever lost/stolen or simply fails to work, without a backup they would be gone as well. -
Help Plz i've blank LCD in Lenovo G530
Help Plz i've blank LCD in Lenovo G530
the unit is working and the power & wireless indicators is on but the LCD is blank
i've allready unpluged the battery and powered the unit with the charger only and plug the battery again but still have the same problem.
so plz advice what to do ?????Try to plug in external monitor and look if anything shows. Then try to check monitor configuration. Maybe it is switched off...
Regards,
Publius
Lenovo 3000 V200 -
i forgot my password, and i want to unlock it without losing my data, can anyone help plz???
You can't. It is a good security feature. You have to connect the iPod to yur computer and restore via iTunes.
-
ok so when i try to play my songs on itunes no matter where it was downloaded from (itunes or another source) it wont play. it will act like it was going to play and then freeze at 00:00. i tried re-installing it and deleting my itunes library and putting it back on but nothing has worked. my sound is fine because it makes that noise when i turn on the computer and such. help plz.
You can get iTunes here: http://www.apple.com/itunes/
You will also need the iPod Updater:http://www.apple.com/ipod/download/ -
How can we create a Collective search help plz tell me with steps
How can we create a Collective search help plz tell me with steps
thanks,
basuHi
1) Elementary search helps describe a search path. The elementary search help must define where the data of the hit list should be read from (selection method), how the exchange of values between the screen template and selection method is implemented (interface of the search help) and how the online input help should be defined (online behavior of the search help).
2) Collective search helps combine several elementary search helps. A collective search help thus can offer several alternative search paths.
3)An elementary search help defines the standard flow of an input help.
4) A collective search help combines several elementary search helps. The user can thus choose one of several alternative search paths with a collective search help.
5)A collective search help comprises several elementary search helps. It combines all the search paths that are meaningful for a field.
6)Both elementary search helps and other search helps can be included in a collective search help. If other collective search helps are contained in a collective search help, they are expanded to the level of the elementary search helps when the input help is called.
CREATION:
Go to SE11 Tcode
select search help
give the 'z' search help name and create
select the selection method ur table name eg : 'mara'
dialog module 'display value immediately'.
add the field whatever u want and lpos = 1 and spos = 1 and check import and export parameter.
where left position when displaying and spos = search position
and then save and activate ..
See the links:
http://help.sap.com/saphelp_nw04/helpdata/en/cf/21ee38446011d189700000e8322d00/content.htm
http://help.sap.com/saphelp_nw04/helpdata/en/cf/21ee45446011d189700000e8322d00/content.htm
pls go through this for search help creation
http://help.sap.com/saphelp_nw2004s/helpdata/en/41/f6b237fec48c67e10000009b38f8cf/content.htm
Search Help Exits:
Re: dynamic values for search help
Re: Dynamic search help
Reward points for useful Answers
Regards
Anji -
LASERJET M1217 nfw MFP urgent help plz
HAY GUYS, NEED URGENT HELP!!!!!!!!!
My printer M1217 nfw MFP had a problem with the scanner and it was fixed bu updating the firmware and the scanner works fine and offcourse i printed the config. report befor updating the firmware , the problem is that i lost the report and i cant config. the fax or the wirless connection . any help plz guyskelsaeed wrote:
HAY GUYS, NEED URGENT HELP!!!!!!!!!
My printer M1217 nfw MFP had a problem with the scanner and it was fixed bu updating the firmware and the scanner works fine and offcourse i printed the config. report befor updating the firmware , the problem is that i lost the report and i cant config. the fax or the wirless connection . any help plz guys -
I was using my ipod 4th gen and it just stopped working..help plz?
i was using my ipod 4th gen and it just stopped working..help plz?
Try restoring...
iTunes: Backing up, updating, and restoring your iPhone, iPad, or iPod touch software
If you can't restore the iPod...
Apple - Support - iPod - Service FAQ
Maybe you are looking for
-
I have two computers in my home authorised for Home Sharing - I have no problems locating the other library on either of my computers. However, when I am on iTunes in Computer A and I click onto Computer B's music library (so that I can transfer musi
-
What do I need to do to correct the problem. Unistalling and reinstalling iTunes has not helped. I have PowerToGo on my HP. I can burn through this program but want to do so by iTunes. Any Suggestions that would help? Diagnostics for iTunes states th
-
How do I open pdf files stored in iCloud from iMac preview app on my iPad
I save a PDF file to iCloud using Preview on my iMac or MacBook Pro. What app opens this on my iPad? Numbers files I open w numbers, pages with pages, but what on the iPad opens Preview app pdf files that are stored in iCloud?
-
Stumped with SwingWorker -- code compiles but doesn't run right
Okay, sorry to post a ton of code, but I'm creating a swing gui that will use swing worker to create an object of the followng class, one method that sleeps and returns a random number: public class BigJob{ public int doBigJob(){ try {
-
Did an erase and install on my iMac G5 of Leopard, then installed Backup 3.1.2. It has not stopped since. The screen just keeps popping up, even though I have it backing up weekly. I can "force quit" it, but it simply arises from the dead, demanding