Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

fufroom

8
Posts
3
Topics
19
Followers
34
Following
A member registered Jul 27, 2016 · View creator page →

Creator of

Recent community posts

BOOM!

Please also rate my game on the Ludum Dare site!
http://ludumdare.com/compo/ludum-dare-37/?action=preview&uid=34387
It was my first compo entry.

Thanks so much, I didn't realize It was asking for tile column and row number!

(1 edit)

I am trying to detect what tile my player is on, I have an actor called "bg" that has a tileMapRenderer it points to a tileMap with one layer "0 - Layer" here is the code I am trying and the error I am getting:

 if (Sup.Input.isKeyDown("T")){ 
        var tileMap = Sup.getActor("bg").tileMapRenderer.getTileMap();
        Sup.log( tileMap.getTileAt(0, this.actor.getX(), this.actor.getY()) );
      }

error: "Uncaught TypeError: Cannot read property '0' of undefined"

 if (Sup.Input.isKeyDown("T")){ 
        var tileMap = Sup.getActor("bg").tileMapRenderer.getTileMap();
        Sup.log( tileMap.getTileAt(1, this.actor.getX(), this.actor.getY()) );
      }

error: "runtime.js:336 Uncaught TypeError: Cannot read property 'data' of undefined"
I checked the data coming back from this.actor.getX() / this.actor.getY() and they are both always a float.

I am stumped, thanks for any help!

Hey! There we go, thanks you are awesome!

(1 edit)

I want the player to be able to "walk around" the trees, and also any tree drawn with a lower y position to be drawn in front of the trees with higher y positions.
It's easiest to see in a gif:

I was able to get it working!

class ScatterTrees extends Sup.Behavior {
  trees = [];
  treeCount = 50;
  
  start() {
    for (var i = 0; i < this.treeCount; i++){
      Sup.appendScene("Plants")[0].arcadeBody2D.warpPosition(Sup.Math.Random.float(-5, 5),Sup.Math.Random.float(-5, 5));
    } 
  }

  update() {
  }
}

Sup.registerBehavior(ScatterTrees);

Hi there I am very new to SuperPowers, but I love what I have seen so far.

I am doing a sample game project to practice some skills before I use this engine for LD37.

I am trying to randomly place trees around my map inside a square area between x -15 &15 and y -15 & 15

I created a new Scene called `Plants` and added one actor inside which has a body and a sprite.

I created a new script (shown below) but it only spawns one tree (or maybe 50 overlapping trees?) Any help will be greatly appreciated!

class ScatterTrees extends Sup.Behavior {
  trees = [];
  treeCount = 50;
  awake() {
     for ( let i = 0; i < this.treeCount; i++){
      let newtree = Sup.appendScene("Plants", this.actor)[0];
      newtree.setLocalPosition(Sup.Math.Random.float(-15, 15),Sup.Math.Random.float(-15, 15), 1.1);
      this.trees.push(newtree);
    }  
  }
  update() {
  }
}
Sup.registerBehavior(ScatterTrees);