# WiLD2

Member

44

181 Neutral

• Rank
Member

• Website
1. ## [java] Let's calculate the angle of a right triangle

Thanks for the replies, funk* I managed to find my problem yesterday, it required me to recognize when my destination point was less than that of my current point along the X axis. Here's what has seemed to have fixed it: double sinDiff = Math.sin(Math.toRadians(diffY/disp)); double theta = Math.asin(Math.toDegrees(sinDiff)); double degTravel = Math.toDegrees(theta); degTravel = degTravel*(-1); if (destination[0] < myX) degTravel = (180-degTravel); Thanks for the help.
2. ## [java] Let's calculate the angle of a right triangle

What I've done is calculate the angle between two points. Within computer science (at least within java and c), the quadrants of a 2 dimensional space are flipped. The angles are counter-intuitive in that when starting from 0 degrees where the 1st and 4th quadrants touch, a positive degree increases downward and vice-versa. I'm getting a little beside myself here. I've calculated the angle between my two points; for the values I've given the angle is approximately 27 degrees. What should happen is my 'newX' value should return some X and the same for my 'newY' value to return some point along the hypotenuse between my starting and end destination. It should be as simple as that, however my agent isn't even wandering along the straight path between the start and end points. He's wandering off up and to the right, rather than along the path which would take him up and to the left. He does end up at the end destination (as it's a torroidal space) but not how I'd have expected him to. I guess I'm not really expecting help, then. What I've done should be correct. I was maybe wondering if other people have had similar problems with trigonometry and what might be done to prevent such 'features'. I thought there might have been something wrong from within my 'sintable' so I changed that piece of code into one that uses the Math. library newX = xnorm(myX + (int)(distTravel * Math.cos(Math.toRadians(degTravel)))); newY = ynorm(myY + (int)(distTravel * Math.sin(Math.toRadians(degTravel)))); But still no luck, same thing as before.

8. ## My Kubuntu Flight 6 experience report...

I've been using Ubuntu/Kubuntu the last couple years. Fair enough, KDE + Ubuntu does seem to put focus on the visual effects. I've had good experience running the XFCE windowing system, but at the same time why not just install Ubuntu and go straight to XFCE off the bat. I'm kind of a cautious user when it comes my distros. I'll be waiting another few months for Dapper Drake to be released, then another month or so after that until some fixes are released. Thanks for the warning, though.

10. ## want to avoid goto, how can I?

Thanks again for the help, the later replies make for good discussion/reading as well. The snippet is from this site over here for those interested. I'm actually a java programmer myself and am in the process of learning C. In doing so, I thought I'd port source from the language I'm learning to the language I already know. Honestly, outside of SPARC assembly I haven't seen a label/goto and that's the centre of my interest in todays exercise. I do appreciate the help and am actually feeling pretty dumb for spending 3 hours on that and not seeing how I could come up with a solution on my own.
11. ## want to avoid goto, how can I?

doynax is correct. A goto is the simplest way to go about it. However, another programming language, such as java, doesn't have an easy way to do a goto statement. Those were quicker replies than I'd anticipated and my editing seems to have resulted in 2 or 3 different source quotes (whoops). And I can't believe how I had missed the use of a boolean. Thxa for the help.
12. ## want to avoid goto, how can I?

I just can't see how to do this. I should be able to complete this function without using a goto, shouldn't I? I can't see how it can be done, though. And the last three hours of my life have been dedicated to staring dumbly at this snippet for the sake of proving I can do it. I've given up and am resorting to help from others. Am I really missing the obvious, and how can I do this? Thanks. void myMethod(int arr[], int colno, int val) { int ctr1,ctr2; a1[colno]=val; if(colno==N-1) { printArray(a1); return; }; for(ctr1 = 0; ctr1 < globalN; ) { for(ctr2 = 0; ctr2 <= colno; ctr2++) { if(theseHoldTrue) goto miss1; } myMethod(arr,colno+1,ctr1); miss1: ctr1++; } }  sorry for the confusion as I edited the source to try to avoid clutter and confusion.
13. ## [java] Java Grande.......

I'd never heard of "Java Grande" up until this point. Funny, though; The description of this forum at the root is "A Java grande with game development flavoring. Hold the whip cream."
14. ## GDnet Challenge #4: Create a tag-line for the GDnet ad poster *WINNERS ANNOUNCED*

OptA: A bunch of people who like to make games. OptA: Hey! Everyone is doing it! OptA: Brain dump repository OptA: n00b friendly OptA: Because we were all newbies once OptB: Forums, Articles, Interviews OptB: For hobbyists and more. OptB: Humour me OptB: What have you got to lose? OptB: Nothing to lose ~ Everything to gain
15. ## An odd (?) question

I think you mean using sprites (that generally face you no matter what direction you are looking at them from). I can't think of a reason why you couldn't apply physics to a 2-dimensional object in a 3-dimensional world. That 2-Dimensional object is actually 2.5-d which in turn means it appears 'flat' but still has all three of the x y and z parameters. You just need to get the 2-dimensional thing rendering the way you like in the 3-d world.