Finding right angles

Post here your demos and examples with the source files.
Forum rules
Always post the games with a screenshot.
The file must have the ged and data files (complete game source)
Use the forum attachment to post the files.
It is always better to use the first post to put the game files

Finding right angles

Postby Fuzzy » Sun Feb 08, 2009 10:48 am

It is not often that I post GEDs here. I like people to do their own coding, and generally focus on trying to help people learn problem solving. You can learn GE and C just about anywhere, but after you get the basics, You'll have a hard time until you learn problem solving. If you need to do something and its taking lines and lines of code, chances are you are doing it wrong. There is always a way that is simple and clean. Efficient(and bug free) coding is finding that way.

This is one of those little situations where you need to find an angle 90 degrees to the right of left of a line or direction. You will note that I dont use any funny math, and certainly not one bloody IF!

Use the mouse to press the arrow keys to change x and y velocity. The red line will show direction of travel, and the blue and green lines will be 90 degrees of that. Numbers indicate magnitude of each. All the interesting stuff happens in pointer.draw

All my lines are commented. Comments add no size to your completed game and have no effect on performance. Always comment your lines.

If you find a use for the grass tile, feel free to use it. It is copyright to me and it is free for public use.

The zip and rar contain the same files. Use the one you like better.
Find90Degrees.zip
(528.34 KiB) Downloaded 195 times
Find90Degrees.rar
(512.6 KiB) Downloaded 161 times
Mortal Enemy of IF....THEN(and Inspector Gadget)

Still ThreeFingerPete to tekdino
User avatar
Fuzzy
 
Posts: 1068
Joined: Thu Mar 03, 2005 9:32 am
Location: Plymostic Programmer
Score: 95 Give a positive score

Re: Finding right angles

Postby jimmynewguy » Sun Feb 08, 2009 3:06 pm

Great! I myself have yet to find a use for it in a game, but im sure someone will, either way its neato :D


PS: We need to make a rule where you can't download something without leaving a post.... :lol: so many things get downloaded like 50 times with only 3 people saying anything about :evil: oh well, you can't change some things...
Working on a probably too ambitious project! Wild-west-adventure-RPG-shooter-thing.
User avatar
jimmynewguy
 
Posts: 1137
Joined: Sat Mar 31, 2007 6:27 pm
Score: 89 Give a positive score

Re: Finding right angles

Postby Camper1995 » Sun Feb 08, 2009 4:32 pm

..wow.. :mrgreen:
Say hello to my little friend.
User avatar
Camper1995
 
Posts: 707
Joined: Tue Dec 30, 2008 7:20 pm
Location: Lost in the past.
Score: 44 Give a positive score

Re: Finding right angles

Postby DST » Sun Feb 08, 2009 5:08 pm

Hey....shouldn't those arrows be clones of each other? :D
It's easier to be clever than it is to be kind.
http://www.lostsynapse.com
http://www.dstgames.com
User avatar
DST
 
Posts: 1117
Joined: Sun Apr 15, 2007 5:36 pm
Location: 20 minutes into the future
Score: 151 Give a positive score

Re: Finding right angles

Postby Fuzzy » Sun Feb 08, 2009 8:57 pm

DST wrote:Hey....shouldn't those arrows be clones of each other? :D


Not If i wanted to avoid IFs!
Mortal Enemy of IF....THEN(and Inspector Gadget)

Still ThreeFingerPete to tekdino
User avatar
Fuzzy
 
Posts: 1068
Joined: Thu Mar 03, 2005 9:32 am
Location: Plymostic Programmer
Score: 95 Give a positive score


Return to Game Demos

Who is online

Users browsing this forum: No registered users and 1 guest

cron