itch.iohttp://itch.iohttps://itch.io/t/1158020/how-to-make-a-variable-that-can-be-changed-with-multiple-choicesHow to make a variable that can be changed with multiple choiceshttps://itch.io/t/1158020/how-to-make-a-variable-that-can-be-changed-with-multiple-choicesSun, 17 Jan 2021 18:54:14 GMTSun, 17 Jan 2021 18:54:14 GMTSun, 17 Jan 2021 18:54:14 GMTIn superpowers, if you make a variable outside of update or awake, you can change it in the scene. But how do you make it so you can choose a choice like the different camera modes? Is it with Sup.Math like making Vec3s?

]]>
https://itch.io/t/1866232/how-to-import-scripts-from-outside-source-and-use-them-in-superpowersHow to import scripts from outside source and use them in Superpowers???https://itch.io/t/1866232/how-to-import-scripts-from-outside-source-and-use-them-in-superpowersFri, 14 Jan 2022 06:25:41 GMTFri, 14 Jan 2022 06:25:41 GMTFri, 14 Jan 2022 06:25:41 GMTI have been searching forever for a solution to this problem.

Apparently there is a way to get Post-Processing working within Superpowers through the "EffectComposer" using Three.js, but I have yet to get it working to any capacity. Every time I try to run the script I get a bunch of errors with the EffectComposer. I'm not sure if it's because I'm not  getting the actual scripts (I would also love to know how to import scripts from inside project resources locally as well).

Project with Post-Processing:  https://github.com/SchynsO/DemoFirstPerson

Error pic: 

If anyone out there still using Superpowers that could help me in solving this and getting it working, I would be so thankful!!! 

]]>
https://itch.io/t/1097614/how-to-get-input-from-the-consoleHow to get input from the consolehttps://itch.io/t/1097614/how-to-get-input-from-the-consoleSun, 06 Dec 2020 20:38:01 GMTSun, 06 Dec 2020 20:38:01 GMTSun, 06 Dec 2020 20:38:01 GMTIs there a command that returns a variable of  the input from the console. Kinda like the input command in  python or the readLine command in c# etc


I tried Prompt however that is for vanillas JS it seems and it doesn't work for Sp TS. Sup.input has no functions for it it seems and this page doesn't seem to work for me.  Am I missing something that's in plain sight? 

]]>
https://itch.io/t/39030/get-phone-orientation-Get phone orientation ?https://itch.io/t/39030/get-phone-orientation-Fri, 09 Sep 2016 17:10:28 GMTFri, 09 Sep 2016 17:10:28 GMTFri, 09 Sep 2016 17:10:28 GMTHello,

I was wondering, is there a way to get the phone pitch, yaw and roll ?

I saw ways to do it in JS (using window.addEventListener()), but it doesn't seems to work with superpowers, the compilation fails.

Do somebody knows if there is a way to get it ? (a plugin or a function that is well hidden ?)

Thanks anyway :D

]]>
https://itch.io/t/1036535/supactorsetorientationquaternionSup.actor.setOrientation(Quaternion);https://itch.io/t/1036535/supactorsetorientationquaternionWed, 28 Oct 2020 19:29:45 GMTWed, 28 Oct 2020 19:29:45 GMTWed, 28 Oct 2020 19:29:45 GMTWhenever I use this function, My screen goes white. 

i got code now so thats cool 

if(Sup.Input.isKeyDown("RIGHT") && turncoin > 0){ 
        let orientation = new Sup.Math.Quaternion(0, 0, 90, 0);
        this.actor.setOrientation(orientation);
        stage = "static";
        turncoin =  turncoin - 25;
      } 
]]>
https://itch.io/t/1045478/getbehaviour-with-interfaceGetBehaviour with interfacehttps://itch.io/t/1045478/getbehaviour-with-interfaceMon, 02 Nov 2020 14:03:22 GMTMon, 02 Nov 2020 14:03:22 GMTMon, 02 Nov 2020 14:03:22 GMTHello guys !

Do you know a way to getBehavior with an interface passed as an arg.

My problem is that I created a IInteractable interface, implemented on some behavior.
When I press E input, I want to get the component (if it exists) that implements the interface of the actor in front of the character.

Here's my code:

interface IInteractable
{
  interactable(): void;
} class LightBehavior extends Sup.Behavior implements IInteractable {
  interact()
  {
    this.switchLight();
  }
  
  switchLight()
  {
    /* CODE OMITTED */
  }
}
Sup.registerBehavior(LightBehavior); class CharacterBehaviour extends Sup.Behavior
{
update()
{
     if (Sup.Input.isKeyDown("E"))
     {
         /* Get actor in front of the character*/
        /* THE PROBLEM: Get IInteractable interface of the actor*/
    }
}
}

Thank you guys!

]]>
https://itch.io/t/1022985/get-global-positionGet global positionhttps://itch.io/t/1022985/get-global-positionMon, 19 Oct 2020 17:26:28 GMTMon, 19 Oct 2020 17:26:28 GMTMon, 19 Oct 2020 17:26:28 GMTI'm trying to use the .getPosition methods  functions to get the x and y of an object but I just keep getting errors. Is their a certain order or different function you have to use?  

]]>
https://itch.io/t/611728/get-input-key-nameGet input key namehttps://itch.io/t/611728/get-input-key-nameThu, 21 Nov 2019 02:38:32 GMTThu, 21 Nov 2019 02:38:32 GMTThu, 21 Nov 2019 02:38:32 GMTHello, I've read the documentation on Sup.Input and found out that I can check which key was pressed, but is there a way to get the key name on Input?

