Gengo Girls #43: Verb Privilege

Gengo Girls #43: Verb Privilege

Desu doesn’t follow normal verb conjugation rules because it isn’t a normal verb, but is instead a verb-like copula. “Copula” is just a fancy linguistic term for “a word that links a subject to a predicate in an ‘A is B’ sort of pattern”. Which is interesting trivia but not something you actually need to know to speak Japanese. Just memorize those conjugations and you’ll be fine.

A piece of trivia that you DO need to know is that in casual Japanese “da” often gets left off the end of sentences, especially sentences of the “A is adjective” pattern. So don’t be surprised if you hear casual conservations involving “A wa B” with no desu or da. And since in Japanese you can also drop obvious subjects don’t be surprised if you hear sentences that are only one word long. It’s perfectly good casual Japanese grammar to say something like “oishii” (tasty) instead of “kore wa oishii desu”.

Transcript

言語ガールズ #43

Verb Privilege

Blue: There are a few irregular negative verbs you need to memorize.

Yellow: I knew this was coming.

Blue: The casual negative of する is しない and the casual negative of 来る(くる) is 来ない(こない).

Blue: Their polite negatives just follow the normal ます to ません rule.

Blue: です doesn’t follow the normal rules at all.

Chart: Polite Positive: です

Polite Negative: ではありません (the is a “wa”)

Casual Positive:

Casual negative: じゃない

Yellow: How come when verbs break the rules they get special treatment, but when I break rules I just get in trouble?

Blue: That’s not a serious question, is it?

Gengo Girls #42: Long Term Planning

Gengo Girls #42: Long Term Planning

You might have noticed that the rules for casual negatives are a lot like the rules for positive polites. Words ending in “iru” or “eru” get a simple replacement while all other words have to be slightly transformed before getting their new ending.

The big difference is that in polites you transform sounds to “i” (ru becomes ri, su becomes shi, etc…) while in casual negatives you transform sounds to “a” (ru becomes ra, su becomes sa, etc…).

Transcript

言語ガールズ #42

Long Term Planning

Yellow: What about casual negative verbs?

Blue: Those are a little more complex.

Blue: If the dictionary form ends in “iru” or “eru” you just replace the with ない.

Yellow: So “I can’t” is 出来ない (できない).

Blue: Otherwise you change the last syllable of the dictionary form to an “a” sound and then add ない.

Yellow: So “I don’t understand” is 分からない (わからない).

Blue: Still sticking with depressing examples?

Yellow: The more I lower your expectations now, the easier it will be to impress you later.

Let’s Program A JavaScript Game 11: This Post Isn’t About Malware, Honest

Let’s Get Dangerous

We have a cycle for the player and an endlessly scrolling screen of platforms for them to jump along. The only piece we’re missing are the deadly virus enemies for the player to avoid.

Viruses are going to be implemented more or less the same as platforms. We’ll have an array of viruses that scroll that to the left. When a virus has moved entirely off screen we drop it from the front of the list and then pin a new virus to the back of the list. In the future we will randomize the location and timing of new viruses to make things a little less predictable but for now a couple viruses marching in a steady line will let us test everything we need to test.

Writing Simple Enemies

The code for the virus obstacles is almost identicle to the code for the platforms. Generate an array of objects, move them a little to the left every frame and check for collisions with the player. So nothing here should be especially mind blowing.

First up, we generate the original list of viruses at the top of code by putting this code right after the platform setup code:

var viruses = new Array();
var virusStartingOffset = 1000;
var maxVirusCount = 2;
var maxVirusGap = 400;
var virusWidth = 50;
var virusHeight = 50;

//Generate starting viruses (all off screen at first)
for(i = 0; i < maxVirusCount; i++){
   var newVirus = new Object();
   newVirus.x = virusStartingOffset + i * (virusWidth + maxVirusGap);
   newVirus.y = 200;
   newVirus.width = virusWidth;
   newVirus.height = virusHeight;
   viruses[i] = newVirus;
}

You also need to include this image related code somewhere so we can draw the viruses. I suggest putting it right after the cycle image code:

var virusImage = new Image();
virusImage.src = "virus.png";

Next up is adding virus code to the updateGame method. Just drop this in right after the big block of platform code:

//Virus logic
for( i = 0; i < viruses.length; i++){
   //Have all viruses move towards the player
   viruses[i].x-=5;
   
   //See if the player is grazing this virus
   if(intersectRect(viruses[i], grazeHitbox)){
      grazeCollision = true;
   }

   //See if the player has had a lethal collision with this virus
   if(intersectRect(viruses[i], deathHitbox)){
      deathCollision = true;
   }
}

