-
November 4th, 2003, 06:54 PM
#1
Member
Change Speed in Java
Ive got the code below and i want to change the speed of the action in the program, (in this case it draws a shape so i want the program to draw the shape faster)
import SpikeLib.*;
public class SpikeOctagon
{
public static void main (String args [] )
{
SpikeWindow window;
Spike mySpike;
mySpike = new Spike ();
window = new SpikeWindow ();
window.addSpike (mySpike);
mySpike.setColour (Spike.RED, Spike.PINK);
mySpike.moveNorth();
mySpike.moveNorthWest();
mySpike.moveWest();
mySpike.moveSouthWest();
mySpike.moveSouth();
mySpike.moveSouthEast();
mySpike.moveEast();
mySpike.moveNorthEast();
}
}
as im new to java i was thinking of inserting the following code into the program above
int speed = 0
for (int 1=0; i<5 ; i++)
{
speed = 50 x i ;
}
my query is would this little piece of code speed up the actions in the programs ? if so where in the program do i insert it ? or if im wrong what coding should i insert and where.
cheers
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|