View Single Post
  #1 (permalink)  
Old 01-07-2008, 02:16 AM
BlitzA BlitzA is offline
Member
 
Join Date: Dec 2007
Posts: 11
BlitzA is on a distinguished road
Movement of balls
Hey, I'm trying to get two balls to more around inside the larger ball to create a ying yang sign that spins around while moving right. A little like the Hyduken on street fighter.

- My first problem is I can't stop the grey semi-circle flickering, I have stopped the blue semi-circle flickering with dWin.hold() and dWin.release() but this doesn't affect the second semi-circle for some reason.

- The second problem is that I need some idea of how to get the little circles moving in the right way around inside the bigger circle (made out of the semi-circles.

Cheers for any advise.

Code:
import java.awt.Color; import element.*; public class Hyduken { public static void pause(long waitTime) { long startTime = System.currentTimeMillis(); long stopTime = startTime + waitTime; while( System.currentTimeMillis() < stopTime) { //nothing goes here - meaning do nothing } } public static void main ( String[] Args ) { int x = 650; int y = 500; int y3 = 500; int x2 = 650; int y2 = 500; int degreestart = 100; int degreeend = 100; int degreestart2 = 100; int degreeend2 = 100; DrawingWindow dWin = new DrawingWindow( 1000, 1000 ); Rect Background = new Rect ( 0, 0, 1000, 1000 ); dWin.setForeground( Color.black ); dWin.draw( Background ); dWin.fill( Background ); while( x > 300) { dWin.setForeground( Color.blue ); Arc Arc1 = new Arc( x2-50, y2-50, 80, 80, degreestart -10, degreeend +80 ); dWin.fill( Arc1); dWin.setForeground( Color.blue ); Oval Oval1 = new Oval( x-30, y-50, 41, 41 ); dWin.fill( Oval1 ); dWin.setForeground( Color.gray ); Arc Arc2 = new Arc( x2-50, y2-50, 80, 80, degreestart2-190, degreeend2 +80 ); dWin.fill( Arc2 ); dWin.setForeground( Color.gray ); Oval Oval2 = new Oval( x-30, y3-11, 41, 41 ); dWin.fill( Oval2 ); x-=12; y+=1; y3-=1; x2-=10; degreestart +=10; degreestart2 +=10; pause(100); dWin.hold(); dWin.setForeground( Color.black ); dWin.fill( Oval1 ); //dWin.fill( Oval2 ); dWin.fill( Arc1 ); dWin.fill( Arc2 ); dWin.release(); } } }
Reply With Quote
Sponsored Links