//Remove viruses that have scrolled off screen and create new viruses to take their place
if(viruses[0].x + viruses[0].width < 0){
   //Drop first virus by shifting entire list one space left
   for( i = 0; i < viruses.length-1; i++){
      viruses[i] = viruses[i+1];
   }

   //Add new platfrom to end of list by placing it a certain distance after second to last platfor
   var newVirus = new Object();
   newVirus.x = viruses[viruses.length-2].x + virusWidth + maxVirusGap;
   newVirus.y = 200;
   newVirus.width = 50;
   newVirus.height = 50;
   viruses[viruses.length-1] = newVirus;
}

And finally we draw the viruses by adding this simple loop somewhere in our drawScreen method

//Draw viruses
for(i = 0; i < viruses.length; i++){
   context.drawImage(virusImage, viruses[i].x, viruses[i].y);
}

That’s it. You now have a couple of virus obstacles scrolling across the screen along with the platforms. You can jump near them and into them and watch your “graze” and “death” collision status change. These collisions won’t actually do anything yet, but just keeping track of them is the first step towards building a real game-over and bonus point system.

Both “Graze Collision” and “Death Collision” are true, showing we got just a little too close during this test

Both “Graze Collision” and “Death Collision” are true, showing we got just a little too close during this test

Why We Did What We Did

This entire branch of code was mostly just copy pasting the platform code and then renaming the variables, so no big ideas need to be explained. But there was one tiny design decisions that I think deserve a little extra analysis: Why did we give each virus a specific height and width instead of just using the height and width of the global virus image?

Two big reasons.

Reason one: Our collision detection function expects to be given two rectangle like objects that know their own x position, y position, width and height. Giving every virus a copy of this information means we can drop them directly into the collision detection function.

Reason two: We may not want our viruses to always be the same size as their picture. In the future we might decide that we want the virus’s collision box to be smaller than the virus picture in order to make collisions easier to avoid. So by keeping the virus’s height and weight independent form the size of the graphics we draw we give ourselves the freedom to make major changes in the future without breaking anything.

Next Up: Game-Over

With most of the basic game mechanics in place the next thing to do is finally let player’s lose, which is a surprisingly big tasks since it means we will have to introduce ideas like “game states” and “multiple possible screen renderers”.

But don’t worry, it’s actually a pretty simple once you get into it. And it involves flowcharts! Everyone loves flowcharts!

Gengo Girls #41: You Can’t Make Me

Gengo Girls #41: You Can't Make Me

Remember, there is no future tense in Japanese so you’re going to be using the same negative verbs for both describing the present and the future. Depending on the sentence you put it in “benkyou shimasen” can mean “I’m not studying right now”, “I don’t study in general” or “I am not going to study in the future”.

Vocabulary

出来る = できる = to be able to do something

Transcript

言語ガールズ #41

You Can’t Make Me

Blue: It’s important to know how to make negative verbs so you can say things like “I will not go” instead of just “I will go”.

Blue: Making a polite negative verb is easy. Just replace the ます with ません.

Blue: So “I will not go” is 行きません.

Yellow: And “I do not study” is 勉強しません.

Blue: Could you try to choose a more responsible sounding example?

Yellow: 出来ません!

Gengo Girls #40: Negative On That Positive Reinforcement

Gengo Girls #40: Negative On That Positive Reinforcement

Don’t you just love that feeling you get when a new idea finally clicks?

Vocabulary

= ふく = clothes

きれい = pretty

高い = たかい = expensive; tall, high

Transcript

言語ガールズ #40

Negative On That Positive Reinforcement

Yellow: We’re practicing our 日本語 at the mall?

Blue: There are lots of things to look at and talk a bout here. Like that clothing shop over there.

Yellow: あの服はきれいです

Blue: 高いです

Yellow: Oh! I finally get it!

Yellow: Your sentence didn’t need a subject because it was obvious we were both talking about the same piece of clothing.

Yellow: You should celebrate this learning moment by buying me あの服.

Blue: You overestimate both my allowance and my generosity.

Gengo Girls #39: If You Know What I Mean

Gengo Girls #39: If You Know What I Mean

いい天気ですね is a lot like saying “It’s nice outside” and trusting in your listener to figure out that by “it” you mean “today’s weather”.