Picture the following scenario for example:

The game has an options menu which allows the player to change the controls. When the player presses a key, the key is saved in local storage.


Is there a way to get the key name without having to compare them one by one?

]]>
https://itch.io/t/329825/scrollable-contentScrollable contenthttps://itch.io/t/329825/scrollable-contentTue, 06 Nov 2018 14:28:38 GMTTue, 06 Nov 2018 14:28:38 GMTTue, 06 Nov 2018 14:28:38 GMTHello to everyone! I'm trying to integrate a UI into my project, with a scrollable panel. it's possible? does anyone have any idea how it could be integrated?

]]>
https://itch.io/t/25120/dynamic-imageDynamic Imagehttps://itch.io/t/25120/dynamic-imageWed, 25 May 2016 23:16:55 GMTWed, 25 May 2016 23:16:55 GMTWed, 25 May 2016 23:16:55 GMTHi,

In my game I store the data about my NPC into a Database with a JSON file. I want to have a NPC with a specific image depending on data. For example if it is level 5 I want to put the sprite of level 5.

In a normal TypeScript app I would have put a string with the URL of the sprite (spirte = 'spirteUrl'+npc.level). But on Superpowers I don't know how to do that because the link to the sprite is on the actor, not the script.

Thanks for your help

]]>
https://itch.io/t/211259/getposition-from-3rd-nested-actor-is-wrongGetPosition from 3rd nested Actor is wrong!https://itch.io/t/211259/getposition-from-3rd-nested-actor-is-wrongFri, 30 Mar 2018 21:50:27 GMTFri, 30 Mar 2018 21:50:27 GMTFri, 30 Mar 2018 21:50:27 GMTposted a bug here https://github.com/superpowers/superpowers-game/issues/188

hi im trying to draw line in three.js from one dynamically created Actor model to another

1st level is 0,0,0 actor
2nd level of nested Actors give correct cords and line is ok 
3rd level of nested Actors give incorrect cords and line is wrong
code>>>
let toStar=(this.map[1] as Sup.Actor);
let staractor=(this.map[0] as Sup.Actor);
let toStarp=toStar.getChildren()[0].getPosition();
let staractorp=staractor.getChildren()[0].getPosition();
let g=new THREE.Geometry();
g.vertices.push(new THREE.Vector3(staractorp.x,staractorp.y,staractorp.z));
g.vertices.push(new THREE.Vector3(toStarp.x,toStarp.y,toStarp.z));
let line=new THREE.Line(g,new THREE.LineBasicMaterial({color:0xFFFFFF,opacity:0.5} ));

tryed to compute via recursion add getLocalPosition()+getParent().getPosition() but values are still wrong... 

]]>
https://itch.io/t/153409/2d-animation-making-an-animation-not-loop-is-not-working-help[2D Animation] Making an animation not loop is not working. HELPhttps://itch.io/t/153409/2d-animation-making-an-animation-not-loop-is-not-working-helpFri, 20 Oct 2017 17:25:48 GMTFri, 20 Oct 2017 17:25:48 GMTFri, 20 Oct 2017 17:25:48 GMTthis.actor.spriteRenderer.setAnimation("Crouch",false);  

API: this.actor.spriteRenderer.setAnimation(String " ",looping? boolean);  

No matter what I do I cannot get this animation to not loop, and I have tried to go the long way by using "wait" functions but I could not figure out how to do that either, please help!

]]>
https://itch.io/t/20387/set-parent-behaviorSet Parent Behavior?https://itch.io/t/20387/set-parent-behaviorMon, 11 Apr 2016 00:31:11 GMTMon, 11 Apr 2016 00:31:11 GMTMon, 11 Apr 2016 00:31:11 GMTis it possible to inherit code from a behavior?

I tried setting "class PlayerBehavior extends EntityBehavior"

but the code doesn't run

It would be cool to see some sort of help tab in superpowers that shows anwsers to categories of questions

]]>
https://itch.io/t/117853/mouse-focus-on-a-3d-object-solvedMouse focus on a 3D object [solved]https://itch.io/t/117853/mouse-focus-on-a-3d-object-solvedTue, 04 Jul 2017 20:05:51 GMTTue, 04 Jul 2017 20:05:51 GMTWed, 05 Jul 2017 10:10:28 GMTHi there !

I have a problem : is there any function or way to know if my mouth is focusing an object in a 3D context ?

Here is my problem : I have a box, and I want to execute an action when I click on it. But the thing is that my camera can move. So I can't use the getMousePosition method which only returns 2D coordinates...

