Skip to main content

On Sale: GamesAssetsToolsTabletopComics
Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Liam Brocklehurst

13
Posts
5
Topics
1
Following
A member registered Jan 22, 2016

Recent community posts

Yeah I'm thinking that's what I might have to do, thanks!

I might be missing something here, but I'm just wanting to check if an asset exists (from a path) before I assign it to something.

For example, I would do something like:

    this.mySprite.setSprite("Path/To/Sprite");

but I'd like to be able to do:

    if(AssetExists("Path/To/Sprite")
        this.mySprite.setSprite("Path/To/Sprite");

You could give this a go? https://github.com/eonarheim/TypeState

Friend of mine is working on possibly implementing this system into our game currently.

I've yet to go into depth about this, but I'm pretty sure the 'Pixels / unit' property on your sprite assets are where you need to look. As Spencer said, the screen ratio factors in I think

I currently have a system set up to load specific objects from prefabs with certain names at runtime, but I'm wondering if there's any way to run some code in the editor (from the Behavior, hopefully), so I can maybe show the sprites after placing/renaming.

Any thoughts?

The string within the CubicModel constructor is the location of the CubicModel you've created.

For example, if you've created a CubicModel in the Models folder called 'MyModel' you'd write:

let cubicModel = new Sup.CubicModel("Models/MyModel");

Guess it wouldn't be Open Source if it was on Steam, though? (I think)

I recently needed to get the screen position of a player for checks to move the camera, so I added some functions to allow me to do this - figured it might help someone else! If anyone spots any errors, let me know and I can update. I imagine this'll only work for 2D games!


Firstly, I created a class that could hold top, bottom, left, right bounds (reusable for a few things):

class Bounds
{
  constructor(public top: number, public bottom: number, public left: number, public right: number) { }
}

We can then use this within our CameraHelper class:

class CameraHelper {
  
  static WorldToScreenPoint(x: number, y: number, cameraName: string): Sup.Math.Vector2
  {
    let cameraActor = Sup.getActor(cameraName);
    let cameraPos = cameraActor.getPosition();
    let cameraBounds = CameraHelper.CameraBounds(cameraName);
    
    return new Sup.Math.Vector2(
      (x - cameraBounds.left) / Sup.Game.getScreenRatio().width,
      (y - cameraBounds.bottom) / Sup.Game.getScreenRatio().height
    );
  }
  static CameraBounds(cameraName: string): Bounds
  {
    let cameraActor = Sup.getActor(cameraName);
    let cameraPos = cameraActor.getPosition();
    return new Bounds
    (
      cameraPos.y + (Sup.Game.getScreenRatio().height / 2),
      cameraPos.y - (Sup.Game.getScreenRatio().height / 2),
      cameraPos.x - (Sup.Game.getScreenRatio().width / 2),
      cameraPos.x + (Sup.Game.getScreenRatio().width / 2)
    );
  }
}

CameraBounds returns a Bounds type of the world position of the top, bottom, left and right of the camera. WorldToScreenPoint then takes these values and determines what screen point (0-1) the x,y parameters are at.

Sup.Game.getScreenRatio() is possibly not giving us accurate calculations, so if I find a better way (or if someone lets me know) I'll get that changed.

Hope this helps someone!

If you've attached an ArcadeBody2D to your Tile Map within the scene, you can set the 'Tile Set Property' or 'Layers' properties within that as comma-separated entries. (1,4,5 for example, for setting those 3 layers)

I was wondering if there's a good method for making the app go fullscreen and lock orientation? Looking into working with mobile, so these things would obviously be a big help. Unless I'm best wrapping the project within an app that'll sort this out for me?

Not entirely new to game making, but very new in working with web apps/games!

Yeah, no problem! Here's what it's giving me:

SupEngine.js:21795 THREE.WebGLRenderer: Error creating WebGL context.THREE.WebGLRenderer @ SupEngine.js:21795
index.js:18822 Uncaught TypeError: Cannot read property 'setClearColor' of undefined
SupEngine.js:21620 THREE.WebGLRenderer 73
SupEngine.js:21795 THREE.WebGLRenderer: Error creating WebGL context.THREE.WebGLRenderer @ SupEngine.js:21795
index.js:18822 Uncaught TypeError: Cannot read property 'setClearColor' of undefined

I've launched Superpowers with no problems on my PC and friend has been fine working with it, but I'm currently having problems running it on my laptop? I'm having nothing show in the Viewports and I'm unable to add most things (Nodes, Scene Objects, Sprites) This is what I'm seeing in the right menu when on the Cubic Model screen:



Do you know what could be wrong? I feel like it might be some sort of dependency that I don't have installed, but I'm not sure what it could be?