Gengo Girls #104: Participle Are Not Gerunds

Gengo Girls #104: Participle Are Not Gerunds

In English we also use -ing both to talk about ongoing verbs and to turn verbs into nouns. I am eating (ongoing verb). Eating is important (verb as noun).

But in Japanese the te-imasu form is ONLY for ongoing verbs. Using verbs as nouns uses different rules that we’ll probably eventually get around to.

Transcript

言語ガールズ #104

Participle Are Not Gerunds

Blue: One of the most important uses of the conjugation is talking about things that are happening right now.

Yellow: Isn’t that what the present tense is for?

Blue: The present tense let’s you say things like “I eat dinner every day”, but the conjugation lets you say “I am eating dinner right now”.

Yellow: Oh! The -ing conjugation.

Blue: To say “I am X-ing” in 日本語 you use the conjugation followed by います.

Yellow: So 食べる is “eat” but 食べています is “am eating”.

Blue: Now we can have more natural sounding conversations.

Yellow: Good. All these supernatural sounding conversations were creeping me out.

Gengo Girls #103: With A Cherry On Top

Gengo Girls #103: With A Cherry On Top

Pretty straightforward and I hope everyone can see why oshieru was conjugated the way it was. But I also want to point out that “ni” at the beginning of the sentence. In this case the “ni” is pointing out the target of our verb. Who do we want to get taught? “Me” or “Watashi”.

Just a quick example of “ni” being used for something more abstract than your normal “to mark a physical location”.

Vocabulary

下さい = ください = please do something for me

教える = おしえる = to teach

Transcript

言語ガールズ #103

With A Cherry On Top

Yellow: Teach me what we can do with the conjugation.

Blue: The first thing to learn is how to make polite requests.

Yellow: Umm… “Please” teach me what we can do with the conjugation?

Blue: You can request that people do things by adding ください to the end of a verb.

Blue: Sometimes it’s written with a kanji instead.

Blue: So “Please teach” would be 教えて下さい

Blue: And “Please teach me Japanese” would be 私に日本語を教えて下さい

Blue: If you use a conjugation all on it’s own it turns into a rude demand instead of a polite request.

Yellow: Got it. Don’t’ forget the ください.

Gengo Girls #102: Remixing A Classic

Gengo Girls #102: Remixing A Classic

A boring but necessary review. Next time we’ll start to get into what you can actually do with your new “te” form verbs.

Transcript

言語ガールズ #102

Remixing A Classic

Blue: The form follows the same rules as the casual past tense, but with a instead of a .

Yellow: I obviously remember all of those rules.

Yellow: But maybe the… audience… needs a reminder.

Blue: If a verb ends in “iru” or “eru” you replacte the last with .

Blue: If the verb ends in a that isn’t “iru” or “eru” or with a or you replace the last syllable with って.

Blue: If the verb ends in you change the to いて.

Blue: If the verb ends in change the to いで.

Blue: If the verb ends in change the to して.

Blue: And finally if the verb ends in , or change the last syllable to んで

Let’s Program A JavaScript Game 17: Can You Hear Me Now?

If I Wanted To Do Legal Research I Would Have Been A Lawyer

Today we’re going to be adding music and sound effects to our game.

But we need to start with a quick reminder that using copyrighted music and images in your games is illegal. It’s also pretty tacky. Nobody is impressed by the fact that your game uses the battle music from Final Fantasy 7. And don’t get me started on all those Taylor Swift* tracks you slipped into the pause menu.

One way around this problem is to pay people for the right to use their music. You can also find a lot of people on the Internet who give their music away for free. Either way there are two big questions you need to get answered:

Commercial VS Non-Commercial

Want to sell your game? Maybe have some ads so you get paid every time someone plays it for free? Then you need to make sure any art, music or code that you got from other people has been cleared for “Commercial Use”. In other words, make sure you have the original author’s permission to use their work to help you make money.

This is important because MOST of the free art and music you can find online (and even some of the paid stuff) is “Non-Commercial Use Only”. If a game uses even one piece of “Non-Commercial” media it’s now illegal to sell it or even attach advertisements to it. You might even get in trouble for just giving it away for free on a website that has it’s own ads.

Doing a school project or building a game to share with friends? Non-Commercial is fine.

But if you want the freedom to do whatever you want with your game make sure everything you use is cleared for Commercial Use.

Attribution Requirements

The other big legal aspect of using other people’s art, music or code is that they usually require you to give them credit. For a game this usually means including their name in the end credits and in any “readme” files that you might have. Some authors just want a simple mention of their name while others have entire legal phrases they want you to copy and past into your product.

Of course, some authors don’t care.

Either way before you publish your game you need to make sure you know which author’s do and don’t require attribution.

Let’s Find Some Free Stuff!

