Hangedman
|
|
« Reply #80 on: June 08, 2011, 05:22:59 PM » |
|
Can't help but wonder if I could have condensed this better: if (!dead && !rolling && touchdown && dir == 1 && speed.y > 0 && collide("Hanger", x + 1, y - 1) && !collide("Hanger", x, y) && !collide("Hanger", x + 1, y) && !collide("Wall", x, y + 3)) { hanging = true; } if (!dead && !rolling && touchdown && dir == 0 && speed.y > 0 && collide("Hanger", x - 1, y - 1) && !collide("Hanger", x, y) && !collide("Hanger", x - 1, y) && !collide("Wall", x, y + 3)) { hanging = true; }
|
|
|
Logged
|
|
|
|
Average Software
|
|
« Reply #81 on: June 08, 2011, 07:11:27 PM » |
|
I don't ever I've ever written something that looked this ridiculous, but I swear it makes sense in context: procedure Process_Lunch(Object: in out State) is begin if not Object.Map.Is_Moving then Object.Current_State := Lunching;
declare Text: constant String := "Lunch Break!"; Effect: Message_Effect; begin case Unit_Owner(Object.Current_Game, Object.Unit_Start_Location) is when Red => Effect := Message_Effect_With_Text(Text, Red => 1.0, Green => 0.0, Blue => 0.0); when Green => Effect := Message_Effect_With_Text(Text, Red => 0.0, Green => 1.0, Blue => 0.0); when Yellow => Effect := Message_Effect_With_Text(Text, Red => 1.0, Green => 1.0, Blue => 0.0); when Blue => Effect := Message_Effect_With_Text(Text, Red => 0.0, Green => 0.0, Blue => 1.0); end case; Effect.Set_Hex(Object.Unit_Start_Location); Object.Effects.Add_Effect(Effect); Object.Unit_Start_Location := No_Location; end; end if; end Process_Lunch; I now have code that can process lunch.
|
|
|
Logged
|
What would John Carmack do?
|
|
|
Elliott D.
|
|
« Reply #82 on: June 14, 2011, 06:04:26 PM » |
|
Making a Zelda Game: case RoomObjectType.Pot: break;
|
|
|
Logged
|
|
|
|
teomat
Guest
|
|
« Reply #83 on: June 15, 2011, 12:28:27 AM » |
|
Making a Zelda Game: case RoomObjectType.Pot: break;
ahahaha, that made me lol too
|
|
|
Logged
|
|
|
|
Ivan
Owl Country
Level 10
alright, let's see what we can see
|
|
« Reply #84 on: June 15, 2011, 12:44:43 PM » |
|
Can I still post here if I was crying while I was laughing?
|
|
|
Logged
|
|
|
|
shadowdim
Level 1
|
|
« Reply #85 on: July 02, 2011, 03:22:31 PM » |
|
Debugging my AS3: So, yeah, mostly a Fate/Stay Night joke. Hope someone will get it.
|
|
|
Logged
|
|
|
|
_Tommo_
|
|
« Reply #86 on: July 08, 2011, 09:07:52 AM » |
|
queueSemaphore.wait(); //awoken to be killed (oh the irony) if( !running ) break; I lolled SO hard
|
|
|
Logged
|
|
|
|
iPhoenix
Level 0
|
|
« Reply #87 on: July 10, 2011, 06:16:54 AM » |
|
//getScore (score, time, deaths) var s, t, d; s = argument0 t = argument1 d = argument2; return s / (t * d)
I could've worked with the arguments only, but I guess I want my code to be tidied up. When I saw what I did, I went all FML.
|
|
|
Logged
|
|
|
|
geomaster
Level 0
|
|
« Reply #88 on: August 02, 2011, 10:34:56 AM » |
|
This is one of my all-time favorites: namespace /* You just lost the */ Game
And I needed a moment to see what I did here: assert(Column<3 && Row<3);
Then I added a comment saying 'columns and rows need love too!'
|
|
|
Logged
|
|
|
|
Evan Balster
|
|
« Reply #89 on: August 25, 2011, 06:19:24 PM » |
|
Dear lord. D:
I think the reason I've never written anything blockified that hard is that I keep my lines under 80 characters at all times, and it starts to be a pain writing lines that short.
|
|
|
Logged
|
Creativity births expression. Curiosity births exploration. Our work is as soil to these seeds; our art is what grows from them...Wreath, SoundSelf, Infinite Blank, Cave Story+, <plaid/audio>
|
|
|
st33d
Guest
|
|
« Reply #90 on: August 26, 2011, 01:20:25 AM » |
|
override public function main():void { super.main(); if(killState == 0){ if(state == IDLE){ if(getPlayerTarget()){ state = OPEN; count = OPEN_DELAY; } } else if(state == OPEN){ if(count) count--; else { // DIIIIIIIIIIIIIVVVVEEEE! state = DIVE; collider.state = Collider.FALL; } } else if(state == DIVE){ playerTarget = getPlayerTarget(); if(playerTarget){ if(playerTarget.collider.x > collider.x + collider.width){ collider.vx += speed; } else if(playerTarget.collider.x + playerTarget.collider.width < collider.x){ collider.vx -= speed; } } if(collider.pressure & DOWN){ state = RETURN; collider.state = Collider.HOVER; } } else if(state == RETURN){ collider.vy -= speed; if(collider.pressure & UP){ if(getPlayerTarget()){ // SECOND WAVE, DIIIIIIIIIIIIVVVEEEE! state = DIVE; collider.state = Collider.FALL; } else { state = CLOSE; count = OPEN_DELAY; } } } else if(state == CLOSE){ if(count) count--; else { state = IDLE; } } } }
|
|
|
Logged
|
|
|
|
Trevor Dunbar
|
|
« Reply #91 on: August 26, 2011, 03:08:08 AM » |
|
also, this is the best magic number ever created apparently: i = 0x5f3759df - ( i >> 1 ); // what the fuck? http://en.wikipedia.org/wiki/Fast_inverse_square_rootIt is not known precisely how the exact value for the magic number was determined. It was created with black programming magic.
|
|
« Last Edit: August 26, 2011, 03:29:36 AM by Trevor Dunbar »
|
Logged
|
Toucantastic.
|
|
|
TaintedFork
|
|
« Reply #92 on: August 26, 2011, 08:34:53 PM » |
|
This isn't game programming related, but it is programming. The other day I was writing a Mac app in Objective-C. I subclassed NSWindow to make my own window. This happened: My window is self-centered.
|
|
|
Logged
|
|
|
|
trq
|
|
« Reply #93 on: August 27, 2011, 01:48:10 AM » |
|
This is why I hate ECMA-like languages
|
|
|
Logged
|
|
|
|
geomaster
Level 0
|
|
« Reply #94 on: August 27, 2011, 12:49:38 PM » |
|
This is why I hate ECMA-like languages I don't think you can say C++ is ECMA-like. And using another language here makes no difference. Just sayin'
|
|
|
Logged
|
|
|
|
MadSage
|
|
« Reply #95 on: August 27, 2011, 12:58:15 PM » |
|
I would cry (not laugh) if I came across nesting like that It reminds of the awful renderer someone wrote at the first studio I worked at. I so badly wanted to refactor it.
|
|
|
Logged
|
|
|
|
Mikademus
|
|
« Reply #96 on: August 27, 2011, 03:22:27 PM » |
|
I would cry (not laugh) if I came across nesting like that It reminds of the awful renderer someone wrote at the first studio I worked at. I so badly wanted to refactor it. Perhaps it was a very, very sad, or possibly deranged, laugh? But yeah, that is not funny code, it is simply bad. Not so bad it is funny, but so bad it is awful
|
|
|
Logged
|
\\\"There\\\'s a tendency among the press to attribute the creation of a game to a single person,\\\" says Warren Spector, creator of Thief and Deus Ex. --IGN<br />My compilation of game engines for indies
|
|
|
Ashkin
Guest
|
|
« Reply #97 on: August 27, 2011, 04:22:17 PM » |
|
//I ain't saying she's a public class GoldDigger extends Digger I am HORRIBLE
|
|
|
Logged
|
|
|
|
Evan Balster
|
|
« Reply #98 on: August 28, 2011, 12:00:25 PM » |
|
bool _ = true; for ( ;_; ) { //Infinite loop is sad }
|
|
|
Logged
|
Creativity births expression. Curiosity births exploration. Our work is as soil to these seeds; our art is what grows from them...Wreath, SoundSelf, Infinite Blank, Cave Story+, <plaid/audio>
|
|
|
hopwep
|
|
« Reply #99 on: August 31, 2011, 01:26:46 AM » |
|
Thtats a ruby code that totally sucks. It was one of the first things i writed, i think. It was a system so i created the extra actor atributes using methods and cases. At the first i writed that in a class called 'Other' that functions like C libraries, lol, XD. #-------------------------------------------------------------------------- # * Calculate actor crit rate #-------------------------------------------------------------------------- def crit_rate #Declaraciones crit = super() acrit = [] ccrit = [] # These two are totally useles, arrays whose i had to changue #the name each time for each atribute and then why not use the switch here? #Por personaje puts acrit[1] = 7 # That also sucked. puts!, wtf, i dont remmebr but it dont need it in ruby. #It also that method make that you have to set a value for each character or it will explode. crit += acrit[id] #Por clase puts ccrit[1] = 7 crit += ccrit[class_id] # Same here
#Por equipacion case weapon_id when 1 ; crit += 5 when 2 ; crit += 6
end #Otros elementos #Luck crit += @suerte/2 return crit end Im actually improving a little game i started in pygame a year later(now are two years or more). It was all the code and classes in a only unique file with 2000 lines. It totally sucked and the OO used was totally laughlable... This is my rewrite of the first thing: #-------------------------------------------------------------------------- # * Calculate actor crit rate #-------------------------------------------------------------------------- def crit_rate #Declaraciones v = super() #By actor case @actor_id when 1 ; v += 11
end
#Por equipacion case @weapon_id when 1 ; v += 5 when 2 ; v += 6
end
return v end Also luck is implemented now in the basic formula, a lot better.
|
|
« Last Edit: August 31, 2011, 01:37:58 AM by hopwep »
|
Logged
|
|
|
|
|