Skip to content
c  ɐ p ʇ a i ᴎ l ǝ ɘ 🏴‍☠️ o ᴙ g

c ɐ p ʇ a i ᴎ l ǝ ɘ 🏴‍☠️ o ᴙ g

  • 🏝 welcome
  • 🖍 draw
  • 🕹 play
  • ☠ hack
  • 🌍 share

Hold only one object at a time

15 July 2018 by Captain Lee

You want to limit the number of items the player can have on him? Add these few lines in the pick function of the item class, in the item.js script. The player will then systematically drop the object he already has on the ground to be able to pick up a new one.

this.pick = function(){

  // player's interaction with items

  if (this.type==0) winGame();
  else {
    if(onHand.length>0) {
      append(items, new item (playerPos[1].x, playerPos[1].y, onHand[0].type));
      onHand=[];
    }
    append(onHand, this);
    fx[1].play();
    this.supp();
   }
 }

Post navigation

Previous Post:

Transform the treasure into a door

Next Post:

Make a character static

Leave a Reply Cancel reply

Your email address will not be published.

Make your game really unique by hacking the source code !

learn a few basics with the Captain Lee

Give the world the opportunity to play your game.

First hack (recommended)

add assets by yourself

Hack your items

lock the treasure with a key hide an item in a monster transform the treasure into a door hold one item at a time

Hack your characters

make a character static remotely controling characters

By Colin Thil
contact@martiansparlor.com

Licence Creative Commons

Created during the experiment and transmit residency at Villette Makerz

Captain Lee was made using p5.js, a projet by Lauren McCarthy and the Processing Foundation

© 2019 c ɐ p ʇ a i ᴎ l ǝ ɘ 🏴‍☠️ o ᴙ g - Powered by Cleanews