For today’s project we need two things: Some background music for our main game and a sound effect for when the player is grazing viruses.

For the background music we’re going to head to Kevin MacLeod’s website.

MacLeod releases all of his music under a “Free Commercial Use With Attribution” license. That means you can use the music from his website for whatever you want as long as you remember to give him credit in your project.

Also, he’s one of those authors who has a very specific request on how he wants his attribution to show up. So if I want to use “Ouroboros” from his electronica section (and I do) I’ll have to include this in my game:

“Ouroboros” Kevin MacLeod (incompetech.com)
Licensed under Creative Commons: By Attribution 3.0

http://creativecommons.org/licenses/by/3.0/

For sound effects we’re going to go to Wikimedia Commons, a giant database of free sounds and pictures with a wide variety of licenses.

The sound effect I chose can be found here (though I renamed the file wubwub.ogg for my game). You’ll notice that its license is “Public Domain”. That means this particular sound now belongs to everyone and can be freely used for commercial products with no need to give credit to anyone.

Public Domain is a really convenient source of video game art and music, but it can also be difficult to find because it requires an author to completely give up ownership of his work.

Public Domain is most common with works of art that have outlived their copyright. Classic music, ancient artwork, old books and so on. But just because something is several decades old doesn’t mean it’s automatically Public Domain! Laws are constantly changing and copyright now lasts longer than ever so double check the legal status of any “old” media you want to use in your game.

Quick Sound File Edits

MacLeod’s music comes in mp3 format, but for JavaScript purposes it’s better to use the “ogg” format. It has slightly more cross-browser support at the moment. (OOPS! That’s not true. See here)

Also, the sound effect from Wikimedia also has an obnoxious pause at the end of the file that makes it impossible to loop.

A couple minutes with Audacity is enough to convert the mp3 to ogg and trim off the extra space from the sound effect. You can do this yourself or wait for me to post the complete game and borrow my copy of each file.

Can We Start Programming Yet?

The boring legal stuff is out of the way now. Time to write some actual code!

This time around we’re going to be using the Audio class. This lets us build objects for loading and playing sound files.

First things first: we’re going to need two global variables to hold our music and sound effect.

var bgMusic;
var grazeSFX;

Now to put our sounds into those variables. Just like with the image files we want to make sure that the music is properly loaded before we start the actual game.

One big difference is that Audio objects don’t have an onload function that triggers when they fully load. Instead they have an oncanplaythrough function that triggers when enough of the file has loaded that it can be safely played while the rest of the file keeps loading in the background.

With that in mind we can rewrite our resource loading chain to include a new loadGrazeSFX and loadBackgroundMusic function:

function startGame(){
   loadCycleImage();
}

function loadCycleImage(){
   cycleImage = new Image();
   cycleImage.onload=function(){loadVirusImage();};
   cycleImage.src='cycle.png';
}

function loadVirusImage(){
   virusImage = new Image();
   virusImage.onload=function(){loadGrazeSFX();};
   virusImage.src='virus.png';
}

function loadGrazeSFX(){
   grazeSFX = new Audio();
   grazeSFX.oncanplaythrough = function(){ grazeSFX.oncanplaythrough=0; loadBackgroundMusic();};
   grazeSFX.src = 'wubwub.ogg';
   grazeSFX.loop=true;
}

function loadBackgroundMusic(){
   bgMusic = new Audio();
   bgMusic.oncanplaythrough = function(){bgMusic.oncanplaythrough=0;gameLoop();};
   bgMusic.src = 'Ouroboros.ogg';
   bgMusic.loop=true;
}

You probably noticed that there are a couple differences between our audio loading functions and our image loading functions.

When setting up the audio files we set the loop property to true. This means that the music and sound effect will automatically restart after they reaches the end. This is obviously useful for a game that lasts longer than the soundtrack.

Now most of the time you don’t want sound effects to repeat. One gunshot should have one “bang” noise, not a constant loop of “bangbangbangbang….”. But we want our “wubwub” to play for as long as the player is grazing a virus so it actually makes sense to let it loop.

The other big difference is that our oncanplaythrough function deletes itself as soon as it runs. This is because oncanplaythrough can actually trigger more than once. Since we use these triggers to start the game loop multiple triggers would result in multiple game loops and really mess the game up. Having the trigger clear itself after running once prevents this.

One, Two, Three, Hit It!

Now that we have a pair of audio objects we can control them using handy functions like play, pause, and fastSeek. Play and pause do exactly what you’d expect while fastSeek is used for skipping to different points in an audio file. Most importantly for us fastSeek(0) rewinds a sound clip back to it’s start. (OOPS AGAIN! Don’t use fastSeek. See here for more details).

But where should we put these functions?

I personally only want music to play during the main game and to stop as soon as the player dies. This means the most logical place to first play the music is during the transition from the start screen to the end screen:

