Java-Gaming.org Hi !
 Featured games (84) games approved by the League of Dukes Games in Showcase (565) Games in Android Showcase (151) games submitted by our members Games in WIP (606) games currently in development
 News: Read the Java Gaming Resources, or peek at the official Java tutorials
 Show Posts Pages: [1]
 1 Game Development / Newbie & Debugging Questions / Re: proteced access on: 2009-07-31 16:13:33 PERFECT...! Just ran across the same probem.Thanks!
2  Game Development / Newbie & Debugging Questions / Re: Image Placement with Precision - Graphics2D on: 2009-01-11 17:23:43
I used the cast method as suggested by SimonH (gave me the answer in the first post, but I didn't quite grasp it)...
 1 `g2.drawImage(myBall.getBall(),(int)myBall.getX(),(int)myBall.getY(),null);`

... and everything works perfectly. Thank you very much, a wonderful first experience on this forum.

/ happily goes back to coding
 3 Game Development / Newbie & Debugging Questions / Re: Image Placement with Precision - Graphics2D on: 2009-01-10 20:38:25 Many many thanks to everyone who replied!Cheers
4  Game Development / Newbie & Debugging Questions / Re: Image Placement with Precision - Graphics2D on: 2009-01-10 18:57:57
I'm writing a simple app to simulate gravity on an object for a Physics project

The problem occurs in the Maths when the ball is at the top of the fall... because I have to cast to (int) for movement, it stalls until the value is greater than 0.5 or less than -0.5... So it just hangs there.

Here is the code for the movement of the ball...
 1  2  3  4  5  6  7  8  9  10  11  12  13  14  15  16  17 `// Variablesprivate final long DELAY = 20;                                  // Timer delay (10 ms)        private float a = 9.8f;                                         // Default acceleration 9.80 m/s/s     private float t = DELAY / 1000.0f;public void cycle(){        // Increase velocity based on rate of acceration        myBall.setY((int)(myBall.getY() + (t * (myBall.getVY() + a * t))));        myBall.setVY(myBall.getVY() + a * t);        //System.out.println(myBall.getY());        //System.out.println(myBall.getVY());                if(myBall.getY() > getHeight() - myBall.getRadius() * 2){            myBall.setVY(-myBall.getVY()*myBall.getElast());        }`

/Edit - Added the variables... note getVY returns a float (myball current velocity)
 5 Game Development / Newbie & Debugging Questions / Re: Image Placement with Precision - Graphics2D on: 2009-01-10 17:51:06 Indeed... but then I loose the precision. Sorry if this is silly question. ( Hence Newless Clubies)
 6 Game Development / Newbie & Debugging Questions / Image Placement with Precision - Graphics2D on: 2009-01-10 17:42:38 Hi,This is my first post!I would like to load an image and control the placement/movement in a JPanel with precision (float). After a gazzilion searches and paging through books it seems that I can only position an image using (int).Is there a trick I can use... Like somehow attaching the image to a rect, or another image method I can use?Cheers & Thanks
 Pages: [1]
 theagentd (13 views) 2015-03-27 23:08:20 wxwsk8er (54 views) 2015-03-20 15:39:46 Fairy Tailz (47 views) 2015-03-15 21:52:20 Olo (29 views) 2015-03-13 17:51:59 Olo (32 views) 2015-03-13 17:50:51 Olo (39 views) 2015-03-13 17:50:16 Olo (44 views) 2015-03-13 17:47:07 ClaasJG (58 views) 2015-03-10 11:36:42 ClaasJG (42 views) 2015-03-10 11:33:01 Pippogeek (50 views) 2015-03-05 14:36:23
 BurntPizza 21x LiquidNitrogen 21x basil_ 19x EgonOlsen 17x theagentd 17x KevinWorkman 16x Roquen 16x wessles 11x 65K 11x Varkas 10x Riven 10x princec 9x phu004 8x SHC 8x Ashedragon 8x nsigma 7x
 How to: JGO Wikiby Mac702015-02-17 20:56:162D Dynamic Lighting2015-01-01 20:25:42How do I start Java Game Development?by gouessej2014-12-27 19:41:21Resources for WIP gamesby kpars2014-12-18 10:26:14Understanding relations between setOrigin, setScale and setPosition in libGdx2014-10-09 22:35:00Definite guide to supporting multiple device resolutions on Android (2014)2014-10-02 22:36:02List of Learning Resources2014-08-16 10:40:00List of Learning Resources2014-08-05 19:33:27
 java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org