thank you !

]]>
https://itch.io/t/140476/x-and-y-components-from-vector2x and y components from Vector2?https://itch.io/t/140476/x-and-y-components-from-vector2Wed, 06 Sep 2017 21:11:35 GMTWed, 06 Sep 2017 21:11:35 GMTWed, 06 Sep 2017 21:11:35 GMTI'm pretty new to TypeScript (and programming in general), and I'm having a hard time using getMouseDelta and trying to apply it to player rotation. Is there a way to get the x and y components from the vector? I couldn't figure it out :c

]]>
https://itch.io/t/40138/globalsGlobals?https://itch.io/t/40138/globalsMon, 19 Sep 2016 13:01:45 GMTMon, 19 Sep 2016 13:01:45 GMTMon, 19 Sep 2016 13:01:45 GMTIs there a way to access a variable from another script or make a global variable I can access from any script?

]]>
https://itch.io/t/46326/calculation-of-player-coordinate-in-tilemapCalculation of player coordinate in tileMaphttps://itch.io/t/46326/calculation-of-player-coordinate-in-tilemapSun, 06 Nov 2016 17:07:24 GMTSun, 06 Nov 2016 17:07:24 GMTSun, 06 Nov 2016 17:07:24 GMTHi I've a tileMap and a playeret in a Scene I wan't to calculate position of player in the map

The pixels per unit of the map is 50

The pixels per unit of th player is 100

I've try to multiply coordinate by 1.5 but the result is not good.




Default value of coordinates (After 1.5 multiplication x= 14.49)

]]>
https://itch.io/t/44751/mobile-performance-and-ads-iap-integrationMobile performance and Ads, IAP Integrationhttps://itch.io/t/44751/mobile-performance-and-ads-iap-integrationTue, 25 Oct 2016 07:09:23 GMTTue, 25 Oct 2016 07:09:23 GMTTue, 25 Oct 2016 07:09:23 GMTHello guys,

I was a backer for Superpowers when it was first announced and always liked the idea of using Superpowers for my projects.

The only thing that kept me from using it commercially was the mobile support.

As the title suggests, I am worried about 2 things:

- Mobile performance. Does anyone know how 2d or 3d games perform on iOS and Android?

- Ads and IAP. I recently found this. They are plugins for many ad services and iap's for html5. Do you think they could work with Superpowers?

Thank you :)

]]>
https://itch.io/t/44958/move-actor-based-on-its-orientation-with-applylocalimpulseMove Actor Based On Its Orientation With applyLocalImpulse()?https://itch.io/t/44958/move-actor-based-on-its-orientation-with-applylocalimpulseThu, 27 Oct 2016 07:52:39 GMTThu, 27 Oct 2016 07:52:39 GMTThu, 27 Oct 2016 07:52:39 GMTHey all!

So, here's the deal: I'm working in 3D and I want to make an actor move based on where it's facing. So hitting the 'W' key should move the character towards where they are 'looking' at [ using physics, btw, got a cannon-body hooked up to the character ].

I've tried a few methods, but the simplest seems to be:

this.actor.cannonBody.body.applyLocalImpulse( new CANNON.Vec3( 0, 0, -1 ), new CANNON.Vec3( 0, 0, 0 ) );

Now, while this does work, I'm very new to 3D programming, confused about physics, and bad at math haha. So I was wondering if this is the best way to go about it, or is there a simpler / possibly less resource-intensive [ not that I notice `applyLocalImpulse()` to be all that bad ] way of going about things?


If you have experience with this kind of stuff, please let me know! And share any and all knowledge you have on the topic as I'm trying to consume all the information I can in an effort to learn. Thanks a ton! :)

]]>
https://itch.io/t/42267/check-if-an-asset-existsCheck if an asset exists?https://itch.io/t/42267/check-if-an-asset-existsThu, 06 Oct 2016 18:49:41 GMTThu, 06 Oct 2016 18:49:41 GMTThu, 06 Oct 2016 18:49:41 GMT 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");
]]>
https://itch.io/t/40516/typescript-based-state-machinetypescript based state machine?https://itch.io/t/40516/typescript-based-state-machineThu, 22 Sep 2016 22:58:12 GMTThu, 22 Sep 2016 22:58:12 GMTThu, 22 Sep 2016 22:58:12 GMTDoes anyone happen to have an example of a state machine type pattern implemented in TypeScript?

]]>
https://itch.io/t/40983/pause-the-gamePause the Game?https://itch.io/t/40983/pause-the-gameMon, 26 Sep 2016 21:35:33 GMTMon, 26 Sep 2016 21:35:33 GMTMon, 26 Sep 2016 21:35:33 GMTIs there a quick way to pause a game in SuperPowers? (Like the Time.timeScale=0 trick used in Unity)

I have quite a few tweens running and I'd like to be able to just stop all of them when an in-game pause button is pressed.

Thanks!

]]>
https://itch.io/t/40904/applying-a-shader-to-the-whole-screenApplying a shader to the whole screenhttps://itch.io/t/40904/applying-a-shader-to-the-whole-screenMon, 26 Sep 2016 10:16:07 GMTMon, 26 Sep 2016 10:16:07 GMTMon, 26 Sep 2016 10:16:07 GMTIs there a way to apply to a shader to the whole screen/canvas and not only to single sprites/tilemaps?

]]>
https://itch.io/t/39711/set-sprite-then-set-spritepositionSet sprite then set spritePositionhttps://itch.io/t/39711/set-sprite-then-set-spritepositionThu, 15 Sep 2016 16:54:36 GMTThu, 15 Sep 2016 16:54:36 GMTThu, 15 Sep 2016 16:54:36 GMTI have a behavior which need to set its sprite some time after its initialization, I can do it pretty easily with X.spriteRenderer.setSprite(). But now I need to set the size of the sprite, is there a function, for example:

X.spriteRenderer.setSize(32, 32);
]]>
https://itch.io/t/40324/uncaught-error-could-not-find-a-behavior-class-named-enemyshipspawneraibehavior-for-actor-enemyshipspawnerUncaught Error: Could not find a behavior class named "EnemyShipSpawnerAIBehavior" for actor "EnemyShipSpawner".https://itch.io/t/40324/uncaught-error-could-not-find-a-behavior-class-named-enemyshipspawneraibehavior-for-actor-enemyshipspawnerWed, 21 Sep 2016 04:00:13 GMTWed, 21 Sep 2016 04:00:13 GMTWed, 21 Sep 2016 04:00:13 GMTSo I'm working on a game, and I get this error when appending a scene with a prefab in it. The prefab doesn't have any components other than a behavior script. The class name is correct (EnemyShipSpawnerAIBehavior), and I'm appending to the scene directly after loading the initial scene.

Error Message:

Uncaught Error: Could not find a behavior class named "EnemyShipSpawnerAIBehavior" for actor "EnemyShipSpawner". Make sure you're using the class name, not the script's name and that the class is declared before the behavior component is created (or before the scene is loaded).

]]>
https://itch.io/t/36282/odd-pixel-distortion-is-causing-pixel-art-to-look-wrongOdd pixel distortion is causing pixel art to look wronghttps://itch.io/t/36282/odd-pixel-distortion-is-causing-pixel-art-to-look-wrongSat, 20 Aug 2016 23:43:49 GMTSat, 20 Aug 2016 23:43:49 GMTSat, 20 Aug 2016 23:43:49 GMTI'm trying to learn my way through this, and I'm making a decent amount of progress, but there's something that I can't get past.

I try to do pixel art, but when it's in-engine, it always seems distorted.

It comes out looking like this, when I created it to look like this.

I can't figure out how to make it not distort pixel art, and its making creating good looking pixel art difficult.

Is this my mistake, my browser's mistake, or an engine mistake, and if it's the first one, how do I avoid it?

]]>
https://itch.io/t/38525/pacman-tutorialaccess-functions-in-other-scriptsPacman Tutorial/Access functions in other scriptshttps://itch.io/t/38525/pacman-tutorialaccess-functions-in-other-scriptsMon, 05 Sep 2016 03:03:23 GMTMon, 05 Sep 2016 03:03:23 GMTMon, 05 Sep 2016 03:03:23 GMTPretty new to typescript. Trying to figure out how I would access the functions in a player behavior in another script? I have player added to a game namespace like the paceman tutorial:

namespace Game {

export let initMap: initMapBehavior;

export let player: playerBehavior;

export let score: number;

export let won: boolean;

}

I was hoping I would access my player functions from other scripts by doing something like

Player.jump

But I'm getting an identifier expected error.

]]>
https://itch.io/t/35484/problem-with-applying-of-shaderProblem with applying of shaderhttps://itch.io/t/35484/problem-with-applying-of-shaderSun, 14 Aug 2016 07:42:40 GMTSun, 14 Aug 2016 07:42:40 GMTSun, 14 Aug 2016 07:42:40 GMT I'm trying to apply water shader that i find on shadertoy, but by the lack of knowledge in this it's obviously not work. maybe someone can explain what i've done wrong and how to make it work? here is fragment shader:

uniform float time;
varying vec2 vUv;
/*
"Seascape" by Alexander Alekseev aka TDM - 2014
License Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.
Contact: tdmaav@gmail.com
*/
const int NUM_STEPS = 8;
const float PI         = 3.1415;
const float EPSILON    = 1e-3;
float EPSILON_NRM    = 0.1 / 800;
// sea
const int ITER_GEOMETRY = 3;
const int ITER_FRAGMENT = 5;
const float SEA_HEIGHT = 0.6;
const float SEA_CHOPPY = 4.0;
const float SEA_SPEED = 0.8;
const float SEA_FREQ = 0.16;
const vec3 SEA_BASE = vec3(0.1,0.19,0.22);
const vec3 SEA_WATER_COLOR = vec3(0.8,0.9,0.6);
float SEA_TIME = time * SEA_SPEED;
mat2 octave_m = mat2(1.6,1.2,-1.2,1.6);
// math
mat3 fromEuler(vec3 ang) {
    vec2 a1 = vec2(sin(ang.x),cos(ang.x));
    vec2 a2 = vec2(sin(ang.y),cos(ang.y));
    vec2 a3 = vec2(sin(ang.z),cos(ang.z));
    mat3 m;
    m[0] = vec3(a1.y*a3.y+a1.x*a2.x*a3.x,a1.y*a2.x*a3.x+a3.y*a1.x,-a2.y*a3.x);
    m[1] = vec3(-a2.y*a1.x,a1.y*a2.y,a2.x);
    m[2] = vec3(a3.y*a1.x*a2.x+a1.y*a3.x,a1.x*a3.x-a1.y*a3.y*a2.x,a2.y*a3.y);
    return m;
}
float hash( vec2 p ) {
    float h = dot(p,vec2(127.1,311.7));    
    return fract(sin(h)*43758.5453123);
}
float noise( in vec2 p ) {
    vec2 i = floor( p );
    vec2 f = fract( p );    
    vec2 u = f*f*(3.0-2.0*f);
    return -1.0+2.0*mix( mix( hash( i + vec2(0.0,0.0) ), 
                     hash( i + vec2(1.0,0.0) ), u.x),
                mix( hash( i + vec2(0.0,1.0) ), 
                     hash( i + vec2(1.0,1.0) ), u.x), u.y);
}
// lighting
float diffuse(vec3 n,vec3 l,float p) {
    return pow(dot(n,l) * 0.4 + 0.6,p);
}
float specular(vec3 n,vec3 l,vec3 e,float s) {    
    float nrm = (s + 8.0) / (3.1415 * 8.0);
    return pow(max(dot(reflect(e,n),l),0.0),s) * nrm;
}
// sky
vec3 getSkyColor(vec3 e) {
    e.y = max(e.y,0.0);
    vec3 ret;
    ret.x = pow(1.0-e.y,2.0);
    ret.y = 1.0-e.y;
    ret.z = 0.6+(1.0-e.y)*0.4;
    return ret;
}
// sea
float sea_octave(vec2 uv, float choppy) {
    uv += noise(uv);        
    vec2 wv = 1.0-abs(sin(uv));
    vec2 swv = abs(cos(uv));    
    wv = mix(wv,swv,wv);
    return pow(1.0-pow(wv.x * wv.y,0.65),choppy);
}
float map(vec3 p) {
    float freq = SEA_FREQ;
    float amp = SEA_HEIGHT;
    float choppy = SEA_CHOPPY;
    vec2 uv = p.xz; uv.x *= 0.75;
    float d, h = 0.0;    
    for(int i = 0; i < ITER_GEOMETRY; i++) {        
        d = sea_octave((uv+SEA_TIME)*freq,choppy);
        d += sea_octave((uv-SEA_TIME)*freq,choppy);
        h += d * amp;        
        uv *= octave_m; freq *= 1.9; amp *= 0.22;
        choppy = mix(choppy,1.0,0.2);
    }
    return p.y - h;
}
float map_detailed(vec3 p) {
    float freq = SEA_FREQ;
    float amp = SEA_HEIGHT;
    float choppy = SEA_CHOPPY;
    vec2 uv = p.xz; uv.x *= 0.75;
    float d, h = 0.0;    
    for(int i = 0; i < ITER_FRAGMENT; i++) {        
        d = sea_octave((uv+SEA_TIME)*freq,choppy);
        d += sea_octave((uv-SEA_TIME)*freq,choppy);
        h += d * amp;        
        uv *= octave_m; freq *= 1.9; amp *= 0.22;
        choppy = mix(choppy,1.0,0.2);
    }
    return p.y - h;
}
vec3 getSeaColor(vec3 p, vec3 n, vec3 l, vec3 eye, vec3 dist) {  
    float fresnel = 1.0 - max(dot(n,-eye),0.0);
    fresnel = pow(fresnel,3.0) * 0.65;
    vec3 reflected = getSkyColor(reflect(eye,n));    
    vec3 refracted = SEA_BASE + diffuse(n,l,80.0) * SEA_WATER_COLOR * 0.12; 
    vec3 color = mix(refracted,reflected,fresnel);
    float atten = max(1.0 - dot(dist,dist) * 0.001, 0.0);
    color += SEA_WATER_COLOR * (p.y - SEA_HEIGHT) * 0.18 * atten;
    color += vec3(specular(n,l,eye,60.0));
    return color;
}
// tracing
vec3 getNormal(vec3 p, float eps) {
    vec3 n;
    n.y = map_detailed(p);    
    n.x = map_detailed(vec3(p.x+eps,p.y,p.z)) - n.y;
    n.z = map_detailed(vec3(p.x,p.y,p.z+eps)) - n.y;
    n.y = eps;
    return normalize(n);
}
float heightMapTracing(vec3 ori, vec3 dir, out vec3 p) {  
    float tm = 0.0;
    float tx = 1000.0;    
    float hx = map(ori + dir * tx);
    if(hx > 0.0) return tx;   
    float hm = map(ori + dir * tm);    
    float tmid = 0.0;
    for(int i = 0; i < NUM_STEPS; i++) {
        tmid = mix(tm,tx, hm/(hm-hx));                   
        p = ori + dir * tmid;                   
        float hmid = map(p);
        if(hmid < 0.0) {
            tx = tmid;
            hx = hmid;
        } else {
            tm = tmid;
            hm = hmid;
        }
    }
    return tmid;
}
// main
void mainImage( out vec4 fragColor, in vec2 fragCoord ) {    
    float ttime = time * 0.3;
    // ray
    vec3 ang = vec3(sin(ttime*3.0)*0.1,sin(ttime)*0.2+0.3,ttime);    
    vec3 ori = vec3(0.0,3.5,ttime*5.0);
    vec3 dir = normalize(vec3(vUv.xy,-2.0)); dir.z += length(vUv) * 0.15;
    dir = normalize(dir) * fromEuler(ang);
    // tracing
    vec3 p;
    heightMapTracing(ori,dir,p);
    vec3 dist = p - ori;
    vec3 n = getNormal(p, dot(dist,dist) * EPSILON_NRM);
    vec3 light = normalize(vec3(0.0,1.0,0.8)); 
    // color
    vec3 color = mix(
        getSkyColor(dir),
        getSeaColor(p,n,light,dir,dist),
        pow(smoothstep(0.0,-0.05,dir.y),0.3));
    // post
    fragColor = vec4(pow(color,vec3(0.75)), 1.0);
}
void main(){
  vec4 color = vec4(0.0,0.0,0.0,1.0);
  mainImage( color, gl_FragCoord.xy );
  color.w = 1.0;
  gl_FragColor = color;
}

