nkholski

Members
  • Content count

    126
  • Joined

  • Last visited

  • Days Won

    1

nkholski last won the day on September 16 2017

nkholski had the most liked content!

About nkholski

  • Rank
    Advanced Member

Contact Methods

  • Twitter
    nikbrg

Profile Information

  • Gender
    Not Telling
  • Interests
    x

Recent Profile Visitors

2,079 profile views
  1. 1. I would love a community-driven Phaser 3 boilerplate like Phaser CE is handled, preferably with an official status. 2. I would prefer new and official one but probably based on the Lean boilerplate for Phaser 2. That boilerplate is also a result of developing other repositories. 3. It would need to have typescript support. ESlint should be a copy of that for Phaser 3. A guide or something to tweak it (like spritesmith, cordova builds etc). An official plugin list would be perfect, but perhaps as a separate project.
  2. Key just pressed event

    Instead of justdown I would do something like this with the first statement the beginning of the update loop. It's also easy to expand to support variable height (higher jumps with longer press time): // The player might try to jump if the jump key has been released while standing on the ground if(!keys.jump.isDown && player.body.blocked.down){ player.allowedToJump = true; } // The jump key is down, the body is on the ground and the player is allowed to jump => jump! if(keys.jump.isDown && player.body.blocked.down && player.allowedToJump){ /* Insert jump code */ player.allowedToJump = false; }
  3. Generic platformer boilerplate

    I added a title screen running the game itself in a parallel scene in attract mode. The attract mode was made by recording my gameplay in a json and then repeat it. It's buggy and does weird things from time to time due to non-deterministic physics, but I think it looks kind of cool anyway. I also updated the repository. What I really should have done was to clean up the code (and remove some pre-release solutions) but now I added more spaghetti code than ever when hacking in the attract mode.
  4. An idea if you don't mind adding a global var you could define something like "window.angularLink = this" in the angular component, then you can access the components variables and run methods from phaser (like window.angularLink.sayHello("hello") within the phaser scene), and you could pass methods from phaser back again to allow the component do stuff with Phaser (window.angularLink.aPhaserMethod = this.someMethod.bind(this) in the Phaser scene, and then call it by window.angularLink.aPhaserMethod() from the angular component). It might not be a very clean solution but it'll work. You could try to pass "this" from the component via the config too. That might work somehow and avoid setting a global variable. import { Component, OnInit } from '@angular/core'; import { FormsModule } from '@angular/forms'; import * as Phaser from 'phaser'; import { ShowSprite } from './scenes/myScene'; @Component({ selector: 'app-phaser', templateUrl: './phaser.component.html', styleUrls: ['./phaser.component.css'] }) export class PhaserComponent { config: any = { type: Phaser.AUTO, custom: 'hejsan', parent: 'content', width: 400, height: 240, physics: { default: 'arcade', arcade: { gravity: { y: 800 }, debug: false } }, scene: [ myScene ] }; constructor() { } ngOnInit() { let game = new Phaser.Game(this.config); window["angularLink"] = this; } sayHello(str: string) { alert(str); } }
  5. Phaser 3 Animated Tiles Plugin

    I've prepared a plugin in time for the release of Phaser 3 today: support for animated tiles. The plugin parses tile animation data configured in Tiled and then, well, animates layers (dynamic layers required). All you need is three lines of code; one for preloading the plugin, a second for installing the plugin and the third for initializing it for a map. Features: Animate tiles as configured and displayed in Tiled. Support for unlimited tile animations, layers, maps, and tilesets. Use the API to manipulate the rate (multiplier of the frame duration set in Tiled) globally or for a certain tile id or map. Animations adapt to the timeScale set by the Phaser 3 API. Add and remove animated tiles any time. API demo: http://metroid.niklasberg.se/phaser-animated-tiles Playable demo (question marks are animated tiles): http://metroid.niklasberg.se/phaser3platformer/ Github repository: https://github.com/nkholski/phaser-animated-tiles Suggestions are welcome and if you use the plugin, please tell!
  6. Generic platformer boilerplate

    I'm happy to hear that. Please let me know if you think I should add something in particular. I'm thinking about title screen to demonstrate going between scenes and fireballs in a pool. I would be a bit cautious learning webpack from the project though. Most of the time I have no clue what I'm doing and when I guessed something that works I stay with it. :-) I updated the repository to Phaser 3.0.0 earlier today btw.
  7. Generic platformer boilerplate

    I've added touch controls tonight to be able to check performance on mobiles. There is no lag at all on my Honor 8 from 2016 and I've done nothing to optimize the code. Phaser 3 is going to be great! You can try it by the link provided above. Note that the touch controls are just a quick test to be able to move Mario at all, and not what touch controls could be in a real game.
  8. Generic platformer boilerplate

    I finally managed to get deploy to work and uploaded a live version here: http://metroid.niklasberg.se/phaser3platformer/
  9. What I would try: You need to add "fromInGame" to the gameScene after you created the class. Then you'll have a new problem when Phaser fires the scene and you haven't added "fromInGame" yet, so you need to do something in your scene that checks if "fromInGame" is avaliable and fire it when ready. Let me know if it works :-)
  10. Nintendo Switch

    I asked Nintendo and got this reply: "HTML5/JavaScript development is not supported on the Switch, and we have no plans to support it in the future. We apologize for the inconvenience." Perhaps if Nintendo is approached by high-quality HTML5-games they would consider supporting it, but I think it's hard to convince them with empty hands.
  11. I created a Phaser 3 - ES6 - Webpack-repository a couple of months ago (or more accurately made a quite ugly update of an existing repository). A few days ago I replaced the simple bundled examples with a, let's call it "generic platformer". This is the result of exploring the Phaser 3 API and I plan to continue to improve it (but not create a complete game because of obvious copyright reasons). Feel free to check it out: https://github.com/nkholski/phaser3-es6-webpack I aim to tidy up the code and add comments in time for the release of Phaser 3. I haven't managed to get deploy to work properly though which means I can't offer a playable demo. I ran out of ideas on how to update the webpack-configuration file so I decided to share the project now so that I might find someone to assist me. Questions, suggestions and contributions are all more than welcome.
  12. Where are the Layers?

    I'm afraid there is no consistent rule for what is what. Google released numerous RC's of Angular 2, sometimes with huge API-changes. I think beta is a good term for something that you can actually make a game with but that you can't expect to trust for production.
  13. Transition between states

    Thanks. Actually it started out just as a test to render the map and doing the transitions we're talking about. Like a map navigator. But then I started to add stuff just for fun and it grew until I got where it is now, needless to say, the source is messy. I hope to begin something similar but original with Phaser 3 when it's ready and then I might do a room transition plugin and share it.
  14. Transition between states

    Just coordinates. Define minX,minY, maxX and maxY (or x,y,width,height) for each "room" and check the player position against those rectangles. When you move between rooms you tween such a rectangle from original bounds to the desired ones and constantly set the real world bounds to match that rectangle in the update-loop. Sorry for being cryptic, you'll have to translate it to code yourself. This how it works in my partial metroid remake at http://metroid.niklasberg.se
  15. Transition between states

    One way to do it is to define sections as rectangles and check the player position against that. When you enter a new rectangle you tween the bounds from what they are to the new rectangle. I think you might need a temporary rectangle and tween the coordinates of that and copy it's values to the bounds on each update. Also you'll gonna need some tweaking to avoid tweening values that's outside what you see, or else you'll do a lot of unecessary tweening when entering a long/high corridor.