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 Platform
    • 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 244 results

  1. So I'm a phaser/html5 newbie, but coming from java I've chosen to take the typescript route, and am now trying to get plugins to work, but have been having major issues, and haven't been able to find any "official" information about typescript plugin support, only a few threads here with hacky solutions that haven't worked for me. What confuses me is that there are often typescript typings along with the plugins, which would indicate that they're supposed to work with typescript. Any insight into this would be greatly appreciated, and if I may suggest, should perhaps be more clearly presented in the documentation.
  2. I create a babylonjs starter for typescript here. https://github.com/seand88/babylonjs-typescript-starter built using gulp. The only issue I am having is when trying to get the definitions to work. I thought with typescript 2.0 you could simply do npm install --save @typings/babylonjs but it seems that points to an old version I am new to getting typescript working, so if anyone knows how to get that to work would really appreciate it. Currently with the starter I made You will get errors like src\client\game.ts(32,22): error TS2304: Cannot find name 'BABYLON'. Thanks for any help, and hopefully others can use this to get started in the future as well.
  3. I'm new to development and very new to Phaser. I'm trying to create my first game and I'm having issues getting my collision to work as well as creating timed events. Collision: I've already created my main player (doug) & some obstacles (snowman). this.game.physics.arcade.collide(this.doug, this.snowman, (doug: any, snowmen: any) => { if (doug instanceof (Phaser.Sprite)) { (<Phaser.Sprite>doug).kill; } } I'm not getting any errors, but nothing is happening when Doug runs into the snowmen. Perhaps is has something to deal with how I'm creating the snowmen: code below: let snowmen = this.game.add.group(); snowmen.enableBody = true; this.game.physics.enable(snowmen, Phaser.Physics.ARCADE); for (var i = 0; i < 4; i++){ this.snowman = snowmen.create(this.game.width * Math.random(), -50,"snowman"); this.game.physics.enable(this.snowman, Phaser.Physics.ARCADE); this.snowman.body.collideWorldBounds = false; this.snowman.body.gravity.y = 40; } Timed Events: To give the illusion of moving through space, I'd like to make a function that creates sprites of trees falling at either end of my screen. function below: treefall() { let trees = this.game.add.group(); trees.enableBody = true; this.game.physics.enable(trees, Phaser.Physics.ARCADE); for (var i = 0; i < 4; i++) { this.tree = trees.create(-1250, -400, "tree4"); this.tree = trees.create(900, -400, "tree4"); this.tree.body.collideWorldBounds = false; this.tree.body.gravity.y = 40; } I'm getting an error on the line of code that calls this function: this.game.time.events.add(Phaser.Timer.SECOND * 1, this.treefall, this.game); This is sitting in my create function. Any advice would be hugely appreciated!
  4. Hey there, My name is Martin and I am the founder of Fractal Games and Zariba Game Academy. Fractal Games is a small, independent studio for creating original brain/puzzle HTML5 games. In Zariba Game Academy have different courses in game development, including one in Phaser. Having gained lots of experience in the last couple of years, we have decided to offer our services to help creating your games. We use the following technologies, among others: UI: HTML, CSS, JavaScript, jQuery and Angular (if necessary) Backend: Python or nodeJS Game Dev: Phaser and TypeScript Builds: Cordova, Crosswalk, Android Studio, Xcode, Gulp etc. What we can offer: Very reasonable (indie/freelance) prices and quick development. High quality code, structure and architecture to make your game/s as maintainable and extendable as possible. Highly responsive and scalable games - dynamically resizeable both in portrait and landscape. We can build your game/s for Web, Android, iOS, Facebook and Amazon, among others. We can implement native functions for Android and iOS like Score Sharing, Facebook and G+ login,personalized accounts with avatars... etc. LINKS: Website (beta) Daily Challenge (Sudoku is in beta) Google Play profile (more games soon) iOS Build (currently publishing more for iOS) Phaser Course from Zariba Academy Worms Clone for Zariba Academy (demo) Zeef Page (Zariba Academy) If you are interested, feel free to contact me directly: email: antonov.martin {((at))} gmail.com skype: foggy-in_your_eyes facebook
  5. Hi guys! What do you think to support TypeScript 2 with npm? Check that please https://blogs.msdn.microsoft.com/typescript/2016/06/15/the-future-of-declaration-files/ Regards,
  6. First and foremost, I want to thank the devs for making Phaser Editor, it's amazing! I'll definitely be purchasing it on my next paycheck (if my company doesn't expense it). For a bit of background I'm new to web-based game development (and web programming as a whole), and Phaser Editor is my entry point! That being said I come from a background as a Unity developer, and so I apologize if many (if not all) of my questions relate more to Phaser and js as a whole and not Phaser Editor in particular, but I'm hoping for the way to best do things using Phaser Editor. These questions are asked having done the "Mario-Style Platformer" tutorial found at: https://gamedevacademy.org/make-a-mario-style-platformer-with-the-phaser-editor/ There are a few things I'm having a bit of trouble wrapping my head around:What exactly is a prototype? Does every object (sprite) have one? Where/how can you access this? Is it the name of the original image file? The first instance you create? The name of a function you first need to write and then assign? How would that be done?When you drag an object from assets to scene, or duplicate an object, does it create a new prototype, or a new instance?Can you assign instance variables to prototypes/objects? Can this be done in the scene editor? (ie every "coin" has the variable "collected" set to "false" at start)What is the best way to do this?In the templates and the "Mario-Style Platformer" tutorial, all logic is done in Level.js. Can you instead place the logic of each prototype/object into its own script? (ie Player.js, Coin.js)As Level.js already loads the assets.json, does every script need to do the same, or can they just access it from Level.js? How is cross-script referencing done?In the same tutorial, all the fruits/coins are collected into a group. Is this a container/parent object? Are the elements then children? What is the best way/when is the best time to assign a variable to all elements? (I tried doing so in Create using "this.pickups.setAll("collected", false);", but when I checked the value in an element later it returned null) In many Phaser examples online, Functions are done with out any form of container (ie Function preload()), and everything is executed by game (ie game.add._____) but in both the tutorial and the templates, functions are done through Level.protoype (ie Level.prototype.preload = function()), and everything is executed by this. (which I assume also points to Level.prototype?). Is there a difference? Is there a reason to doing things one way or the other? What is the best way to check/set a value in each element of the group?(ie Instead of kill the fruit object upon overlap with player, I set them to play an animation. How would I then set them to destroy upon completion?)Is there a way to find a specific element in a group (similar to an array index)?Can you set parent child relations in the scene editor? If not how is this set?Is there a way to use Vectors/containers to compare and assign values? (ie player.position = Vector2(x, y))Is there a way to emulate/simulate a 3 button mouse/middle click? (ie ctrl + alt + left click)I understand that at this time, Phaser Editor does not support Typescript. However as I am more familiar with C based OOP, many have suggested it. Would using Typescript externally alongside Phaser editor break workflow/the project? (From what I understand Phaser Editor does not support editing files externally?)Sorry for the trouble, and thank you for your time!
  7. I'm using Phaser and TypeScript to create a Snake game with multiple snakes and my question is about the general structure of the program. My question is: What is the best way to structure the data for such a game using Phaser.js? So I mean which variable types to use for the snakes, walls, apples etc. when the key features of the game would be: Everything is placed on a grid There are multiple snakes that can grow and shrink during a game Snakes move on a timer from tile to tile (so no smooth animation in-between tiles) There are walls, the layout differs per level but doesn't change during a game Food item appear randomly and can be eaten by the snakes The snakes are build up out of several sprites, and they will display the shape of the snake including the bends and turns with shadow effect etc. These snake-parts need to be updated as the snake moves/shrinks/grows. For each move the game will need to check if the snakeheads bumps into something, either a wall or a food item or another snake (or its own tail). I was first thinking of using just one big two-dimensional array, fill it with integers to represent all in-game items. And then another two-dimensional arry filled with sprites, make all those sprites invisible, and then for each move set the sprites (frame number/visibility) in the corresponding array positions. Array[x][y] (entire play area) with integers representing all items, 1=snakehead 2=snake-part-up .. 8=apple, 9=wall etc. Array[x][y] (entire play area) | +- Phaser.Sprite But a better approach would be to use Phaser.Group to group each snake, and then a separate Phaser.Group to hold all the food items and maybe also the walls. And for the hit detection/eat food etc. there need to iterate all groups children against all other groups children. Another thing is that each snake also needs to hold some extra information (head position, direction) and I can't easily extend default classes (using Type Script) array[snakes] | +- Phaser.Groups (a group for each snake) | +- Phaser.Sprites (snake parts) Phaser.Group (FOOD + WALLS) | +- Phaser.Sprite (sprite for each apple or mushroom) For the hit detection/eat food etc. it makes more sense to just put it in a two-dimensional array because everything is on a grid, and then you can simply lookup the grid positions to see if something is in it. So, I'll be glad to hear any ideas on this.. Btw I've already seen this Phaser Snake tutorial but that example does not address the issues with multiple snakes and the snake parts sprites.
  8. In the newest version of the phaser.d.ts the function getShortestAngle from the module Math cannot be found. It may not be defined in the file. I used this command to install it: typings install github:photonstorm/phaser/typescript/typings.json -GD
  9. Hi, I have implemented a simple Observer Pattern library in TypeScript/JavaScript which does not require inheritance. I have called it Paon (French name for a bird with many "eyes" on its feathers). It is available in my GitHub and in npm. Any feedback would be greatly appreciated. Paon An Observer Pattern Component in TypeScript/JavaScript. No dependencies. No inheritance is required. Observable is just a component inside an object. Observers are just functions. Installation npm install paon To compile the TypeScript source to JavaScript, you would need to install the TypeScript compiler: npm install -g typescript To generate the minified JavaScript version when building, you would need to install uglifyjs: npm install -g uglifyjs Build Resulting files are created in the dist/ folder. Complete build (compilation and minification): npm run build Simple compilation (no minification): npm run compile Usage All constants, interfaces, classes and functions are accessible inside the Paon namespace. Simple example Here is a simple example where we add an observable component inside a class Subject: /// <reference path="paon.d.ts" /> class Subject { private name: string; observable: Paon.Observable; // Observer Pattern component constructor(name: string) { this.name = name; this.observable = new Paon.Observable(); // Instanciation/Initialization } changeName(name: string): string { this.name = name; this.observable.notifyObservers("nameChanged"); // A message is sent to observers return this.name; } } function onNameChanged() { alert("Name has changed"); } let subject = new Subject("Penelope"); subject.observable.addObserver("nameChanged", onNameChanged); // Function onNameChanged() subscribes to subject's messages "nameChanged" subject.changeName("Melissa"); // An alert popup appears: "Name has changed" Above, in the class Subject, the method changeName() will send a "nameChanged" message to the instance's observers. After the instanciation of Subject, the function onNameChanged() subscribes to subject's messages "nameChanged". Therefore, when changeName() is called, an alert popup appears. As we can see, with such a pattern, no inheritance with extends or implements is required. Just simple composition. Example with extra data We can send extra data to observers as we can see below: /// <reference path="paon.d.ts" /> class Subject { private name: string; observable: Paon.Observable; // Observer Pattern component constructor(name: string) { this.name = name; this.observable = new Paon.Observable(); // Instanciation/Initialization } changeName(name: string): string { this.name = name; this.observable.notifyObservers("nameChanged", { data: name }); // A message with extra data is sent to observers return this.name; } } function onNameChanged(msg: { data: string }) { alert("Name has changed into " + msg.data); } let subject = new Subject("Penelope"); subject.observable.addObserver("nameChanged", onNameChanged); // Function onNameChanged() subscribes to subject's messages "nameChanged" subject.changeName("Melissa"); // An alert popup appears: "Name has changed into Melissa" The parameter msg in function onNameChanged() contains the extra data we have sent via method changeName(). Here, this is an object with a property data, but this could be anything. Module Importation This library can also be imported as a module with the import statement: import Paon from "./paon"; // Declaration file .d.ts location class Subject { private name: string; observable: Paon.Observable; // Observer Pattern component constructor(name: string) { this.name = name; this.observable = new Paon.Observable(); // Instanciation/Initialization } changeName(name: string): string { this.name = name; this.observable.notifyObservers("nameChanged", { data: name }); // A message with extra data is sent to observers return this.name; } } function onNameChanged(msg: { data: string }) { alert("Name has changed into " + msg.data); } let subject = new Subject("Penelope"); subject.observable.addObserver("nameChanged", onNameChanged); // Function onNameChanged() subscribes to subject's messages "nameChanged" subject.changeName("Melissa"); // An alert popup appears: "Name has changed into Melissa" Only the import statement differs from previous examples. Otherwise, the code is the same. API Documentation Add an observer to a type of message (similar to the DOM function addEventListener()): Paon.Observable.addObserver(type: string, observer: Observer): Observer; Remove an observer from a type of message (similar to the DOM function removeEventListener()): Paon.Observable.removeObserver(type: string, observer: Observer): void; Remove all observers from a type of message: Paon.Observable.removeObserversType(type: string): void; Send a message to observers (similar to the DOM function dispatchEvent()): Paon.Observable.notifyObservers(type: string, msg?: any): void; Contributors yahiko Licence MIT
  10. Link : http://yahiko.developpez.com/apps/ClashDaemons/ Controls: Arrow keys to move CTRL for melee attack SHIFT for ranged attack This is a hack 'n slash based on a prototype for an AI implementation of behavior trees, which is the main reason of this project. Sprites of monsters come from OpenGameArt.org. The title screen and the HUD were made by myself. Features implemented so far: 2D circle based collisions AI (cf. below) Pathfinding (not enabled for now) Respawn of monsters AI behaviors implemented so far: : Melee attack : Ranged attack : Hit and run : Just wandering Technologies: Written in TypeScript Powered by Phaser Framework If anyone serious enough is interested to improve this game (game design, game play, graphics, optimizations), feel free to contact me.
  11. We are looking for a babylon js freelance developer who can join our team by hours or projects as he/she wish. The goal is to code small-medium web app tools for an ecommerce site (less than 2000 lines of code) Typescript + clean structured code required, just working code is not the goal. Please PM with your $/hour and we will make a test. Thanks.
  12. Hello. I am looking to make a isometric tiled game. I am new to developing games but not that new to programming though. I have previous experience in javascript but I am learning typescript. Along with that I was looking to create a isometric tiled game. If I could program it on typescript it would be great. I have heard about the isometric plugin for phaser and I tried working with it with typescript. As I lack experience in typescript I would appreciate tutorials which aim is developing isometric tiled games in typescript. However, with this plugin and phaser I found none... only javascript ones. Can someone help me with this? I mean, do you think I should look for another game engine more focused on what I am looking for and that has more support in typescript, like tutorials, or should I stick with phaser somehow...? Honest Answers, thank you.
  13. Hello there! I am new to this community. As I did find it a bit difficult to find good resources to code with Phaser in TypeScript I decided to "track" my experiences and write tutorials as I proceed. For those who are interested: You find the tutorials in my git wiki here. I hope this will help. Feedback is always welcome. Eric
  14. Hi everyone, I have a client in Boston who is looking to hire someone who is familiar with either Pixi.JS or Typescript. If you have both, that is what they're ideally looking for. Feel free to email me at alanb@osiengineering.com if you are interested. Senior JavaScript, Typescript UI Developer in Boston, MA MUST HAVE Excellent JavaScript and Typescript programming Skills Experience developing software libraries or services (API design) DESIRED Node.Js/IOJs Electron Atom JavascriptM Mocha Location: Boston, MA
  15. I'm looking to continue my 12 year off and on hobby of game development. I'm a professional web developer now, but I have yet to make a web game. I'd like to make things a bit more modular and isolated than my previous work. I think MVC will help. I'd like to have the Model (the game simulation with all game logic, physics, etc.) in it's own web worker. The View would get a feed of basic state information out of it for rendering, camera, audio, etc. The Controller would react to the user and send information back to the Model. The View would have no information to send to the Model. I'm planning strategy games more than twitchy action games, so I think having the Model in a separate web worker, will actually be better for performance. A bit of input lag is more acceptable than a low frame-rate. If the Model -> View communication includes velocities, the frame-rate of the view can even be decoupled from the frame-rate of the Model. Plus if I move to start working on multi-player networking, the Model -> View communication can just be more or less duplicated for Server -> Client My favourite language has always been Python, and I used to loath JavaScript, but the newer ECMAScripts are correcting my biggest gripes, and ultimately I'd really like to work more with Typescript. Finally, I think I'm going for 2D because I'm not working with any 3D animators and my game play ideas are not really enhanced with by a third dimension. So I have a few concerns It seems there's a lot of poor opinions about MVC in games around here, but it seems perfect for strategy games to me. Is my approach really ill founded? I might find myself working against a broader framework like Phaser or Kiwi. Should I just stick Pixi in the View and a physics engine in my Model, or would a broader framework solve more problems than they create for me? It seems like Phaser is the popular choice, but I wonder if perhaps my use of Typescript and MVC might make Kiwi or something else the better choice?
  16. I am having issues making webstorm to work with phaser.io. I have made an empty project, created an html5 (index.html) file. I added the phaser.js and app.ts (basically app.js) to the index.html. I also added the ts files for phaser to work in typescript (phaser.d.ts, pixi.d.ts, and so on). When I try to edit app.ts, it says it cannot find phaser.js but it finds phaser.d.ts fine. When i load it anyways, it cannot find package.json. I know my typescript is working properly because it generates an js file where the ts file is located. How do i make phaser to work with webstorm? I have looked on the part for webstorm section and it only has a little blerp about webstorm is a good choice for phaser. I want to get into phaser.io game development but I cannot because I have no idea how to make it work. I looked online for videos and their was one but he didn't really show how to add phaser to webstorm properly. Any help on this would be helpful. -Shmelly
  17. I'm compiling my TypeScript project into a single JS file, at the moment by specifying an outFile in the compiler options. In my project each class is defined in a different file. The problem is that classes that depend on each other are not concatenated in the output JS in the right order. For example, if I have class A that extends class B, it'd mean class B would have to be compiled before class A. (1) class A extends B { } //error - can't find B class B { } (2) class B { } class A extends B { } //works as expected The problem is the file order in TypeScript compile is not defined according to class dependencies, resulting in many instances of (1). It can be solved by manually defining the compile order with many lines of: /// <reference path="myFile.ts"/> however it is not ideal and can quickly become a headache in large projects. The other option from what I read is to use external modules and be able to require/import relevant classes/files. It sounds good, but it seems to only take care of ASYNC loading during runtime of the required files after each ts file has been compiled into its own js file. What I need is defining the right compile order according to class dependencies during compile time from ts to js. I googled "typescript compile order" and read thoroughly the first 10 results - meaning following references to turoials, documentations, videos, etc... It seems people have been experiencing the same problem but their questions have never been answered to satisfaction. From what I understand it should be possible to do using the CommonJS external module, but all I can understand from the answers is a general sense of what should be happening rather than a simple and straightforward answer of how to actually do it. If you know the answer, let's solve this issue once and for all
  18. I'm working on a game using Phaser and TypeScript, and I want to call the same function from several different states. It is a fade-out function to fade the entire screen to black, which I want to use in both my MainMenu, LevelSelect and Game states (and btw I also want a global function that starts/stops the music). I know globals are considered a Bad Thingtm, but my question is; how can I create a function that can be re-used by all states? I've tried adding the global variables and functions in my boot state, like so module MyGameProj.Client { var SOUND_IS_ON = true; var MUSIC_IS_ON = true; function switchMusic(game, onoff) { MUSIC_IS_ON = onoff; // .. etc. } export class Boot extends Phaser.State { preload() { switchMusic(this.game, true); // no errors //.. etc. But then when I try to access the switchMusic from my MainMenu state, it gives an error 'Cannot find name switchMusic'. However, they can be used and called from within the Boot state. module MyGameProj.Client { export class MainMenu extends Phaser.State { create() { switchMusic(this.game, true); // <- error; Cannot find name switchMusic //.. etc. (btw there is no option for TypeScript in the code snippets)
  19. I'm following the "First Phaser Game" tutorial, which is made for JavaScript, and trying to convert it to TypeScript as I go, to see the parallels. This is what I've got: http://pastebin.com/i4HCinRZ Notice in the constructor that I have: this.game = new Phaser.Game(800, 600, Phaser.AUTO, "content", { preload: this.preload, create: this.create, update: this.update }); ... Where "this.preload", "this.create", and "this.update" all refer to methods in my Game class (not Phaser.Game -- it's my own Game class). That works just fine. However, down in the update method, I have: game.physics.arcade.overlap(player, stars, this.collectStar, null, this); ... Which, one would think, would call the Game class's private collectStar method (the accessibility of the method doesn't matter, as I have the same issue when it's public or has default accessibility, btw), but instead this.collectStar is considered undefined when that method is called, and "this" apparently has an entirely different context than it does in the constructor. I need to know how I can reference my collectStar method from within update(), passing it as a parameter to the overlap() function. Any insight, anyone? If it helps, here's the compiled resulting .js: http://pastebin.com/0VjuZ74R
  20. I'm using Visual Studio Code to edit TypeScript. 1) BABYLON is marked as an error: [ts] cannot find name 'BABYLON' Is it possible to import it somehow so that it'll be recognized? Preferably without having to compile the whole BABYLON framework from typescript to javascript on every compile just for that, unless doing so is trivial and doesn't take much time. 2) Is it possible to extend the framework's classes? e.g. how would I go about extending BABYLON's box (created by BABYLON.Mesh.CreateBox) using Typescript classes? Would something like that be in the right direction? class Box extends BABYLON.MeshBuilder.CreateBox Looks like extending a factory function rather than the box entity returned by it. 3) I'd like each of my classes to be written in a separate .ts file, is that possible? How would I then import / reference them in other .ts files? 4) I'd like to group my classes in packages, hopefully by simply creating folders for packages. Is that Possible? Are modules an alternative to packages in TypeScript? 5) In tsconfig.json, is there a way to specify something like "inDir" (like you can specify "outDir") instead of listing every single .ts file in "files"?
  21. Crowdpark is looking for a “HTML5 Game Developer (Game Client Developer)” in Berlin. http://www.crowdpark.com/html5-game-developer-game-client-developer/ Crowdpark is a German game developing studio. We develop video slots for the free-to-play & the online gambling market on multiple platforms including the web, mobile, and Facebook. All game & platform development is done in-house. Crowdpark started as a pioneer in social betting. Founded in 2009, we were backed by premier venture capital firms Earlybird and Target Partners. In 2012 we became part of a leading family-owned European casino group. We are now a wholly owned subsidiary of Bally Wulff, one of Germany’s leading manufacturers of electronic gaming machines. Crowdpark is based in Berlin, Germany, Europe’s gaming hub. To lead the growth of our remote gaming server platform for the mobile web we are looking for a “HTML5 Game Client Developer”. Your Experience: – You have proven experience in the design, implementation and delivery of web-based game products– Exceptional with JavaScript / HTML5 (including its subset technologies, such as CSS3) or TypeScript (we use TypeScript)– Exposure to JavaScript libraries (e.g. Phaser.io, Pixi.js or CreateJS)– Familiar with cutting-edge HTML5 specifications with particular emphasis on 3D transforms, transitions, and animations– Experienced with cross-browser debugging– Designed ubiquitous HTML5 web applications for use on mobile handsets, tablets, and desktop browsers alike– Understands mobile-specific capabilities such as the particulars of running web applications on iOS & Android– Experience with canvas or WebGL– Experience with the agile methodology– Experience in real money gaming or game development highly desirable (e.g. Flash AS3 background)– English full professional proficiency, German is a big plus Your Profile: We are looking for someone who is a very versatile professional with a creative mindset, good logical and analytical capabilities, you think from a user’s point of view and you have the ability to prioritize, multi-task and work under fast deadlines. Your Benefits: – You are able to bring in own ideas in products – Be part of a small but growing, highly skilled team developing the next generation online gaming platform – No hierarchies and quick decision making processes – The best development hardware & software money can buy – You can attend conferences & trainings – Comfortable working place with fruit, drinks & table football in Berlin How to apply? Please call or send your application to: jobs (at) crowdpark.com Crowdpark Games & Entertainment GmbH Ramona Döbrich (HR) Maybachufer 48-51 12045 Berlin, Germany Tel.: +49 (0)30 417 212 80 Fax: +49 (0)30 417 212 81
  22. Soloshadow

    collision

    Hi everyone, I am pretty new to phaser but I am working on an endless runner game and I would like my player to be able to jump on top of platforms. BUt everytime I try to jump on one my character just pass through it like it isn't even there. This is the code to my platform (I am working in typescript if it matters) class Platform extends Phaser.Sprite{ private platform; constructor(g: Phaser.Game, x: number, y: number){ super(g,x,y,"platform",0); this.platform = this.game.add.sprite(x,y,'platform') this.platform.scale.setTo(5, 2); //this.game.physics.startSystem(Phaser.Physics.ARCADE); this.game.physics.enable(this.platform, Phaser.Physics.ARCADE); //this.platform.body.allowGravity = false; this.platform.body.immovable = true; } public update(){ this.platform.body.velocity.x -= 0.5; /* if(this.platform.body.velocity.x < -(this.platform.width)){ this.platform.body.velocity.x = this.game.width; console.log("this"); } */ } } This is the player class. I didn't work on this. A team member did this class Player extends Phaser.Sprite{ //create a subclass voor Phaser.Sprite private playerSprite = this.game.add.sprite(0, 0, 'player'); //de url van de sprite staat in global.ts //gravity private jumpTimer = 0; private jump: Phaser.Key = this.game.input.keyboard.addKey(Phaser.Keyboard.SPACEBAR); //mapping keys private jumpAlt: Phaser.Key = this.game.input.keyboard.addKey(Phaser.Keyboard.UP); private slide: Phaser.Key = this.game.input.keyboard.addKey(Phaser.Keyboard.CONTROL); private slideAlt: Phaser.Key = this.game.input.keyboard.addKey(Phaser.Keyboard.DOWN); public speed:number = 30; private score:number = 0; constructor(game:Phaser.Game, x:number, y:number){ //word ook sprite aangemaakt??? super(game,x,y,"player",0); //Een typescript functie voor subclasses( https://tutorialstown.com/super-keyword-with-constructor-in-typescript/ ) //geen verwarring meer bij this.y en this.playerSprite.y this.playerSprite.x = x; this.playerSprite.y = y; //spritegrootte this.playerSprite.width = 100; this.playerSprite.height = 144; //muisklik (op telefoon is dat je vinger) this.playerSprite.inputEnabled = true; //this.playerSprite.events.onInputDown.add(Player.prototype.jump, this); this.jump.onDown.add(Player.prototype.goUp, this); //Voer functies uit op basis van input this.jumpAlt.onDown.add(Player.prototype.goUp, this); this.slide.onDown.add(Player.prototype.goDown, this); this.slideAlt.onDown.add(Player.prototype.goDown, this); this.anchor.set(0.5,0.5); //verander de anchor point voor de sprite this.scale.set(0, 0.2); //jumping (gravity) this.game.physics.startSystem(Phaser.Physics.ARCADE); //this.game.physics.arcade.gravity.y = 250; this.game.physics.arcade.enable(this.playerSprite); this.playerSprite.body.collideWorldBounds = true; //this.game.physics.enable(this.playerSprite, Phaser.Physics.ARCADE); this.playerSprite.body.gravity. y = 250; this.playerSprite.body.bounce.y = 0.15; this.playerSprite.body.collideWorldBounds = true; console.log("player setup"); } private doJump(velocity:number) { if (this.jump.isDown && this.playerSprite.body.onFloor() && this.game.time.now > this.jumpTimer || this.jumpAlt.isDown && this.playerSprite.body.onFloor() && this.game.time.now > this.jumpTimer) { this.playerSprite.body.velocity.y = velocity; this.jumpTimer = this.game.time.now + 750; console.log("jumping"); } } And in the update function in the gameplay state we added this.game.physics.arcade.collide(this.player, this.platform); this.player and this.platform is the name of the instance that was created in the gameplay state
  23. While attempting to hand-transpile some Phaser examples to Typescript, Creature Phoenix example in Animation section failed to build. The creature() method does not exist on GameObjectFactory. I am using VS2015 with an advanced Typescript template and Phaser 2.4.8. I have finished transpiling over 20 examples (randomly selected) with success so far.
  24. Hi all, I am here to talk about RELIC (working title, release title TBD), a project I've been working on for a few months. The game is currently in development ; a portion is fully playable but the product requires additional testing, content and beautification. OVERVIEW RELIC is an action-adventure game in line with 2D Zelda (TLoZ, ALLTP, DX, OoA, OoS). Details of the scenario are still to be defined, there is a semi-opened outdoor exploration area, interior dungeons with a mix of puzzles and challenging fights, and the need to collect items in order to progress. SCREENSHOTS Visuals are temporary, captured from the latest game build KEY FEATURES - Retro style but smooth gameplay with modern accessibility - Dynamic action including real-time combats - 4 outdoor environments with distinctive themes - 5 dungeons with their share of puzzles, monsters and exclusive boss - 16 items to collect, each granting special abilities or aptitudes (8 active, 8 passive) - Explorable "onion skin" outdoor world that unlocks progressively - Diversified bestiary with 20+ types of enemies and behaviours - Rich interactions, including traditional switches, teleporters, obstacles, secrets, etc. INFOS - Estimated play-time : ~10h, +~5h completionist - Size of the playable area : ~150 game screens - Team : me, all by myself ! - Development time : ~6 months starting from scratch (~4 done, ~2 left) - Platforms : desktop (Windows, Linux, MacOS), web (HTML5) - Release : ~summer 2016 TBC on Steam and itch.io DEVELOPPMENT I work alone and I do all the programming, game design, level design, production, QA, and I also create additional resources and art assets when I cannot find/buy what I need. The game is fully playable in terms of "flow" (player progress, items, gameplay mechanics, types of interactions, etc.) but only ~20% of the content is really completed at the moment (level design, puzzle variety, monsters balancing, beautification). The "finished" portion works as a "vertical slice" I intend to use to start focus tests as soon as possible, in order to collect player feedback and drive the upcoming iterations before moving on with the rest of the game. The work left is mostly filling and dressing, but also integrating all the secondary content : scenario, tutorial, audio, etc. ; as well as some late features : options, customisable controls, graphical filters, etc. BIO A few words about myself, in case anyone cares - I worked for almost 12 years in the game industry as lead programmer and producer for AAA PC and console titles. I've now been creating my own games and learning about game design for about ~1 year, with a first small project released on Steam a few months ago. My activity is not profitable yet, but it's a good way to gain experience with the "business" and "publication"-sides. My goal is to capitalise on my developments and reach a larger market/public with time as I progress, while finding other like-minded creators to join me in bigger productions. PARASITE on Steam TECHNOLOGY For those interested in the technical side - The game is developed in TypeScript, offering a good balance of productivity and maintainability. The underlying engine is Phaser 2.4.4 and I used Tiled for all the level design. This is a simple yet robust and efficient and tool-chain. In parallel of Phaser, I have developed my own custom ECS framework (Entity-Component-System) to maximise the reusability of all logic elements and blocks of gameplay. I intend to build on this framework and expand it with future projects, such as a dungeon-crawler and a coop-shooter, which I expect to be shorter to complete starting from this base. My ECS allows a fully data-driven approach, where all the gameplay is specified in the entity definitions (.json) and the instance data from the level file. It is therefore possible to integrate content, create new feature combinations and balance existing elements without the need to "re-program" any gameplay. It takes longer to get results than coding the gameplay directly, but in the long run it is a lot more flexible and reusable. Still in the interest of factorisation, my entity definition files (prototypes or blueprints, depending on the terminology various frameworks use) support multiple inheritance. CONTRIBUTORS Graphical resources used so far are created by 3 artists. All assets are licensed for commercial use and/or are distributed under CC0/CC-BY(-SA) Henrique "7Soul" Lazarini Environments, enemies http://7soul.tumblr.com/ Michele "Buch" Bucelli Environnements, various entities https://www.patreon.com/buch/ Carl "Surt" Olsson Additional characters http://uninhabitant.com/
  25. Hi there, I am trying to create an Phaser/Angular2 game in Typescript with the canvas in background and the DOM at the front. I would like to do either : 1 - Change the state when I click on a button from the DOM. 2 - Or change the state when I open a component with Angular2 with the constructor of the class (in Angular2 a component is based on a class). The problem I have is that I cannot access the Phaser.game element from a fonction triggered from the DOM or in the constructor of the class. 0 : I define the Phaser.Game object on a first class, I start the first state and I go to the page "/loader" with the angular route : import {Component} from '@angular/core'; import {LoaderComponent} from '/loader.ts'; import { ROUTER_DIRECTIVES, Routes, Router } from '@angular/router'; @Component({ template: '<router-outlet></router-outlet><div id="content"></div>', directives: [ROUTER_DIRECTIVES] }) @Routes([ {path: '/loader', component: LoaderComponent} ]) export class GameComponent extends Phaser.Game{ constructor(){ super('100%','100%',Phaser.AUTO,'content', {create : this.create}); } create(){ this.state.add('Loader', LoaderComponent); this.state.start('Loader'); this.router.navigate(['/loader']); } } 1 : In the first state I create a button and console.log this.game import {Component} from '@angular/core'; @Component({ template : '<button (click)="log()">Log</button>' }) export class LoaderComponent extends Phaser.State{ public game:Phaser.Game; constructor (){ super(); console.log(this.game); //return null } preload(){} create(){ console.log(this.game); //return the right Phaser.Game object } log(){ console.log(this.game); //return null //this.game.state.start('NewState'); //Not working obviously } } I guess this is because the Phaser.Game is liked to the Phaser.State object accessible from preload and create, but how can I access this object from the constructor or at least the fonction 'log()' ? Thanks for your help =)