Page 1 of 1

Coding Club

PostPosted: Fri Jan 06, 2012 8:21 pm
by karamazovapy
Tonight we went through Project1 of the Levelgen Tutorial. If you check that thread, the text pretty much sums up everything we talked about.

Homework for this week:
Try swapping out the level code in Project1.levelgen for your own level code. See if you can use code that will make something appear inside the box! If you're having trouble, open up Project1 in the level editor, add an item that isn't already there (like a speed zone or a teleporter), and save the file. Then open Project1.level in a text editor and copy the line that starts with whatever you added (FlagItem, GoalZone, Teleporter, TextItem, SpeedZone, etc).

For BONUS POINTS:
Try using a different variable name. Don't forget that it has to be the same in the "local" line and the "if()" line! Also, try changing the math.random() value to something other than 2. See how different numbers change what happens.

If you do something cool, you're welcome to post it here, in the Map Gallery, or to send me a PM. We can check the levels and levelgens out when we meet again, if you want to. After that, we'll move right on to Project2, and maybe even glance at Project3.

Re: Coding Club

PostPosted: Fri Jan 06, 2012 8:25 pm
by BlackBird
Too bad this dosnt count for high school credit. And I can't help but imagin a slot machine when learning this.

Re: Coding Club

PostPosted: Fri Jan 06, 2012 8:30 pm
by Santiago ZAP
the viewtopic.php?f=41&t=315 thread was 2 hard 2 me.
is there an easyyy tutorial?

Re: Coding Club

PostPosted: Fri Jan 06, 2012 8:34 pm
by karamazovapy
That's why we're meeting in-game with chat. If you show up next time, you won't be super far behind.

Re: Coding Club

PostPosted: Fri Jan 06, 2012 9:21 pm
by Santiago ZAP
karamazovapy wrote:That's why we're meeting in-game with chat. If you show up next time, you won't be super far behind.

whens the next class?
'Cause i have the uniform on

Re: Coding Club

PostPosted: Sat Jan 07, 2012 12:45 am
by ZoombeR
gotta give props to _k for doing all this and time to do this for them, what a nice guy.

I think a "thanks" should be in order..

Re: Coding Club

PostPosted: Sat Jan 07, 2012 9:16 am
by karamazovapy
We still need to pick our next meeting time. I'm gone next friday and saturday, but I can do other nights mid-week.

Re: Coding Club

PostPosted: Sat Jan 07, 2012 7:38 pm
by Little_Apple
I have an idea for the group! We could be called the " krazy koding klub"! Or kkk for short. :3

Re: Coding Club

PostPosted: Sat Jan 07, 2012 7:46 pm
by BlackBird
When I first read that, I thought it was a great idea. Then after a few seconds of remembering certain historical events, it's got to be the worst idea ever.

Re: Coding Club

PostPosted: Sat Jan 07, 2012 11:21 pm
by Skybax
That made me laugh. Props.

Re: Coding Club

PostPosted: Tue Jan 10, 2012 1:44 pm
by karamazovapy
I can do tonight, tomorrow night, or thursday night if youins want to meet this week. Otherwise, we have to wait until at least sunday.

Re: Coding Club

PostPosted: Tue Jan 10, 2012 1:52 pm
by Little_Apple
Unfortunately, all of those dates are school nights for me. Poop.

Re: Coding Club

PostPosted: Tue Jan 10, 2012 5:50 pm
by karamazovapy
Actually, I just downloaded Barnacle for my unlimited-data-plan-droid, so we'll see if I'm able to connect to bitfighter over the weekend. My ping might be so bad that I'll just timeout. Maybe I can test it in the next 24-48 hours.

Re: Coding Club

PostPosted: Wed Jan 11, 2012 2:41 pm
by karamazovapy
Turns out I actually CAN connect with barnacle and my cell. Only issue is that I've got a 400-500 ping. SO. We can do coding club over the weekend, I just can't play the game...I may time out at some point and have to reconnect, and I should probably limit the time I'm tethered, but I can do it!

Friday or Saturday work for youins?

Re: Coding Club

PostPosted: Wed Jan 11, 2012 2:45 pm
by BlackBird
Friday and Saturday should both work...

Re: Coding Club

PostPosted: Wed Jan 11, 2012 4:07 pm
by Little_Apple
What if you just connected over a temporary irc channel? Would that work any better?

Re: Coding Club

PostPosted: Wed Jan 11, 2012 4:24 pm
by karamazovapy
Meeting in-game is easier.

Re: Coding Club

PostPosted: Wed Jan 11, 2012 4:30 pm
by Little_Apple
Ok. ._.

Re: Coding Club

PostPosted: Wed Jan 11, 2012 8:50 pm
by FoOtloOse
Which Friday or Saturday?

Re: Coding Club

PostPosted: Wed Jan 11, 2012 8:54 pm
by BlackBird
FoOtloOse wrote:Which Friday or Saturday?

Yes.

Re: Coding Club

PostPosted: Wed Jan 11, 2012 9:32 pm
by Little_Apple

Re: Coding Club

PostPosted: Fri Jan 13, 2012 9:59 am
by karamazovapy
Are we meeting tonight?

Re: Coding Club

