Jump to content
  • Advertisement
Sign in to follow this  
Ueneth Echil

Computer Science Java School question

This topic is 4443 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hullo, I am in a computer science class at my High School and we are using Java as the language. So far we've made applets and applications using data types, and basic graphics like drawLine, fillRect, drawRect, drawOval, etc. Just recently we've begun loops, and this is a lab we're going to be working on. Image Hosted by ImageShack.us Problem is, I've been messing around and cannot achieve that result. The paper said it is composed of merely straight lines, but it doesn't look like it, and obviously doesn't have an even scale.

Share this post

Link to post
Share on other sites
Here's what seems to be happening:

Take your first line. Draw it from the bottom left hand corner to the low right. Your next line starts a little to the right (but still on the bottom) of that corner and goes a little higher (but still to the far right). Your next line is a little more right and a little higher. Until eventually your final line is drawn almost at the very right hand corner and all the way to the top.

In psuedocode, it might look something like this:

startX = 0, startY = windowY, endX = windowX, endY = windowY - 10;
for (i = 1 to 50)
drawLine(startX, startY, endX, endY)
startX += 10
endY -= 10

Hope that helps,

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!