Original shader is here - https://www.shadertoy.com/view/Ms2SD1

]]>
https://itch.io/t/33414/getting-global-var-from-other-objects-scriptGetting global var from other object's scripthttps://itch.io/t/33414/getting-global-var-from-other-objects-scriptSat, 30 Jul 2016 17:34:06 GMTSat, 30 Jul 2016 17:34:06 GMTSat, 30 Jul 2016 17:34:06 GMTHow can i access/set a global variable from another object's script? Thanks.

]]>
https://itch.io/t/33148/get-tile-id-of-tilemap-at-sprite-xyGet tile ID of tilemap at sprite XYhttps://itch.io/t/33148/get-tile-id-of-tilemap-at-sprite-xyThu, 28 Jul 2016 17:21:10 GMTThu, 28 Jul 2016 17:21:10 GMTThu, 28 Jul 2016 17:21:10 GMTLets say for example, that i want to get the tile id at 8 pixels bellow the player's y position. How would i go about doing that?

Thanks.

]]>
https://itch.io/t/25392/follow-mouse-position-not-exactFollow Mouse Position not exact?https://itch.io/t/25392/follow-mouse-position-not-exactSat, 28 May 2016 22:46:55 GMTSat, 28 May 2016 22:46:55 GMTSat, 28 May 2016 22:46:55 GMTI created this script and attached it to an actor:

class FollowMouseBehavior extends Sup.Behavior {

update() {

this.actor.setPosition(Sup.Input.getMousePosition());

}

}

Sup.registerBehavior(FollowMouseBehavior);


It "roughly" follows the mouse cursor, but it drags behind a bit and I'm not sure why.

]]>
https://itch.io/t/18633/eventemitter-how-it-worksEventEmitter how it works?https://itch.io/t/18633/eventemitter-how-it-worksSun, 20 Mar 2016 22:25:18 GMTSun, 20 Mar 2016 22:25:18 GMTSun, 20 Mar 2016 22:25:18 GMTHow to setup the emitter event for the script on global and local script run?

]]>
https://itch.io/t/24422/export-a-classExport a classhttps://itch.io/t/24422/export-a-classWed, 18 May 2016 00:29:35 GMTWed, 18 May 2016 00:29:35 GMTWed, 18 May 2016 00:29:35 GMTHi there,

I would like to use to trigger some method from a class from another one using "export". For example I would like to do:
"export class CharacterBehavior ..." and then import it in another file "import (CharacterBehavior) from './game'".
But when I do that it keeps telling me : "(0): Cannot compile modules unless the '--module' flag is provided."
Does someone know how I could achieve that ?

Thank you =)

]]>
https://itch.io/t/24740/print-statementPrint Statementhttps://itch.io/t/24740/print-statementSat, 21 May 2016 20:01:24 GMTSat, 21 May 2016 20:01:24 GMTSat, 21 May 2016 20:01:24 GMTIs there a print statement available in Superpowers? Something like the javascript console.log(). I'd like to use it for printing debug output.

]]>
https://itch.io/t/24509/can-i-use-two-or-more-maps-in-superpowers-modelCan I use two or more maps in superpowers modelhttps://itch.io/t/24509/can-i-use-two-or-more-maps-in-superpowers-modelThu, 19 May 2016 06:28:34 GMTThu, 19 May 2016 06:28:34 GMTThu, 19 May 2016 06:28:34 GMTHi there,

I have model and want to use two maps.

But in superpowers i am import model and only one texture.

so,can i use two or more maps and how to do it.

thanks.

]]>
https://itch.io/t/23232/transform-a-vector3Transform a Vector3https://itch.io/t/23232/transform-a-vector3Thu, 05 May 2016 09:35:32 GMTThu, 05 May 2016 09:35:32 GMTThu, 05 May 2016 09:35:32 GMTHello,

So, in my game i would like the player to move considering his orientation, for exemple if the player's character looks on the right, pressing forward will transform the vector 1, 0, 0 to 0, 0, 1. I'm just looking for a transform function, but didn't found something corresponding to what I need. already use this line of code for the movement:

this.actor.cannonBody.body.applyImpulse(new CANNON.Vec3(Sup.Input.getGamepadAxisValue(0,0) * this.speed - v.x, velocity.y - v.y, Sup.Input.getGamepadAxisValue(0,1) * this.speed - v.z), pos);

