File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
A friendly place for programming greenhorns!
Big Moose Saloon
Search
|
Java FAQ
|
Recent Topics
Register / Login
Win a copy of
Arduino in Action
this week in the
General Computing
forum!
A special promo:
Enter your blog post or vote on a blogger to be featured in an upcoming Journal
JavaRanch
»
Java Forums
»
Java
»
Java in General
Author
Moving Objects
Richard Jones
Greenhorn
Joined: May 24, 2006
Posts: 17
posted
May 25, 2006 09:24:00
0
I have to move the position of an object in a box using x and y
Using the following is ok
public void moveTo(int xPos, intyPos)
{
this.setXPos(xPos);
this.setYPos(yPos);
this.update();
on interface use aSquare.moveTo(100,100);
all fine but need to make the square change its steps in ypos to 200 and back again to 100 using the interface comand aSquare.Bounce();
I have used so far
public void Bounce (int yPos)
{
this.setYpos(this.getYpos();
while (Ypos) < 199
Ypos++;
while (Ypos > 200)
Ypos-;
Am I on the right lines any help very greatful
Jeff Albertson
Ranch Hand
Joined: Sep 16, 2005
Posts: 1780
posted
May 25, 2006 09:59:00
0
You should reply to your original thread instead of starting a new one:
http://www.coderanch.com/t/403597/java/java/Moving-object
And before writing *any more* code, you should read that reference to the Swing timer class, or this part of the Swing tuorial
http://java.sun.com/docs/books/tutorial/uiswing/misc/timer.html
There is no emoticon for what I am feeling!
Richard Jones
Greenhorn
Joined: May 24, 2006
Posts: 17
posted
May 25, 2006 10:19:00
0
Sorry thought I had put the question in the wrong place
I agree. Here's the link:
http://zeroturnaround.com/jrebel
- it saves me about five hours per week
subject: Moving Objects
Similar Threads
change pixel value to cell coordinate
placing images in applets
Moving object
YPOS
How to implement my next waypoint for pathfinding.
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter