EMMA GEORGE
EMMA GEORGE
HomeAboutProjectsResume

Flexbox Farmer

Cover Image for Flexbox Farmer
Languages used
  • JavaScript
  • HTML
  • CSS
Tools used
  • UIKit
  • Animate.CSS
View Live DemoGithub Repository
Overview

Flexbox Farmer is a web-based game that allows players to buy seeds, grow crops, and sell their harvest. The player's farm, inventory, and bank are cached into local storage, so the fun doesn't have to end upon refresh.

Goal

The aim for this assignment was to create a web page with JavaScript that allow user interaction. To meet this goal, I decided to work on a Farming simulator game.

Build

To make sure the fun lasts even after the window or browser is closed, I set up the plots, bank, and inventory in localStorage.

// Plots cache
let plots = localStorage.getItem("plots") ? JSON.parse(localStorage.getItem("plots")) : [{
  'item': 'strawberry',
  'label': 'Strawberry',
  'timer': {
    'minutes': 0,
    'seconds': 45
  }
}, '', '', '', '', '', '', '', '', '', '', ''];

// Bank cache
let bank = localStorage.getItem("bank") ? parseFloat(localStorage.getItem("bank")) : 5.00;

// Inventory cache
let yourInventory = localStorage.getItem("inventory") ? JSON.parse(localStorage.getItem("inventory")) : { 'carrotSeeds': 3 };
Deployment

Flexbox Farmer is currently hosted on replit.