dmsc_spring2021

week 10

today:

Sprite animation

New code technique:

In the latest version of Javascript (Ecmascript 2015), we have an ability to loop through items in an array in a clearer manner, using for…of. This lets us loop through the values of an iterable object.

Instead of:

for (let i = 0; i < horses.length; i++){

  //do something to each of the horses
  
  horses[i].display();
}

Now we can loop through with for…of

for (horse of horses){
  
  //do something to each of the horses
  
  horses[horse].display();
}

Note that you could still use i instead of the word horse, but the full word may help explain what’s happening better in the code.

More info on for..of

Open Game Art

Coding Challenge: Squirrel Eat Squirrel

Squirrel Eat Squirrel is a game by programmer Al Sweigart.

Squirrel Eat Squirrel is loosely based on the game Katamari Damacy. The player controls a small squirrel that must hop around the screen eating smaller squirrels and avoiding larger squirrels. Each time the player’s squirrel eats a squirrel that is smaller than it, it grows larger. If the player’s squirrel gets hit by a larger squirrel larger than it, it loses a life point. The player wins when the squirrel becomes a monstrously large squirrel called the Omega Squirrel. The player loses if their squirrel gets hit three times.

video demo

Basic Requirements:

Advanced:

DOUBLE BONUS POINTS:

Next week:

Homework

Finish Squirrel eat Squirrel! All students should create a devlog explaining their process, choices made, what was difficult, and describing their final version. Include screenshots. Fulfill all of basic requirements and at least 3 in advanced. This is a collaborative effort, but each student should submit their own work and link to final project. Note: Your devlog post should include a link to your game in full screen mode as well as a link to your code

Practice hydra. Get to a pattern you are happy with (at least one) and save it. Post a link to your code URL on our #hydra channel on Discord as well as to the homework on Moodle

We will do an in-class algorave on Thursday May 6 at 5pm!