//Check to see if the user is ready to start the game
function updateStartScreen(){
   if(playerInput.up){
      initializeGame();
      gameState = STATE_RUNNING;
      bgMusic.play();
   }
}

And to get it the music (and sound effects) to stop on a game over we want to include a pause and fastSeek(0) anytime the player dies. That means an update to some of the last few if statements in updateGame:

//Gameover if the player falls off the screen or has hit a virus
if(player.y > SCREEN_HEIGHT){
   bgMusic.pause();
   bgMusic.fastSeek(0);
   grazeSFX.pause();
   grazeSFX.fastSeek(0);
   gameState = STATE_GAMEOVER;
}

if(deathCollision){
   bgMusic.pause();
   bgMusic.fastSeek(0);
   grazeSFX.pause();
   grazeSFX.fastSeek(0);
   gameState = STATE_GAMEOVER;
}

Everytime the player dies the music stops and is rewound back to the start for the next run.This code also stops and rewinds our sound effects… but when did they start in the first place? I guess that’s what we should code next.

Logically we want the sound effect to play as long as the player is grazing and virus and stop as soon as he isn’t. That suggests an update to the graze logic in updateGame:

if(grazeCollision){
   if(currentFrameCount % FRAMES_PER_POINT == Math.floor(FRAMES_PER_POINT/2)){
      currentPoints++;
   }
   if(grazeSFX.paused){
      grazeSFX.play();
   }
}
else{
   if(!grazeSFX.paused){
      grazeSFX.pause();
      grazeSFX.fastSeek(0);
   }
}

And that’s it. The game now has sound and music.

It’s Almost Like A Real Game

It’s amazing how much difference a good soundtrack makes to a game. To be honest the rest of the game actually feels pretty lame compared to MacLeod’s work. But hey, it’s an educational demo. What did you really expect.

Anyways, with that complete all that’s really left are a few more game tweaks and some special effects. Stay tuned!

* A singer that was recently famous for being… good? Bad? Easy to parody? I wasn’t really paying attention but I saw her name on the Internet once.

Gengo Girls #101: It’s Grammar Time!

Gengo Girls #101: It's Grammar Time!

If you want to brush up on your casual past tense conjugations you’ll probably want to look here. But we’re going to spend at least a little time going over the “te” version of those rules so don’t worry if you only kind of remember.

Also, while there may be no such thing as the “Samurai Conjugation” fictional TV samurai and ninja often use extremely old fashioned conjugations such as “gozaru”. While fun to listen to this is something you should never use in real life. It will make you sound like a cartoon character with an embarrassingly bad Old English accent (on top of your default American accent) and it’s hard to imagine a situation where you would want that.

Transcript

言語ガールズ #101

It’s Grammar Time!

Yellow: For the next several strips we’re going to be talking about one of the most important conjugations in 日本語: The Samurai Conjugation.

Blue: That’s… not a real thing.

Blue: What we’re actually going to be talking about is the conjugation.

Blue: The conjugation is important because it allows you to combine verbs with other verbs and phrases.

Yellow: Why would I want to mix my verbs with other things?

Blue: Because mixing verbs is important for making requests, giving instructions and even normal present tense conversations.

Yellow: And why is it called the conjugation?

Blue: Because it follows the same rules as the casual past tense but the verbs all end in instead of .

Gengo Girls #100: Big Round Numbers

Gengo Girls #100: Big Round Numbers

Yes, I purposely manipulated lesson order to make sure the kanji for 100 was introduced in strip 100. My deepest apologies.

Vocabulary

= ひゃく = hundred

= せん = thousand

= まん = ten thousand

Transcript

言語ガールズ #100

Big Round Numbers

Blue: Here are some numbers for counting above 99.

Blue: Just like with you can put numbers before each word to tell how many hundreds, thousands and tens of thousands you have.

Yellow: And just like with you can add smaller numbers to the total by putting them after.

Yellow: So a big number like 5,312 would be 五千三百十二

Blue: That might look confusing but it’s easy to split apart: 五千 plus 三百 plusplus.

Yellow: Counting in 日本語 is pretty easy. I wonder why we waited until strip 100 to talk about… oh wait… are you serious!?

Blue: Congratulations! You’ve made it through strips of 言語ガールズ.

Gengo Girls#99: Easy as 1 2 3

Gengo Girls#99: Easy as 1 2 3

Although the Japanese always say numbers in Japanese they sometimes write them in western style. This is especially true when doing math, talking about prices and inside of video games. But they honestly can show up just about anywhere. So don’t be surprised if you’re halfway through reading a Japanese news article and suddenly see a familiar number like “12,503” jump out at you.

Vocabulary

= いち = one

= = two

= さん = three

= = four

= = five

= ろく = six