As a side note, it’s not that uncommon to hear someone say the full 今日はいい天気ですね. Just because you CAN leave out an obvious topic word doesn’t mean you HAVE to leave it out (although the Japanese usually do).

Vocabulary

今日 = きょう = today

Transcript

言語ガールズ #39

If You Know What I Mean

Yellow: If marks the main topic of a sentence, how come some sentences don’t have a ?

Yellow: Like いい天気ですね.

Blue: If your listener already knows what the main topic is going to be you don’t have to actually include it in the sentence.

Blue: So you could say 今日はいい天気ですね.

Blue: But you don’t have to include the 今日は because people know that you’re probably talking about today’s weather.

Yellow: So the better you are at guessing my topics the less 日本語 I have to actually use?

Blue: Don’t use this as an excuse to skip out on memorizing new vocabulary!

 

Gengo Girls #38: Ha Ha Ha

Gengo Girls #38: Ha Ha Ha

 

Japanese has a lot of spoken grammar markets. They use to mark sentences as questions. They use to mark topics. And they use things like and to mark various other important bits of information that we’ll talk about much later.

Which is good news for us because it can make analyzing complex sentences much simpler. Even in a sentence with dozens of adjectives and adverbs and prepositional phrases you can still depend on to point you to the main subject. Most of the time…

Transcript

言語ガールズ #38

Ha Ha Ha

Blue: Let’s talk about the reason that sometimes sounds like “wa” even though it’s usually pronounced “ha”.

Yellow: Is the reason: “Because 日本語 is confusing”?

Blue: In 日本語 every sentence has a main topic, subject or theme.

Blue: That theme is marked by putting a right after it, and it’s these topic marking that sound like “wa”.

Blue: So if you wanted to talk about cats your sentence would start off with “猫は”.

Yellow: Like in 猫は可愛いです.

Blue: Now you can figure out the topic of any sentence by just looking for whatever word comes before the .

Yellow: That’s almost useful enough to make up for one letter having two sounds.

 

Announcement: Immortals Should Try Harder Beta Release

As a child I promised myself I was going to program video games when I grew up. It’s actually why I got into computer science in the first place. And while I have since learned that games aren’t the only cool thing you can do with code I still have a soft spot in my heart for that childhood dream.

Which is why I’m happy to announce the test release of Immortals Should Try Harder, a comedy fantasy RPG that I’ve been slowly but steadily working on in my free time.

I think it turned out pretty decent for a hobby game with no actual budget, so if you have a few hours to burn why not give it a try? And please don’t hesitate to contact me with bug reports, game criticisms or any other sort of comment or concern.

Gengo Girls #37: Victor’s Humility

Gengo Girls #37: Victor's Humility

 

Using “suru” to turn a noun into a verb isn’t that different from how we use “to do” in English. For example, you would never say “That man can math”, you would say “That man can do math”.

The big difference here is that “to do” comes before the noun but “suru” and “shimasu” comes after.

Vocabulary

する = to do

来る = くる = to come

勉強 = べんきょう = study (noun)

勉強する = to study (verb)

Transcript

言語ガールズ #37

Victor’s Humility

Yellow: I found two verbs that don’t follow the normal polite conjugation rules.

Blue: You must be talking about する and 来る.

Blue: The polite form of する is します and the polite form of 来る is きます.

Yellow: Oh… I guess you already knew about them.

Blue: する is especially important because it can be used to turn certain nouns into verbs.

Blue: Like turning 勉強 into 勉強する.

Yellow: I was really hoping I had learned something before you this time.

Blue: It’s not a competition.

Yellow: You’re only saying that because you’re winning.

 

Gengo Girls #36: I Spy

Gengo Girls #36: I Spy

Take a few minutes to look at each of these three verbs and make sure you understand how to make them polite. Two of them use the “change the last sound to ‘i’ and add ‘masu’” rule and one uses the “replace final ‘ru’ with ‘masu’” rule.

Also we’re kind of cutting corners here. Very few people would actually say something like “That person walks”. They would be more likely to say “That person is walking”. But all we know for now are simple verbs so that’s what we’re going to practice.

Vocabulary

遊ぶ = あそぶ = to play

= ひと = person

歩く = あるく = to walk

寝る = ねる = to sleep

Transcript

言語ガールズ #36

I Spy

Blue: Let’s go to the park for some 日本語 practice.

Yellow: OK.

Blue: 犬は遊びます

Blue: あの人は歩きます

Blue: Aren’t you going to say anything?

Yellow: 私は寝ます