Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Pixels & Tactics

8727f7875a079ff297d084a03ef1356e?s=47 Amber Feng
October 07, 2015
8.5k

Pixels & Tactics

Adventures of building a 2D tactics RPG in the browser!

8727f7875a079ff297d084a03ef1356e?s=128

Amber Feng

October 07, 2015
Tweet

Transcript

  1. PIXELS & TACTICS @amfeng

  2. None
  3. I REALLY LIKE (J-) RPGS

  4. None
  5. None
  6. None
  7. None
  8. None
  9. None
  10. None
  11. WHAT GOES INTO A GAME?

  12. DESIGN PATTERNS

  13. COMPOSE EVERYTHING

  14. None
  15. Crafty.c("Walkable", { Walkable: function(speed) { this.addComponent("Collision"); this.bind("EnterFrame", function() { if

    (paused()) return; if (obstacle() || outOfBounds()) return; // Move the sprite this.playAnimation(this.direction); this.move(this.direction, speed); })
  16. Crafty.c("StrollingEntity", { StrollingEntity: function() { this.direction = randomDirection(); this.bind("EnterFrame", function()

    { // Possibly change direction if (chanceToSwitchDirection()) { this.direction = randomDirection(); } } } });
  17. spawnedMonster .Walkable(5) .StrollingEntity() .Battleable()

  18. Crafty.c("AggroEntity", { AggroEntity: function(player) { this.direction = randomDirection(); this.bind("EnterFrame", function()

    { if (playerInRange()) { this.direction = toPlayer(player); } else if (chanceToSwitchDirection()) { // Change direction this.direction = randomDirection(); } } } });
  19. aggroMonster .Walkable(10) .AggroEntity(player) .Battleable()

  20. grandmaNPC .Walkable(2) .StrollingEntity() .Interactable(dialog)

  21. player .Walkable(5) .PlayerControl()

  22. *-FACTORIES

  23. var Fox = function() { this.hp = 10; this.damage =

    10; } var WaterFairy = function() { this.hp = 4; this.damage = 6; } var fox = new Fox(); var waterFairy = new WaterFairy();
  24. var Monster = function(attrs) { // Set attrs } var

    fox = new Monster({ hp: 4, damage: 6 });
  25. None
  26. var MonsterFactory = function(csv) { this.data = createMap(csv); } MonsterFactory.prototype.create(type)

    { var attrs = this.data[type]; return new Monster(attrs); }
  27. // During game initialization factory = new MonsterFactory(csv); // And

    then later factory.create("fox");
  28. SEPARATE VIEWS FROM LOGIC

  29. THINGS I LEARNED (AND I AM STILL LEARNING)

  30. ...ASSETS ARE HARD

  31. None
  32. None
  33. None
  34. None
  35. (https://opengameart.org)

  36. (https://gamedevmarket.net)

  37. (http://pixanna.nl/products)

  38. GAME DEV IS INFINITE

  39. THANK YOU! LMK IF YOU END UP BUILDING A GAME

    (: @amfeng @jamescshieh