= しち = seven

= はち = eight

= きゅう = nine

= じゅう = ten

Transcript

言語ガールズ #99

Easy as 1 2 3

Blue: It’s about time we learn how to count!

Blue: Numbers 11-19 are created by writing a number after .

Yellow: So 十三 ( じゅうさん) is 13.

Blue: If you put the number before the instead that shows how many tens you have.

Yellow: That means 五十 (ごじゅう) is five tens, or 50.

Blue: It’s possible to put numbers both before and after the .

Yellow: 五十三 (ごじゅうさん) means five tens plus a three, or 53.

Yellow: Which seems dangerously close to being math…

Gengo Girls #98: Deliberate Word Choice

Gengo Girls #98: Deliberate Word Choice

History was probably my least favorite subject in school. It seemed like it was just a bunch of unrelated trivia you had to memorize and the class moved so quickly you never really had time to study any particular event or issue in depth.

History is much more fun outside the school system. With no schedule to follow you’re free to really study in depth the causes and effects of whatever historic events catch your eye. Plus there are no tests to dock you points for forgetting how to spell the names of ancient historical figures.

Vocabulary

科学 = かがく = science

歴史 = れきし = history

数学 = すうがく = math

体育 = たいいく = P.E.

文学 = ぶんがく = literature

Transcript

言語ガールズ #98

Deliberate Word Choice

Blue: Let’s go over some useful vocabulary for talking about school:

Yellow: What can we do with that vocab?

Blue: Lots of things, like talking about homework.

Blue: 今日の宿題は数学です

Yellow: Ok… let me give something a try.

Yellow: 私は歴史が嫌いです

Blue: Ummm… do you remember how we talked about 嫌い being a pretty strong word?

Yellow: Oh I remember all right.

Gengo Girls #97: Honestly They’re All Pretty Important

Gengo Girls #97: Honestly They're All Pretty Important

Japanese, like English, has a lot of different words for food. “Gohan” suggests a complete meal rather than raw food. “Gohan” is also the word for cooked rice. The fact that the word for rice and food in general are the same should tell you a lot about the Japanese diet.

From what I’ve heard almost every complete Japanese meal will either be based around rice or at least include a small bowl of rice as a side dish. This is even true of a lot of breakfast dishes. I think the big exception is noodle dishes; the noodles provide enough carbohydrates without any extra rice.

But I honestly know very little about Japanese cuisine. You’re going to need to find a different blog if you’re interested in international cuisine.

Vocabulary

朝ご飯 = あさごはん = breakfast

= あさ = morning

ご飯 = ご飯 = food

昼ご飯 = ひるごはん = lunch

= ひる = noon

夕ご飯 = ゆうごはん = dinner

= ゆう = evening

Transcript

言語ガールズ #97

Honestly They’re All Pretty Important

Yellow: I overslept today so I didn’t have time for 朝ご飯.

Blue: But at least you’re keeping up with your vocabulary.

Blue: Here’s some trivia: The word 朝ご飯 is made up of the symbols for “morning” and “food”.

Yellow: Hmph. You can’t eat trivia.

Blue: Lunch and dinner follow a similar pattern.

Yellow: Unless you wrote the trivia down on paper and then ate the paper…

Yellow: Important question: which do you think would taste better? My math notes or the rough draft of that essay we wrote in English?

Gengo Girls #96: Be Nice To The N00bs

Gengo Girls #96: Be Nice To The N00bs

This is another great example of how important hierarchy is to Japanese culture. Even when people are all at the same social level (like a group of employees with similar jobs) there are still rules stating that some people get to be “senpai” and other have to be “kouhai” complete with special rules about how to properly treat each other.

Interesting kanji trivia: “senpai” has the symbol for “before ()” and “kouhai” has the symbol for “after ()”. Translated literally they more or less just mean “the people who came before the other people” and the “people who came later”.

Vocabulary

先輩 = せんぱい = senior

後輩 = こうはい = junior

Transcript

言語ガールズ #96

Be Nice To The N00bs

Blue: One important Japanese social custom is the idea of 先輩 and 後輩.

Blue: A 先輩 is someone who has more experience than you at work or school.

Blue: 後輩 is the opposite: someone with less experience like a new student or new employee.

Blue: 後輩 are supposed to respect their 先輩. In exchange the 先輩 are supposed to support the 後輩.

Yellow: Sounds like a buddy system between experts and beginners.

Yellow: Is that why characters in school dramas always call the upperclassmen 先輩?

Blue: Exactly. Using the title 先輩 shows respect.

Blue: It doesn’t work the other way though. 後輩 usually just get called by name.

Yellow: Too bad we’re both the same age or we could try those titles out.

Blue: Aren’t you just one flunked test away from repeating the grade? You might still get a chance to call me 先輩 after all.