PostPosted: Fri Jan 13, 2012 11:27 am
by Little_Apple
I guess...

Re: Coding Club

PostPosted: Fri Jan 13, 2012 11:27 am
by BlackBird
Sure!

Re: Coding Club

PostPosted: Fri Jan 13, 2012 2:33 pm
by FoOtloOse
Time?

Re: Coding Club

PostPosted: Fri Jan 13, 2012 2:43 pm
by Little_Apple
Same as last time? 9-10?

Re: Coding Club

PostPosted: Fri Jan 13, 2012 3:02 pm
by BlackBird
BlackBird wrote:Sure!

Re: Coding Club

PostPosted: Fri Jan 13, 2012 4:03 pm
by karamazovapy
BlackBird wrote:
BlackBird wrote:Sure!

Re: Coding Club

PostPosted: Fri Jan 13, 2012 4:06 pm
by Little_Apple
Little_Apple wrote:I guess...

Re: Coding Club

PostPosted: Fri Jan 13, 2012 4:53 pm
by FoOtloOse
karamazovapy wrote:
BlackBird wrote:
BlackBird wrote:Sure!

Re: Coding Club

PostPosted: Fri Jan 13, 2012 8:42 pm
by karamazovapy
Another worthwhile class! Tonight was kind of messy between me having to run off my tether and the rush of people who didn't actually want to do class showing up, but we got through it!

Tonight we reviewed variables, math.random, and if/then/else from Project1. For new material, we looked at using more than one variable in a script, choosing higher numbers for math.random, adding more than one line of level code at a time, and using elseif().

For next week, please take a close look at Project2.levelgen and make sure you understand exactly how each piece of the code works! Everything is cumulative. To understand the complicated stuff, you have to understand 100% of the simple stuff we're doing right now.

TOUGH HOMEWORK:
1) Modify Project2.levelgen so that the math.random for ResourceNumber chooses from either 1-5 or 1-6.

2) Copy and paste the elseif(ResourceNumber == 3) block after the initial if(ResourceNumber == 4) test.

3) Change the "3" in the block you pasted so it tests for 5 or 6, depending on the change you made in Step 1.

4) Modify the level code in the levelgen:addLevelLine entries to change the result of math.random choosing 5 or 6, as in Step 3.


Copy/Pasting and Modifying existing code is a big part of programming. Learn what all the individual parts do, and how you can change them to get the code to do what you want! If you can't remember what something does, check the tutorial thread linked in the first post of this topic. Thanks for the work!

Re: Coding Club

PostPosted: Fri Jan 20, 2012 11:31 am
by Little_Apple
karamazovapy wrote:Are we meeting tonight?

Re: Coding Club

PostPosted: Fri Jan 20, 2012 11:37 am
by BlackBird
BlackBird wrote:Sure!

Re: Coding Club

PostPosted: Fri Jan 20, 2012 12:53 pm
by Lone Wolf
Little_Apple wrote:Same as last time? 9-10?



Wait, what time zone?

Re: Coding Club

PostPosted: Fri Jan 20, 2012 1:00 pm
by BlackBird
Eastern time.

Re: Coding Club

PostPosted: Fri Jan 20, 2012 1:18 pm
by CleverBot
What we talk about in-game during the coding club sessions? Don't you have to visually show code and math...can't do that with a simple text-to-text communication system.

There are 3 basic ways of learning: visually/seeing, orally+reading, and doing/practice. FYI don't need a teaching degree to know that.

Re: Coding Club

PostPosted: Fri Jan 20, 2012 1:43 pm
by Little_Apple
We all download a zip file with the different projects and _k guides us through them explaining what each part means. It works surprisingly well.

Re: Coding Club

PostPosted: Fri Jan 20, 2012 7:55 pm
by Lone Wolf
WHAT THE HELL IS THE PASSWORD?

Re: Coding Club

PostPosted: Fri Jan 20, 2012 8:22 pm
by Little_Apple
I didn't even know it!! It was set to keep out the occupy coding club protesters.

Re: Coding Club

PostPosted: Fri Jan 20, 2012 8:24 pm
by karamazovapy
Sorry - we password the server once class gets going so people don't join and flood the chat or mess up class.

Anyway, it was another good week. HOMEWORK!

1) Your goal is to create some "mutually exclusive" code and some "independent" code. Copy the code you need from Project3.levelgen and paste it into Project1.levelgen.

2) Decide what either/or type results you want to get and paste the level code into the levelgen where you want it.

3) Decide how often you want your either/or code to come up and adjust both math.random to the correct number and the placement of the code after "then", "elseif", or "else" to get the frequency right (ex. 1 out of 5 versus 4 out of 5).

4) Add another variable/math.random/if-then block of code to create an independent test that has nothing to do with numbers 2 and 3.

5) Make sure your variable names describe what type of code will come up!

From here, coding can get a lot more complicated, but this is the basic idea. You're adding whole sections of code on your own and making them do what you want. Since you know what each individual piece does, just think about it bit by bit and decide what you need to change to get the results you want!

We've got about two weeks until we're through the levelgen tutorial. If you were interested in learning this stuff but missed the first couple classes, we can do the whole thing over again so you can learn too! The one big rule is that you actually have to show up every time and do your best. See you next week!

CHANG.