thanks :)

]]>
https://itch.io/t/23041/how-to-detect-click-on-spriteHow to detect click on Spritehttps://itch.io/t/23041/how-to-detect-click-on-spriteMon, 02 May 2016 21:49:38 GMTMon, 02 May 2016 21:49:38 GMTMon, 02 May 2016 21:49:38 GMTHey,

i've used the ray method to detect "intersect" with a sprite. It works but with the whole image. I mean even if i click on the void of my sprite (invisible pixel).

How can i detect exact click on the sprite (with color).

Regards.

Fairy

]]>
https://itch.io/t/20120/get-keyboard-input-as-stringGet keyboard input as string?https://itch.io/t/20120/get-keyboard-input-as-stringFri, 08 Apr 2016 23:43:17 GMTFri, 08 Apr 2016 23:43:17 GMTFri, 08 Apr 2016 23:43:17 GMTis it possible to get the users keyboard input as a string?

if so how? I don't see anything around the name of "get_keyboard"

]]>
https://itch.io/t/18317/script-solved-how-to-know-what-scene-is-running[Script] [SOLVED] How to know what Scene is running?https://itch.io/t/18317/script-solved-how-to-know-what-scene-is-runningMon, 14 Mar 2016 23:11:27 GMTMon, 14 Mar 2016 23:11:27 GMTThu, 17 Mar 2016 16:33:40 GMTSo, I have one script for two Scenes (SceneA, SceneB). I want to do something like this:

if (Sup.getScene() === 'SceneA') 
    { //doSomething } 
else if (Sup.getScene() === 'SceneB') 
    { //doOtherStuff } 
else 
    { //doNothing }

The point is: I want to get the current scene running. Is it Possible?

@Edit

I tried this: Scene Detection by LukeLanFaust answer, but my Log was: >> activeScene content: undefined

]]>
https://itch.io/t/16328/weirdness-with-arcadebody2dWeirdness with Arcadebody2dhttps://itch.io/t/16328/weirdness-with-arcadebody2dMon, 15 Feb 2016 03:57:27 GMTMon, 15 Feb 2016 03:57:27 GMTMon, 15 Feb 2016 03:57:27 GMTSo I have the following code:

class ShipBehavior extends Sup.Behavior {

//Connect the ship to it's collision

ship_hull = this.actor.arcadeBody2D;

//Set the handling speed

speed : number = .025

awake() {

}

update() {

let x : number = this.actor.getX();

let x_speed : number = Math.abs(this.ship_hull.getVelocityX());

let new_x_speed : number = 0;

//Check in any key is pressed, and if one is, update the direction accordingly

//Handle leftward movement

if(Sup.Input.isKeyDown("A")){

new_x_speed =-this.speed;

}

//Handle rightward movement

else if(Sup.Input.isKeyDown("D")){

new_x_speed = this.speed;

}

this.ship_hull.setVelocityX(new_x_speed);

}

}

Sup.registerBehavior(ShipBehavior);


But it produces strange behavoir when run, as I move at a crawl to the left, but at a very fast (maybe 10x?) pace when I go left. this is literally the only script in the game, so the problem is going to be in here.

Thanks in advance,

Unwary

]]>
https://itch.io/t/18370/help-getting-an-actor-involved-in-collision[help] Getting an actor involved in collisionhttps://itch.io/t/18370/help-getting-an-actor-involved-in-collisionTue, 15 Mar 2016 22:16:49 GMTTue, 15 Mar 2016 22:16:49 GMTTue, 15 Mar 2016 22:16:49 GMTWhat I am trying to accomplish is if an my object collides with something I would like to check and see what the collision is, then if it is a specific actor I want to check what animation is playing on that actor. I am unsure how to get the actor from the collision. see example below for what I have right now.

if (Sup.ArcadePhysics2D.collides(this.actor.arcadeBody2D, Sup.getActor("collision").arcadeBody2D) { 
   if (Sup.getActor("collision").spriteRenderer.getAnimation() == "animation1") { 
      //do something... 
   } 
}

After this step I am going to make a generic function so I can do whatever I want without needing to put this code everywhere. Something like:

collidesWith(target, animation) { 
   if (target.getAnimation() == animation) { 
      //do something.. 
   } 
}

My current issue is I don't know the proper way to get the actor that was involved in the collision. For example if a car collides with a wall how can I reference that wall's actor with a collision script inside of the car?

I had posted this on Reddit too, I will update either posting with the working response.

]]>
https://itch.io/t/16225/threejs-plugin-webglrenderer-and-webglrendertarget-not-workingTHREE.js plugin - WebGLRenderer and WebGLRenderTarget not workinghttps://itch.io/t/16225/threejs-plugin-webglrenderer-and-webglrendertarget-not-workingSat, 13 Feb 2016 22:03:26 GMTSat, 13 Feb 2016 22:03:26 GMTSat, 13 Feb 2016 22:03:26 GMTThis is using the three.js plugin!

I'm trying to render some island models (put into a different scene than the main Sup one) to a WebGLRenderTarget and draw it to a plane mesh via a shader.

The shader works, but the WebGL rendering doesn't. Here is my code. If anyone needs it, I could even make a demo project.

This was based on this three.js demo.

