codevinsky

Members
  • Content Count

    212
  • Joined

  • Last visited

  • Days Won

    5

Everything posted by codevinsky

  1. The solution I've decided on is to fall back to canvas instead of using the graphics objects here. It's just debug output instead of something really important.
  2. The drawPath method is, if you want to get more computer-sciency, protected. That is, it shouldn't be modified for this edge case.
  3. Sure... So I have a base class: Path. This class has, amongst others, the following methods and properties: var Path = function() { ... this.points = []; this.coordinateSystem = Path.CoordinateSystems.WORLD; ...}Path.CoorindateSystems = Object.freeze({ WORLD: 0, //points are relative to the world SCREEN: 1, //points are relative to the screen OFFSET: 2 // points are relative to the first point in the path});Path.prototype = { ... drawPath: function(graphics) { // overly simplified draw function this.points.forEach(function(point, index, points) { if(index > 0) { var prev = points[index-1]; graphics.moveTo(prev.x, prev.y); graphics.lineTo(point.x, point.y); } } }}Seems simple enough, and for the -eventual- use case, it is. However, I'm building an editor. The Editor Class looks something like: var Editor = function() { this.paths = []; this.graphics = new PIXI.Graphics();}Editor.prototype = { render: function() { this.graphics.clear(); this.paths.forEach(function(path) { ... path.drawPath(this.graphics); } }}Again, this works for the base case when the path's coordinate system is set to world. When a path's coordinate system is set to offset, the first point in the path's x and y components are set to 0,0 and a world _origin property is added to the path. Using canvas, the method would look like: render: function() { this.paths.forEach(function(path) { ctx.save(); if(path.coordinateSystem === Path.CoordinateSystems.OFFSET) { ctx.translate(path._origin.x, path._origin.y); } path.drawPath(ctx); ctx.restore(); })} I attempted the following to mimic the behaviour I need: Editor.prototype.render = function() { this.paths.forEach(function(path) { if(path.coordinateSystem === Phaser.Path.CoordinateSystems.OFFSET && path._origin) { this.graphics.pivot = new PIXI.Point(-path._origin.x, -path._origin.y); this.pivot = new PIXI.Point(path._origin.x, path._origin.y); } else { this.graphics.pivot = this.pivot; this.pivot = new PIXI.Point(0,0); } p.drawPath(this.graphics); }, this);}The results were correct for a this.paths[] when only WORLD coordinates or only OFFSET coordinates were set. However, if the list contains both WORLD and OFFSET paths, the results were.... unexpected.
  4. I need to do some offset manipulation that would be, frankly, ridiculously easy to do with a canvas context. Is there an equivalent of the canvas.context.save -> .translate -> {draw} -> .restore() methods for the PIXI.Graphics context?
  5. You should submit it to the phaser-plugins repo. https://github.com/photonstorm/phaser-plugins
  6. I've only been working on this today: http://cloud.codevinsky.com/image/2w1t0z2v1H1I slot machine RPG.
  7. Classically, in computer science education, you tend to learn cumulatively, where each program you write builds on the principles learned in the previous exercise. I have classical training in programming, but all the game dev I've done has been self-taught. That being said, I feel I've done quite well with the core concepts, but I feel like maybe I skipped a few steps. I'd like to start at the bottom again, and follow a project curriculum that would introduce me to concepts or ways of thinking that I'd not considered before. That being said, is there a project curriculum, or list of games that I should write/clone to wrap my head around some of the more abstract ideas or methods that are used in game dev?
  8. I've updated the game. Arcade mode is "done" (as in game play, not as in visuals). Story Mode is currently WIP. Please play again.
  9. I'd really like to see separation of Point and Vector2D.
  10. var text = game.add.bitmapText(100, 100, 'charlottesweb', 'Some Pig!', 24); text.x = text.x - text.textWidth / 2; text.y = text.y - text.textHeight / 2;
  11. One of the things I'd really like to see is the ability to add user defined properties to objects.
  12. codevinsky

    Make vs Add

    Make creates the game object. Add makes the object and then adds it to the world. to add a made item: var sprite = game.make.sprite(0,0,'');game.add.existing(sprite);
  13. Started this yesterday in an attempt to create a simple game to push into cocoon and eventually onto the app store. Is this any fun? http://touch-drop.herokuapp.com
  14. http://duckie.me/ Enjoy.
  15. • Native UI Components (inputs, dropdowns, checkboxes, etc). Perhaps as a plugin?
  16. I'd like to see the follow in Phaser 3: • AudioSprite game object and audioAtlas added to loader. game.load.audioAtlas(['sound.mp3','sound.ogg'], 'sound-atlas.json')• Box2D or even LiquidFun physics implemented • An official Project Generator more to come
  17. change the following line: game.physics.arcade.overlap(player, stars, collectStar, null, this);to this: game.physics.arcade.collide(player, stars, collectStar, null, this);and remove your custom code in collectStar. Overlap merely checks if the two items overlap each other. collide applies physics.
  18. So, starting off, I'm going to assume you aren't using groups. That's a huge mistake, especially for things like this. Secondly, instead of calling the base phaser classes, you have access to all the things you need inside of the game object. I don't know if what you've done has exposed a bug or not, but try doing this first: create: function() { this.enemies = this.game.add.group(); // add 10 enemies for(var i = 0; i < 10; i++) { this.enemies.add(new Enemy(this.game, x, y, key, frame)); } // we now have 10 enemies... let's assume you have a tilemapLayer setup properly this.layer = { ... pseudocode for tilemap layer ... }},update: function() { this.game.physics.arcade.collide(this.enemies, this.layer);},Using the built in arcade physics collide method takes care of figuring out what type of collisions need to take place and using a group means that you can tell the physics system to only collide the objects in that group.
  19. Is it against the spirit of the rules to write a tiny game framework and release it to the community before everything takes off?
  20. I submitted a couple of issues to github, but I guess I could mention them here: • Sprite Angle is not currently exported correctly. It is always set to '0' in the exported data • There's no way to start the server locally if you clone the repo. package.json needs to be created. This can be done simply by: $ cd Server/$ npm initthere will be a question like: "Do you wish to include the currently loaded modules as dependencies? Y/n" Answer yes.
  21. I've been trying to use this tool today. It works reasonably well! However, it takes -forever- to load (about a minute), due to the fact that your phaser file is so large and it appears your server is hella slow. I might suggest moving it to heroku or S3.
  22. I'd be interested to know how he predetermined where to places the pegs in order to have the plinko chip fall where he wanted it to.