Help - Search - Members - Calendar
Full Version: Java programming help
CyberiaPC.com Community > Technical Zone > Programming (Java SE/EE, VB, C#)
FiShMaStEr
hey there, love the support you guys give here its excellent.

now i have encountered a bug while making my own version of battleships. im currently in the stage of laying down the pieces, but have encountered a problem with rotating. i can get the blocks of the ships to line up in the Y direction, but the images i dont know how to rotate. I have found a huge number of scripts, but the way they do it mostly is creating a new image. I also noticed that Ali has a version of asteroids in java mode in the java games section, which uses a ship in the middle rotating on a keyboard button press, this could be harnessed so when clicked it will rotate a certain amount of degrees possibly.

if anyone can help me out it would be great. willing to supply everything (heck its freeware aint it!)
usr.c
Admittidly, when I was writing Centipede for a unit assignment, I ended up using seperate images too depending on which side the sprite was facing. I've since come across an alternative method to rotate shapes by using methods, like rotate, froom the Java2D library.

Check out the demos and tutorials at java.sun.com:

http://java.sun.com/products/java-media/2D...rms/Rotate.html
http://java.sun.com/products/java-media/2D.../Rotate-pi.html

A good intro: http://www.javaworld.com/javaworld/jw-07-1...w-07-media.html
There's also a wealth of information here: http://community.java.net/games/
FiShMaStEr
well i believe i just did it the cheating way hihi.gif

i set it up so that when the word of battleships under rotate is clicked (well the box) it then just loads a pre rotated image file instead of the original and does the fliip mechanism i had b4. works alot easier then creating a whole bunch of new classes for each flip of all 30 pieces lol. thanks for the help though.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2012 Invision Power Services, Inc.