Making a Web Game with JavaScript, Day 3

What we’ll be going over today Reviewing basic programming concepts Showing syntax for each piece of code Going over a small code example Writing pseudo code for Step 6 of the game (where we left off) Going through the actual code for Step 6 Going through steps 7-12 in pseudo code, followed by actual code Here’s the version of the game we’ll get to today: https://codepen.io/panphora/pen/zPvzzY In this version, we have a point system and our alien sprite is able to collect mushrooms....

Comments

Making a Web Game with JavaScript, Day 1

I’m going to pass around a piece of paper to each of you. I want you to write what you know about making games and programming, what you’re hoping to learn by the end of today, and why you want to learn it. What we’ll be learning today: Foundational concepts of programming Introductory lesson on JavaScript Making a game that lets a player control a character and move them around a game board The first thing to understand is that the concepts we’re learning today will be useful for making any kind of software, not just a game....

Comments

Building a Simple Javascript Application

Getting Started New projects are always exciting. However, there’s always the temptation to over-complicate things by planning ahead too much and adding on features that you won’t even use in your final program. For this project, we’re just going to focus on the basics of getting a functional web-app up and running. This app will not be multi-user. It will just be for personal use. We can figure out how to make it multi-user later on....

Comments

How to Handle Errors in Meteor Methods

If you define methods for altering your collections, you get the convenience of not having to define security-issue-prone allow/deny rules. If you define these methods on both the client and the server, you get the benefit of Meteor’s latency compensation feature. You can run into trouble, however, when you throw an error in a client-side method. You get the following unhandled exception: Exception while simulating the effect of invoking 'yourMethodName' Throwing errors on the client and the server In order to get around this, you can create a wrapper function that will throw an error on the server and simply return it on the client....

Comments

Pagination in Meteor.js (with Iron Router support)

Pagination might at first seem like a pretty easy, if not downright fun, feature to implement. However, like a lot of seemingly-small features, it can quickly balloon into a multi-day or multi-week project. To give you an idea of how complicated pagination can be to implement, check out this 3 part tutorial written by the talented Nick Riebeek: Part 1 Part 1a Part 2 At the end of this tutorial, the author ends up with a well-designed, but pretty basic, pagination system....

Comments

The JavaScript Runtime, Fibers, and Meteor.wrapAsync (Meteor.js)

Part 1: The call stack, the event loop, the task queue, and how asyncronous functions work First, some basic context. When you run some JavaScript code, it’s added to the task queue. Think of this as a todo list. When we reach the first item on the todo list, we move it over to another todo list called the call stack. Think of this as a todo list that you want to complete before moving on to the rest of the stuff in your main todo list....

Comments

Make Your First Meteor.js Package

This tutorial will take you through the steps I took in order to make my first Meteor package. The Problem I wanted to be able to show some elements on the page when my app was in production (i.e. deployed to a live server) and other elements when it was in development mode (i.e. on my local machine). In the end, I wanted to be able to write code like this:...

Comments

Deploying Your App to Scalingo (Meteor.js)

Deploying Meteor webapps can be difficult. When I was trying to deploy to Digital Ocean from my Windows machine, I ran into some serious issues. They were easy enough to resolve after I figured out what they were, but they required an extra 10-20 minutes of work every deploy. I’ve heard good things about Modulus. Supposedly they make it really easy to get things set up with their automated command line tool....

Comments

How to Make Custom Sign Up and Login Forms (Meteor.js)

If you’re making a basic website, the accounts-ui package is a great option to get started with (https://atmospherejs.com/meteor/accounts-ui). However, if you want to add some custom styles to your sign up and login forms, follow along here. 1. Install some basic packages meteor add accounts-password meteor add juliancwirko:s-alert The accounts-password package depends on the accounts-base package, so that will also be installed. The juliancwirko:s-alert package will show alerts in the corner of the screen....

Comments

Using Scoped ReactiveVars to Control Tab Visibility (Meteor.js)

Step 1 Install the ReactiveVar package. meteoraddreactive-var Step 2 When the template is created, initialize a new ReactiveVar and set its default value. This ReactiveVar, this.currentPage, will be available on the page’s Template instance. Template.DiscoverPage.created=function(){this.currentTab=newReactiveVar('recent projects');}; Step 3 Also, on template creation, add a function to the template instance to check if the current tab is equal to the passed in value. We will re-use this function a couple times, so we’re putting it on the template instance instead of defining it in a helper multiple times....

Comments