Thursday, July 26, 2012

DSDN 142: Coding Taken Too Damn Far...

So I've been working with my code and I've decided to advance it further and add two more arcs onto the shape. Now it feels more square, and therefore, accordingly, I've given the shape more space with a 500x500 pixel canvas. It sits nice and squarely in the middle.
I then started to clean up my code, and eventually had the whole thing relying off two location variables (xp & yp), and two actual variables (wid1 and hei1). This, while apparently evidence of good coding, meant that by changing one of the variables, I was no longer changing individual components of the shape, but rather the scale of the shape as a whole. All I could do with the variables now was to scale the shape.

Here yp = 200 (as opposed to 400).

Here xp = 200 (as opposed to 400).


Here both xp and yp equal 200.

While this is good coding, it really doesn't help my cause or project. I need to be able to change different variables... So this is all going to have to change. Also I think I need to make the code for everything stem from the central point, rather than a point at (50, 150). It makes more sense to do that, and while it will be harder, it will make sure that everything stays oriented towards the center.


No comments:

Post a Comment