Search the Community

Showing results for tags 'typescript'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • HTML5 Game Coding
    • News
    • Game Showcase
    • Facebook Instant Games
    • Web Gaming Standards
    • Coding and Game Design
  • Frameworks
    • Phaser 3
    • Phaser 2
    • Pixi.js
    • Babylon.js
    • Panda 2
    • melonJS
  • General
    • General Talk
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website URL


Twitter


Skype


Location


Interests

Found 246 results

  1. Hi, i'm using this file in my project : /*Copyright © 2013 Marian Euent Permission is hereby granted, free of charge, to any person obtaining a copyof this software and associated documentation files (the "Software"), to dealin the Software without restriction, including without limitation the rightsto use, copy, modify, merge, publish, distribute, sublicense, and/or sellcopies of the Software, and to permit persons to whom the Software isfurnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included inall copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS ORIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THEAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHERLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS INTHE SOFTWARE.*//* @param {Object} object: Any object you want to tween. For example: PIXI.Sprite @param {String} property: the property which needs to be changed. Use "property.property.property..." if the property is little deeper. Pass "" to create a Wait-Tween @param {float} value: targetValue of tweening @param {int} frames: duration of the tween in frames. @param {boolean} autostart: starting when created? Set to false if you use it with ChainedTween use examples: new Tween(sprite, "position.x", 100, 60, true); new Tween(sprite.position, "x", 100, 60, true); */function Tween(object, property, value, frames, autostart) { this.object = object; var properties = property.split("."); this.property = properties[properties.length - 1]; for (var i = 0; i < properties.length - 1; i++) { this.object = this.object[properties]; } this.targetValue = value; this.startValue; this.active = autostart; this.currentFrame = 0; this.endFrame = frames; this.onComplete; this.onCompleteParams; this.easing = Tween.noEase; Tween.tweens.push(this);}Tween.noEase = function (t, b, c, d) { t /= d; return b + c * (t);};Tween.prototype.setOnComplete = function (callback, parameters) { this.onComplete = callback; this.onCompleteParams = parameters;};Tween.prototype.start = function () { this.active = true;};Tween.prototype.initIterations = function () { if (this.property != "") { this.startValue = this.object[this.property]; this.targetValue = this.targetValue - this.object[this.property]; }};Tween.prototype.update = function () { if (!this.active) { return false; } if (this.currentFrame == 0) { this.initIterations(); } this.currentFrame++; if (this.currentFrame <= this.endFrame) { if (this.property != "") { var oldValue = this.object[this.property]; var newValue = this.easing(this.currentFrame, this.startValue, this.targetValue, this.endFrame); this.object[this.property] = newValue; } return false; } else { this.active = false; if (this.onComplete != null) { this.onComplete(this.onCompleteParams); } return true; }};Tween.tweens = [];// Call this every Frame of your Game/Application to keep the tweens running.Tween.runTweens = function () { for (var i = 0; i < Tween.tweens.length; i++) { var tween = Tween.tweens; if (tween.update()) { var index = Tween.tweens.indexOf(tween); if (index != -1) { Tween.tweens.splice(index, 1); } i--; } }};// EASING// use example:// var tween = new Tween(sprite, "alpha", 0, 60, true);// tween.easing = Tween.outElastic;Tween.outElastic = function (t, b, c, d) { var ts = (t /= d) * t; var tc = ts * t; return b + c * (33 * tc * ts + -106 * ts * ts + 126 * tc + -67 * ts + 15 * t);};Tween.inElastic = function (t, b, c, d) { var ts = (t /= d) * t; var tc = ts * t; return b + c * (56 * tc * ts + -105 * ts * ts + 60 * tc + -10 * ts);};Tween.inOutQuintic = function (t, b, c, d) { var ts = (t /= d) * t; var tc = ts * t; return b + c * (6 * tc * ts + -15 * ts * ts + 10 * tc);};Tween.inQuintic = function (t, b, c, d) { var ts = (t /= d) * t; var tc = ts * t; return b + c * (tc * ts);};Tween.outQuintic = function (t, b, c, d) { var ts = (t /= d) * t; var tc = ts * t; return b + c * (tc * ts + -5 * ts * ts + 10 * tc + -10 * ts + 5 * t);};Tween.inCubic = function (t, b, c, d) { var tc = (t /= d) * t * t; return b + c * (tc);};Tween.inOutCubic = function (t, b, c, d) { var ts = (t /= d) * t; var tc = ts * t; return b + c * (-2 * tc + 3 * ts);};Tween.outCubic = function (t, b, c, d) { var ts = (t /= d) * t; var tc = ts * t; return b + c * (tc + -3 * ts + 3 * t);};// CHAINED TWEEN/* @param {Array} tweens: Array of Tweens. example: var tween1 = new Tween(sprite, "position.x", 100, 60, false); var tween2 = new Tween(sprite, "position.x", 0, 60, false); new ChainedTween([tween1, tween2]);*/function ChainedTween(tweens) { this.tweens = tweens; Tween.tweens.push(this);}ChainedTween.prototype.update = function () { if (this.tweens.length == 0) { return true; } var currentTween = this.tweens[0]; if (!currentTween.active) { currentTween.start(); } var finished = currentTween.update(); if (finished) { this.tweens.splice(0, 1); } return false;};// TODO: COMBINED TWEENfunction CombinedTween(tweens) {}CombinedTween.prototype.start = function () {};CombinedTween.prototype.update = function () {}; I have created the following defintion file : /** * * Typescript declaration file for tween.js file * User: Marwane * Date: 09/04/15 */ declare var TWEEN: any;declare module TWEEN_ {export class Tween {object:any;property:string;targetValue:number;startValue:string;active:boolean;currentFrame:number;endFrame:number;tweens:any[]; constructor( object:any, property:string, value:number, frames:number, autostart:boolean); public onComplete:()=>void;public setOnComplete:()=>void;public start:()=>void;public initIterations:()=>void;public update:()=>void;public runTweens:()=>void;public noEase:()=>void;public outElastic:()=>void;public inElastic:()=>void;public inOutQuintic:()=>void;public inQuintic:()=>void;public outQuintic:()=>void;public inCubic:()=>void;public inOutCubic:()=>void;public outCubic:()=>void;} export class ChainedTween{tweens:any[]; constructor(tweens:any[]); public update:()=>void; } } it compiles, however when i run the code i get "Uncaught ReferenceError: TWEEN_ is not defined" Please help me Thanks in advance
  2. Hi, My name is Pete Schmitz and I'm a programmer that's available for HTML5 game development. I'm providing services that include porting games from Flash(AS3)/Java/C#/C++ to HTML5 applications that are mobile-compliant, optimizing/improving existing projects, and collaborating on entirely new applications. I have over six years experience in browser-based games development, which includes contract work for Nickelodeon and Newgrounds. My portfolio of published applications, including my resume and contact details, can be found at http://peteschmitz.com If you're interested in my services, please feel free to contact me - Either through this thread, PM, or my email (gpdevs [at] gmail [dot] com). I'd love to hear about your project and discuss how I can provide assistance with it. I currently reside near San Francisco, California (PDT). Thanks for your time, Pete
  3. Hi there, So for my final year project I decided to recreate Worms Armageddon in JavaScript (Well actually Typescript) Would be great if some people could play it, as its still only beta and buggy, but getting there. http://www.ciaranmccann.me/wormsjs/ Any comments and feedback would be very much appreciated Thanks
  4. TypeScript is an awesome programming language but it only compiles to JS. haxe is cross-platforms and good language too but lacks some syntax/features I like in TypeScript ....(I started using haxe/NME some days ago) I want to be able to compile my typescript code to native Android/iOS/other platforms but it's presently not possible so here is a part of the solution : ts2haxe is a script I made to help me automatically convert TypeScript code to Haxe code, it will not convert APIs only syntax conversion is supported for now. next step will be to write a common rendering API, based on PIXI.js in TypeScript side and NME in haxe side so all code can be converted and compiled with minimum manual fixes. here is the source code https://github.com/Ezelia/ts2haxe feel free to share/report issues/contribute
  5. Hey, I am trying to reorder my objects but I am having a hard time (I am a very inexperienced programmer in general). So... Not sure if the following is important, but I will very briefly explain what I want to do and how I am trying to do it, maybe you can turn this into a lesson while (hopefully) answering the main question. What I want to do: Draw a map consisting of hexagonal tiles (extending sprites)Show some data about each tile when being hovered (text should be on or close to the tile)How I go about it: create an overlay object controlling the infocreate a map object which in return creates the tile objectslisten to hover events on each tile (did this with this.events.onInputOver.add(this.hoverOver, this); and if (this.input.checkPointerOver(this.game.input.mousePointer, false)) { this.hoverOver(); }, seems to do the same)call a function of the overlay object called "drawTileCoords(this)" in the "this.hoverOver". function of the tile objectsNow hovering over the tiles works just fine (I also do "this.tint = 0xBADA55;" in thisHover(), which does tint the hovered tile). Also having the overlay.drawTileCoords(tile: Tile) function write stuff about the received tile pointer (like tile.position.x) to the console is no problem. In the constructor of the overlay object I set var style = { font: "12px Arial", fill: "#000000", align: "center" };this.textQ = this.game.add.text(0, 0, "a", style);this.textR = this.game.add.text(0, 0, "b", style);which should work just fine, right? In the drawTileCoords function I do this: this.textQ.position.set(tile.center.x - 30, tile.center.y + 30);this.textR.position.set(tile.center.x + 30, tile.center.y + 30);this.textQ.setText("q:" + tile.coords.x);this.textR.setText("r:" + tile.coords.y);and the text changes (checked with console.log(this.textQ.text);) but I never see the text being rendered. Now I believe this is because I create the overlay object first and then the map object (which then creates the tile objects), leading to the tiles being rendered after/over the overlay. This is part of my main Phaser.State's create function : this.overlay = new Overlay(this.game);this.map = new Map(this.overlay, this.game, 52, 64, 20, 10);So my questions are: Am I right with this assumtion?If I am in fact right, what can I do about it? How do I get the overlay to render after the map?If I am not right, what is going on?Also, is this the normal way of having objects talk to each other or would you do it completely different? I really do not know what I am doing, only learning from examples and as I go.
  6. Hello, I tried to find in the forum, but I didn't find any fresh information. How the phaser.d.ts file is now generated? WIth a tool, or this file is manually maintained and the developer who adds a new method in a class should update the typescript file? Thank you
  7. Hi, I'm struggling to get phaser to display the fps of the game. Error is: Cannot read property 'game' of undefined. I've read around a bit: http://www.html5gamedevs.com/topic/7202-pausing-and-resuming-timer/ and looked at the manual but I've hit a bit of a wall. I've got a feeling I'm probably missing something incredibly obvious... Using latest version of typescript and running in latest version of node-webkit. Code: /// <reference path="../definitions/phaser.d.ts" />class SimpleGame { game: Phaser.Game; fpsText: Phaser.Text; fps: number; timer: Phaser.Timer; constructor() { this.game = new Phaser.Game(800, 600, Phaser.AUTO, 'content', { preload: this.preload, create: this.create, update: this.update(), render: this.render() }); } preload() { console.log("preloaded"); this.game.load.image('logo', 'assets/logo.png'); this.timer = this.game.time.create(false); this.timer.game.time.advancedTiming = true; } create() { console.log("created"); this.fpsText = this.game.add.text(16, 16, 'fps: 0', { fontSize: '32px', fill: '#567' }); } update(){ } render(){ this.fpsText.text = 'fps: : ' + this.timer.game.time.fps; }}window.onload = () => { var game = new SimpleGame();};Thanks for reading
  8. Hello guys, Allow me to introduce myself, I'm Geoffroy Warin, entreprise javascript developper by day and an html5 game development junkie at night. I really love phaser, I think it's fantastic work and as I kept experimenting with it, I realized I was always bootstrapping my projects the same way. Copy my gulp file then create the small phaser bootstrap classes in typescript. So I decided to create a yeoman generator : https://github.com/geowarin/generator-phaser-gulp-typescript It's really simple but you have nothing to do, just type 'gulp' on the command line and you will get : LivereloadAutocompletion thanks to typescript definitions filesTypescript debugging in your browser with source mapsI also use it to deploy to github pages in one command ('gulp deploy'). Hope you will enjoy it. It can really be helpful if you want to dive into typescript or you wish to have an example of a good gulp build file. I'm 100% open to pull requests and improvements. Cheers !
  9. Hello, I've coded up a very basic Game of Life in Typescript using Phaser. I looked around, but I couldn't find something like this. It's very 'proof of concept'-ey, but it might help someone somewhere, so I guess I'll just leave this here ConwaysGameOfLife.zip
  10. Hi guys, it's me again \o . So, I have another problem, i worked on it for 3-4 hours yesterday, and I give up... So, my problem is simply : I can't add state, or simply call it. So, my app.ts (Yhea, I'm following the tutorial) : /// <reference path="phaser.d.ts" />/// <reference path="Boot.ts" />/// <reference path="Preloader.ts" />/// <reference path="MainMenu.ts" />module Castlevania { export class MainGame { game: Phaser.Game; constructor() { this.game = new Phaser.Game(800, 600, Phaser.AUTO, 'content', { preload: this.preload, create: this.create }); } preload() { } create() { this.game.state.add("boot", Castlevania.Boot, true); console.log(this.game.state); } }}window.onload = () => { var game = new Castlevania.MainGame();};My Boot.ts : /// <reference path="phaser.d.ts" />module Castlevania { export class Boot extends Phaser.State { constructor() { super(); } preload() { console.log("IT WORKS !!!"); //this.game.load.image('preloadBar', 'assets/loader.png'); } create() { console.log("IT WORKS!!!"); } update() { } }}(Yhea, I tried to put a constructor, but it doesn't work \o ) So, in my log of state, I have : Phaser.StateManager - No state found with the key: boot phaser.js:9225Phaser.StateManager_created: true_pendingState: ObjectcallbackContext: Objectcurrent: "default"game: Phaser.GameonCreateCallback: function () {onInitCallback: function () {onLoadRenderCallback: nullonLoadUpdateCallback: nullonPausedCallback: nullonPreRenderCallback: nullonPreloadCallback: function () {onRenderCallback: nullonShutDownCallback: function () {onUpdateCallback: nullstates: Objectboot: undefineddefault: Object__proto__: Object__proto__: Object So, now I'm lost. I tried everything, but nothing works... Can u help me ? Thanks . EDIT : When I try this : console.log("TEST");var b = new Castlevania.Boot();console.log("TEST2");console.log(;console.log("TEST3");this.game.state.add("boot", b, true);console.log(this.game.state);I have : TEST app.ts:21Uncaught TypeError: undefined is not a function
  11. create() { this.game.physics.startSystem(Phaser.Physics.P2JS); this.game.physics.p2.gravity.y = 700; this.platformArray = []; this.startGame(); this.game.input.keyboard.onUpCallback = Level1.prototype.upCallback; } upCallback(e){ if(e.keyCode == Phaser.Keyboard.X){ this.player.endSlide(); //I can't get access here } } How to get access for player's method?
  12. With javascript i do it such way: body.onBeginContact.add(method,this); function method(body, shapeA, shapeB, equation){ ..... } How can i do it with TypeScript?
  13. Sorry if this has been asked many times. I looked through a few threads but couldn't get it working. I'm just trying to make my game resize as user resizes window or if the orientation is switched (on phone). I tried hooking into $(window).resize but it kept complaning that 'game' is undefined. I'm using TypeScript for my game. Any help would be greatly appreciated!
  14. Hi, The TypeScript signature of the functions TilemapLayer.getTileX and TilemapLayer.getTileY is: getTileX(x: number): Phaser.Tile;getTileY(y: number): Phaser.Tile;But from the documentation and the code in phaser.js it seems like it should return a number. Am I right in guessing this is a mistake? Thanks, Yuval
  15. Hi, running into a problem while getting started with the library. I'm working on a TypeScript project, and the library doesn't ship with the d.ts files. It does provide a gulp task to build the declaration file, but it seems to be broken: https://github.com/BabylonJS/Babylon.js/issues/221 So my question is: does anyone have a working TypeScript declaration file they can post? Or failing that, help with creating one from the source? I have the latest tsc (1.0.1.0) and gulp installed. Thanks!
  16. Can you please take a look at this code and explain to me what is wrong? From what I know, it should work.. Or at least calling a function from create() could work :-) Thank you! /// <reference path="phaser/phaser.d.ts" />class SimpleGame { logo: Phaser.Sprite; game: Phaser.Game; constructor() { this.game = new Phaser.Game(800, 600, Phaser.AUTO, 'content', { preload: this.preload, create: this.create, update: this.update }); console.log("BEFORE"); this.titleClicked(); console.log("after"); //this.animateLogo(); // >>> Uncaught TypeError: Cannot read property 'scale' of undefined } preload() { this.game.load.image('logo', 'assets/images/phaser2.png'); } titleClicked(){ console.log("CLICKED"); this.titleClicked2(); } titleClicked2(){ console.log("CLICKED 2"); } create() { this.logo = this.game.add.sprite(this.game.world.centerX, this.game.world.centerY, 'logo'); this.logo.anchor.setTo(0.5,0.5); console.log("CREATED"); // this.titleClicked(); // >>> Uncaught TypeError: undefined is not a function // this.logo.events.onInputDown.add(this.titleClicked, this); // >>> Uncaught TypeError: Cannot read property 'add' of null //this.animateLogo(); // >>> Uncaught TypeError: undefined is not a function } update() { } animateLogo(){ this.logo.scale.setTo(0.5,0.5); var logoTween = this.game.add.tween(this.logo.scale); logoTween.to({ x: 1, y: 1 }, 2000, Phaser.Easing.Bounce.Out, true); }}window.onload = () => { var game = new SimpleGame();};
  17. Hey guys, I am playing around with terrain generation and everything is coming along just fine (ofc feel free to copy/paste if you see anything you like and you want to play around with it), but it seems generating having generated (bitmapdata) sprites in my scene is a bit too much for my CPU. It gets really hot and the fans go crazy. At 1000 sprites my PC (windows) shut down on me. I guess I am doing something I am not supposed to do or am doing the wrong way, so here is my code, in typescript (if you prefer the JS, I am happy to add the generated JS, just let me know!) : module Terrain01 { declare var Voronoi: any; declare var noise; export class World extends Phaser.State { private siteAmount: number = 500; private relaxLoops: number = 5; private seed: number = 123; private sites: Phaser.Point[] = []; private voronoi; private bbox; private diagram; private bmd; create() { noise.seed(this.seed); this.bmd = this.game.add.bitmapData(this.game.width, this.game.height); this.game.stage.backgroundColor = '#454645'; this.game.rnd.sow([this.seed]); this.createSites(); this.bbox = { xl: 0, xr: this.game.width, yt: 0, yb: this.game.height }; this.createVoronoi(); for (var i = 0; i < this.relaxLoops; i++) { this.relaxSites(); this.voronoi.recycle(this.diagram); this.diagram = this.voronoi.compute(this.sites, this.bbox); } this.drawPolygons(); //this.drawEdges(); //this.drawRoads(); //this.drawSites(); } createSites() { for (var i = 0; i < this.siteAmount; i++) { var x = this.game.rnd.integerInRange(0, this.game.width); var y = this.game.rnd.integerInRange(0, this.game.height); this.sites[i] = new Phaser.Point(x, y); } } createVoronoi() { this.voronoi = new Voronoi(); this.diagram = this.voronoi.compute(this.sites, this.bbox); } getCellVertices(cell: any) : Phaser.Point[] { var halfedges = cell.halfedges; var vertices: Phaser.Point[] = []; for (var i = 0; i < halfedges.length; i++) { vertices.push(halfedges[i].getStartpoint()); } return vertices; } relaxSites() { this.sites = []; for (var i = 0; i < this.diagram.cells.length; i++) { var vertices = this.getCellVertices(this.diagram.cells[i]); var centroid = Phaser.Point.centroid(vertices); this.sites.push(centroid); } } drawPolygons() { var graphics = this.game.add.graphics(0, 0); var cells = this.diagram.cells; for (var i = 0; i < cells.length; i++) { var site = cells[i].site; var value = Math.abs(noise.simplex2(site.x/400, site.y/400)); var halfedges = cells[i].halfedges; this.bmd.ctx.beginPath(); this.bmd.ctx.moveTo(halfedges[0].getStartpoint().x, halfedges[0].getStartpoint().y); for (var j = 0; j < halfedges.length; j++) { var halfedge = halfedges[j]; this.bmd.ctx.lineTo(halfedge.getEndpoint().x, halfedge.getEndpoint().y); } this.bmd.ctx.closePath(); var r = Math.floor(50 * value + 50); var g = Math.floor(100 * value + 110); var b = Math.floor(50 * value + 0); var rgba = "rgba(" + r + ", " + g + ", " + b + ", " + value + ")"; this.bmd.ctx.fillStyle = rgba; this.bmd.ctx.fill(); this.game.add.sprite(0, 0, this.bmd); } } update() { } }}The Phaser.Game renderer is "Phaser.AUTO" if that's important somehow. I use noisejs by Joseph Gentle (https://github.com/josephg/noisejs) & javascript-voronoi by Raymond Hill (https://github.com/gorhill/Javascript-Voronoi). So, my questions are: why is this so tough to handle for my PC and what can I do to change it?
  18. Hello! Excuse me if this is not the first topic addressing this matter (and I bet it isn't). I will soon have some more free time and I wanted to learn something new, so I think - why not HTML5 games? I come from Java (which is my job) and Ruby (kind of a hobby) and I'm not completely new to gamedev (e.g. see my unfinished Ruby raycaster). I did a bit of research and Phaser looks very promising. I know JS can be kind of object-oriented, but it treats functions as classes or something like this and it is quite confusing. Typescript should be more "normal" for me then? As mentioned, I love "the Ruby way" of coding, and I heard there's this thing called Coffeescript that is inspired by Ruby, are Typescript and Coffeescript similar? Can I use Coffeescript with Phaser? Or even some kind of Ruby to JS parser (Opal, RubyJS...)? I never did a lot of JS-related stuff and I don't feel like blindly trying every option, so I'd love to hear your opinion.
  19. Hi. English is not my native language, so sory for my mistakes. I make game in VisualStudio(TypeScript), and create levels in Tiled Map Editor. So my questions is: how I can read information in my TypeSript game from level.json file? Thanks.
  20. Hi. I have a big problem with my Phaser project. I use Phaser + Typescript. I use this tutorial: http://blog.lessmilk.com/how-to-make-flappy-bird-in-html5-1/ If I use the following code, I get this error: "Uncaught TypeError: Cannot set property 'gravity' of null" class FlappyBirdsGame { game: Phaser.Game; bird; constructor(renderDiv: String) { this.game = new Phaser.Game(400, 490, Phaser.AUTO, renderDiv, { preload: this.preload, create: this.create, update: this.update }); this.game.state.add('main', this); } preload() { this.game.stage.backgroundColor = '#71c5cf'; this.game.load.image('bird', 'assets/bird.png'); } create() { this.bird = this.game.add.sprite(100, 245, 'bird'); this.bird.body.gravity = 1000; var spaceKey = this.game.input.keyboard.addKey(Phaser.Keyboard.SPACEBAR); spaceKey.onDown.add(this.jump, this); } update() { if (this.bird.inWorld == false) { this.restartGame(); } } jump() { this.bird.body.velocity.y = -350; } restartGame() { this.game.state.start('main'); }}window.onload = () => { var game = new FlappyBirdsGame('content');}What is the problem? If I run this code, the "bird" is displayed. You can see the source also on git: https://github.com/ppfeiler/FlappyBirdClon Thank you
  21. I've been trying without success to get a simple prototype (just a background) to scale on my mobile with Phaser using Typescript after reading this post http://www.html5gamedevs.com/topic/5949-solution-scaling-for-multiple-devicesresolution-and-screens/ I've asked both on the post and on IRC but I'm starting to feel that approaching this issue in TS is different from doing so in vanilla JS. So my question is: How can I: Detect 5 different screen sizes (small, normal, large, xlarge, xxlargge) and load assets accordingly.Scale my game in a way that works for PC (without it going 100% and looking blurry), Tablets and Mobile phones.Scale both horizontally (landscape) and vertically (portrait).Hide the address bar in as many devices as possible....in Typescript? I'm sorry if these are too many questions to ask at once but I feel that it would also be helpful to other newbies starting out with Typescript. While Typescript is very useful in the long term (and helps me to keep my code very tidy), learning the basics and trying to get tutorials or code snippets is a lot harder than with JS. The two tutorials posted on Photonstorm allowed me to create a couple of desktop-only prototypes, but they do not cover how to do it on Mobile. The structure I'm using for my TS projects contains the following core files: app.tsGame.tsBoot.tsPreloader.tsMenu.tsBaseLevel.tsThank you for reading!
  22. Hey, since sprite.scale.setTo takes factors instead of a target pixel amount, I was looking for another way to change the size. Since I didn't find anything about that in the phaser doc and phaser.sprite derives from the pixi.js sprite, I checked the pixi doc and found sprite.width() and .height(). Sadly for sprite.width(x); typescript tells me I "cannot invoke an expression whose type lacks a call signature." Is this a type definition file problem? How could I change the definitions file to make it work?
  23. Hey guys, Over the past few weeks I have been learning more about Phaser and TypeScript and I have started a blog to share what I have learned and post code that I think will help people better use Phaser with TypeScript. I was waiting to post anything about them here until I had a post with actual code in it and a GitHub repo. (Though I saw today a link to one of the posts was on the front page, thanks Rich!) I use OSX and WebStorm, but you should be able to use the code and examples in pretty much any TypeScript environment. But keep in mind these tutorials use more advanced TypeScript features (AMD modularization etc). Posts: Set Phasers to TypeScript! - Setting up a TypeScript dev environment the hard way (Brackets, Prepros, Terminal), or the easy way (WebStorm) Big Boy TypeScript: AMD Modularization and Dependency Management – Part 1 - A preface to using AMD modularization, with some "guided reading" to explain the concepts. Big Boy TypeScript: AMD Modularization and Dependency Management – Part 2 - Has example code from a Git repo. Shows how to organize your project to use AMD Modularization. Introduces you to the three ways you have to import and reference files as well as how to export classes and modules. More AMD Modularization and Finite State Machines in Phaser - Cleared up some issues with AMD modules from the last blog. Used the TypeState library to show how to easily use Finite State Machines in Phaser! Has example code and a demo! More to come! If you haven't ever used TypeScript, I would recommend doing some reading at the TypeScript website before reading these blogs. Afterwards, do some Phaser stuff with TypeScript.
  24. Hi, I just started programming with phaserjs. I really enjoy it. But I have some issue with the typescript version. When I compile it with grunt I have this error : "error TS2094: The property 'angle' does not exist on value of type 'Phaser.Point'.". So at the begining I thought I've made a typo but after looking at the file Phaser.d.ts I notice that the methods "angle" and "anglesq" are not present in the file whereas they are present in the js file. I'm only the one or it's a real issue ?
  25. I saw on the Pixi github that one of the items on the roadmap is a Typescript definition file. This really excites me, as Typescript 1.0 just got released, and I am in the process converting. What's the status on the Typescript definition? (no rush or anything, just wondering how much of a priority it is?) Also, I'm aware there's a Pixi definition on DefinitelyTyped, but that version is to my knowledge several versions old. Thanks for the response.