I need an answer/help really soon (as in within a day or so) because the first phase of my project is going to be due.

]]>
https://itch.io/t/13363/uncaught-referenceerror-rng-is-not-definedUncaught ReferenceError: RNG is not definedhttps://itch.io/t/13363/uncaught-referenceerror-rng-is-not-definedFri, 08 Jan 2016 19:23:57 GMTFri, 08 Jan 2016 19:23:57 GMTFri, 08 Jan 2016 19:23:57 GMTI tried to make a random number, but I get that error.

awake(){

var ran = new RNG('w');

Sup.log(ran.random(1,10))

}

Is there something wrong with my code

]]>
https://itch.io/t/14522/looping-through-tiles-in-tilemapLooping through tiles in tilemaphttps://itch.io/t/14522/looping-through-tiles-in-tilemapFri, 22 Jan 2016 17:44:08 GMTFri, 22 Jan 2016 17:44:08 GMTFri, 22 Jan 2016 17:44:08 GMTI'm trying to adapt the tilemap to be able to set up 3D tiles for my game. I'll maybe look into adding that as a plugin, but for now (this project anyways) I just want to know if it is possible to loop through all the tiles in a tileset to create the appropriete 3D models in the scene. Do they have an index? Are they sorted in an array?

EDIT: Silly me, I missed the getTileAt() function. Whoops. However, am I overcomplicating things?

]]>
https://itch.io/t/13879/changing-advanced-texture-map-of-3d-model-in-runtimeChanging "Advanced Texture" map of 3D Model in runtimehttps://itch.io/t/13879/changing-advanced-texture-map-of-3d-model-in-runtimeFri, 15 Jan 2016 13:13:39 GMTFri, 15 Jan 2016 13:13:39 GMTFri, 15 Jan 2016 13:13:39 GMTHi all,

I'm experimenting with 3D Models in Superpowers at the moment and do hope that someone can help me.

I have a sweet little model, which loads up nicely. As I have several textures for that model, I created different Maps in "Advances Textures".


While updating the Map-Field in the Model Windows is working fine, I absolutely can't find a solution on how to change the Map in runtime (I tried to find something in the documentation, but all tries (like these:

if (Sup.Input.isKeyDown("1")) this.actor.tileMapRenderer.setTileSet("Adventurer");
if (Sup.Input.isKeyDown("1")) this.actor.tileMapRenderer.setTileMap("Adventurer");
if (Sup.Input.isKeyDown("1")) this.actor.modelRenderer.setModel("Adventurer");

Did not work at all.

Anyone has an idea? I feel a bit lost at the moment :(

]]>
https://itch.io/t/13809/prefab-loadingPrefab loadinghttps://itch.io/t/13809/prefab-loadingThu, 14 Jan 2016 16:57:11 GMTThu, 14 Jan 2016 16:57:11 GMTThu, 14 Jan 2016 16:57:11 GMT I had some issues with appending scenes as prefabs, mainly with the actors' arcadeBody2D (Here's a gif). I emailed SparklinLabs about it and they replied with a solution (thanks!).

But in the solution, some code was taken out. Before It was like...

Sup.appendScene("CavemanPrefab", Sup.getActor("Cavemen"));

And this was the solution I got sent, which worked perfectly.

let caveman = Sup.appendScene("CavemanPrefab")[0];
caveman.arcadeBody2D.warpPosition(Sup.getActor("Cavemen").getLocalPosition());

However, I want to parent the appended Caveman actors to the Cavemen actor for collision reasons and stuff. But, when I do, the bug happens again, but not in the same way (here's a gif).

Here's what I tried:

let caveman = Sup.appendScene("CavemanPrefab", Sup.getActor("Cavemen"))[0];
caveman.arcadeBody2D.warpPosition(Sup.getActor("Cavemen").getLocalPosition());
let Caveman = Sup.appendScene("CavemanPrefab")[0];
Caveman.arcadeBody2D.warpPosition(Sup.getActor("Cavemen").getLocalPosition());
Caveman.setParent(Sup.getActor("Cavemen"));

What am I missing?

]]>
https://itch.io/t/13649/the-use-of-uniforms-in-shadersThe use of Uniforms (in Shaders)https://itch.io/t/13649/the-use-of-uniforms-in-shadersTue, 12 Jan 2016 16:20:30 GMTTue, 12 Jan 2016 16:20:30 GMTTue, 12 Jan 2016 16:20:30 GMTI have a shader which requires knowledge of the image width and height in order to properly apply itself. So I add a vec2 uniform to hold such information, and ...

Oh. It looks like I'm going to have to duplicate this shader in full for every individual texture I want to apply it to because there is no way to change the uniforms at runtime. The TypeScript class for shaders is a big opaque dummy you can't do anything with, and the setup to apply a shader to a sprite in a scene or by script doesn't allow for any further inputs besides the shader path to apply.

:( Disappointment.

]]>
https://itch.io/t/13360/glsl-version-GLSL version ?https://itch.io/t/13360/glsl-version-Fri, 08 Jan 2016 18:24:31 GMTFri, 08 Jan 2016 18:24:31 GMTFri, 08 Jan 2016 18:24:31 GMTWhat versions of GLSL can I use when writing my shaders ? I am asking because I see that the default vertex shader uses the varying keyword, and AFAIK this keyword is used in old versions of GLSL.

]]>