program not working
Author |
Message |
ahmhum
|
Posted: Mon Mar 24, 2008 5:46 pm Post subject: program not working |
|
|
this is what i have
//The "TIKRedRectSA" class.
import java.awt.*;
import java.awt.Color.*;
import hsa.Console;
public class MoveObject2
{
static Console c;
//Create custom color(s).
static Color red = new Color((252),(42),(42));
//Set custom color(s).
static Color skyBlue = new Color((124),(142),(234));
static Color brown = new Color((76), (75), (37));
}/*TIKBlueRectSA class*/
//Main method for the 'TIKredRectSA' class.
public static void main(String args[])
{
c=new Console(30,90);
c.setLocation(160,40);
//Set common integers.
int x=0;
int y=0;
//Calling upon the rectangle method.
{
background(x,y);
rectangleMain(x,y);
background(x,y);
}
}//main method
//This method draws a background.
public static void background(int x, int y)
{
//Set integers for background.
int width=c.getWidth();
int height =c.getHeight();
//Set color and draw the background.
c.setColor(Color.black);
c.fillRect(x,y,width, height);
}//background method
//This method create a delay.
public static void delay()
{
//Construct to create a delay.
try
{
Thread.sleep(100);
}
catch (InterruptedException e)
{
//Program reads the thread.
}
}//delay method
// This method draws rectangle.
public static void rectangle(int x, int y)
{
//set intergers for Circle
int widthc=c.getWidth()*6/100;
int heightc=c.getHeight()*33/1000;
//Set color and draw the Circle.
c.setColor(brown);
c.fillOval(x,y,widthc,heightc);
//set intergers for rectangle
int width=c.getWidth()*4/100;
int height=c.getHeight()*3/100;
//Set color and draw the rectangle.
c.setColor(brown);
c.fillRect(x,y,width,height);
c.setColor(Color.black);
c.drawRect(x,y,width,height);
}//rectangle method
// This method draws rectangle.
public static void rectangleMain(int x, int y)
{
for (x=0; x<=c.getWidth();x=x+c.getWidth()/20)
{
delay();
rectangle(x, y);
}
}//rectangle method
i am trying to make the bullet move without it leaving its trail behind and i don't know how to do it
can any1 help plzzz |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
Nick
![](http://compsci.ca/v3/uploads/user_avatars/19644337547e837b41d67a.png)
|
Posted: Mon Mar 24, 2008 6:21 pm Post subject: RE:program not working |
|
|
draw a rectangle before you draw the bullet the same color as the background
rectange -> bullet -> delay -> repeat |
|
|
|
|
![](images/spacer.gif) |
|
|