Leaderboard


Popular Content

Showing content with the highest reputation on 05/05/14 in all areas

  1. 2 points
    here is the code.. just in case my server goes down function onPresolve(presolve){ for (var i = 0; i < presolve.contactEquations.length; i++) { c = presolve.contactEquations[i] f = presolve.frictionEquations[i]; if (c.bodyA.parent.sprite && c.bodyA.parent.sprite.name === 'mario'){ //define here who is allowed to jump through var yAxis = p2.vec2.fromValues(0, 1); var y = p2.vec2.dot(c.normalA, yAxis); if (c.bodyB.parent.sprite && c.bodyB.parent.sprite.key == 'movingplatforms' && y >= 0){ // check for jumpthrough object // check if moving upwards c.enabled = false //disable contactEquation f.enabled = false //disable frictionEquation (solves the stuckInPlatform problem) if (c.bodyA.parent.velocity.destination[1] < 15 ){ // velocity < 15 - still inside the platform c.bodyA.parent.velocity.destination[1]-= 0.5; // course correction! } } } }}EDIT: the former code example only worked if there is just one object (player) that collides with other objects.. if there are more objects (other enemies for example) you will need to cycle through all contact equations.. i edited the code above if someone is able to tune this example and make it even better.. please report here ... thx!
  2. 2 points
    The engine is plug & play. Add it to your project in minutes then forget about it. But this is very true, I never denied this. You can literally set it up in a couple of minutes and see the results just don't expect good results if your game isn't designed properly. Sure, not knowing good HTML5 design is my fault, but it is your fault not to be clear about it on your product page. No engine or line of code exists to remove the task bar in Safari prior to 7.1, which is what takes up the part of the screen you're talking about. Address bars on Android devices consume just as much space, leaving this blank spot is very important for all devices and browsers not just Safari. Some devices cover more than others, some don't cover anything at all. This is basic stuff that is not the engine's fault. Even the screenshots on the sales page demonstrate this. Again, not knowing good HTML5 design is my fault, but it is your fault not to be clear about it on your product page. The screenshots demonstrates this? I hope that was a bad joke. Unbelievable. I have over 50 email threads and personal messages with you where I've been helpful at every chance, dating back to late 2012. The fact that this is not appreciated is mind-blowing to me. It's nice to see I wasted so much time trying to help you. And I thanked you every single time, even when you didn't answer my questions at all or I was unhappy with your answer. > i personally had to turn 4 out of 6 of games from landscape to portrait orientation, the thing is just not good with landscape oriented games This was a case of you not designing your games appropriately for mobile in the first place, and then choosing to change them to portrait on your own accord. I have plenty of landscape games that use the engine. Again, you blame the engine for your bad design. You know this isn't true. This is especially bad on Android devices. The great majority of your own games are portrait oriented. I wouldn't recommend the Mobility Engine for landscape oriented games at all. If I haven't turned this games around they would have never worked properly. > i even ask him how many pixels I needed to spare on the bottom to get the proper scaling and he refused to answer this simple question saying it wouldn't be fair to the people who already bought the book I clearly told you I misinterpreted your question the first time. After you asked "How many pixels do i need to spare on the bottom of my screen?" for the second time, 4 minutes later you wrote back saying you had figured it out. Clearly not the hardest answer in the world to figure out, and quite obviously not some special secret I would keep only for people who had bought my book. I openly admitted that: Maybe you really where going to answer my question at the time, maybe you where not. You didn't when I asked you and I did ask you more than once before figuring it out myself. > but people should be better oriented about the products they buy This is exactly why I assumed you had read the book, and that is exactly why I recommended you should. Because you clearly do not know enough about HTML5 game design, and you bought a product that relies on this information to make proper use of it. It's like you bought a paintbrush without knowing how to paint. You really need to be clearer about this on your product page. > but after i figured things out i was happy about it and the money started rolling in so I do recommend the engine Well how about that. Yeah, i even recommended the product, posted some good earning figures, and said i still use It. And is probably the only product I'll use, it just works once you know how to do your games around it. I even have a template game from which i start all of my projects, that's how easy to set up the thing is. Let me be clear: Finally! - don't buy this engine without knowing how to design a mobile game This should be on your product page. - you will not be "making games for the engine", once it's added you can forget about it True, but you will only see good results if your game is designed properly. - the engine can not remove permanent UI fixtures such as the Safari task bar, nor can any engine or line of code True. - the engine works perfectly fine in landscape mode You know it doesn't, the results are just not good. - extensive support is offered and you do not have to buy my book for assistance It depends on what you ask but this is mostly True, especially if you consider that TV is just one guy dealing with many customers. Once again, I use the Mobility Engine, I recommend the Mobility Engine, I have made lots of money in little time thanks to the Mobility Engine, and TV is a rather helpful guy willing to answer most of your questions, provide you with advice, and even some lines of code if you need them. But I still sincerely believe that this products page needs to be a lot clearer about what it can and can't do and I do not recommend it for landscape oriented games.
  3. 2 points
    The place-holders for image assets is awesome if you're trying to get the feel for an idea. This way, you can play with the dimensions all day without having to redraw assets. You can even go ahead and assign a name to what the image will be and fill in the gap later. Thanks for the hard work, Rich!
  4. 2 points
    It is good but just plugging the thing into an existing game wont do, you need to make your games on a very specific way for the engine to work properly. Also, don't expect TV to answer non-engine related questions unless you pay for his book. I personally had to turn 4 out of 6 of games from landscape to portrait orientation, the thing is just not good with landscape oriented games, this was a mayor hassle, then the ones that where already on portrait orientation had to be changed as well because with the Mobility Engine you can't use the whole screen but need to spare some pixels on the bottom of your game (about 64 on a 320x480 game so you only have 320x416 for the actual game). When I asked TV what to do when my games where getting cut off at the bottom he said he assumed I had bought his book so i should have known this. i even ask him how many pixels I needed to spare on the bottom to get the proper scaling and he refused to answer this simple question saying it wouldn't be fair to the people who already bought the book. i was beyond mad because of this but i simply figured it all out on my own and finally got the games working well with the engine. On the positive side, after finally getting my games to work properly I was able to make around 8,000+ on the next 6 months from licensing games. And when my questions where strictly related to the Mobility Engine itself he will gladly answer everything sometimes even providing me with example code. i hope I was clear enough. And I didn't mean any of the above on a demeaning way, i still use the engine myself, but people should be better oriented about the products they buy. I personally have to work 8 hours as a handyman for the 60 dollars i paid for the engine so i was rightfully mad when i realized my games weren't working well and that i may have thrown away my very hard earned cash. TVs initial reaction didn't help at all either. But after i figured things out i was happy about it and the money started rolling in so I do recommend the engine just know that after you buy the engine you will be making games for the engine.
  5. 1 point
    Have anyone successfully added virtual keys ( virtual_key_add () ) to their games powered by the Mobility Engine. I asked Mathew and his answer was beyond disappointing. I want to make this platform game work well on mobile and tablet. PC shouldn't be a problem because of keyboards. It actually works fine now on a perfect fit screen with multi-touch and everything. But if it scales up to much then the keys position get messed up. Any help?
  6. 1 point
    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.
  7. 1 point
    Hi everyone. We've been experimenting with the Chrome Web Store for a while and thought we'd publish some info on the publishing process in a blog entry: http://blog.playcanvas.com/publishing-html5-games-on-the-chrome-web-store/ The section on packaged apps uses a PlayCanvas game for illustration, but the steps/advice should hold for any HTML5 game. Hope you find it interesting. I'm curious about other peoples' experience with publishing games to the Chrome Web Store. Particularly on the monetization side (since I didn't cover that in the article).
  8. 1 point
    Here i have the working of the new 2.0.4 pauseUpdate functionality. I had a bit of time to look at how to get this working and decided to share it with you guys too. The example is here: https://dl.dropboxusercontent.com/u/257829727/pointdata/index.html Press P to pause Press U to unpause and the src is here: https://dl.dropboxusercontent.com/u/257829727/pointdata/game.js Hope this is helpful to you guys!
  9. 1 point
    Yep it's ok now!
  10. 1 point
    codevinsky

    Adding sprite to stage

    So, if you have an extended sprite: var MySprite = function(game, x, y, asset, frame) { Phaser.Sprite.call(this, game, x, y, asset, frame);}MySprite.prototype = Object.create(Phaser.Sprite.prototype);MySprite.prototype.constructor = MySprite;And you want to add it to the game, simple do: create: function() { var mySprite = new MySprite(this.game, x, y, 'assetKey', 0); this.game.add.existing(mySprite);};
  11. 1 point
    I tried it on Windows 7. It worked fine with Chrome 34.0.1847.131 m, Firefox 28.0, IE 11 and Opera 20.0. Thank you for sharing.
  12. 1 point
    codevinsky

    undefined forEach element

    this.tiles.forEach(function(tileGroup) { if(tileGroup instanceof Phaser.Group) { var tile = tileGroup.getAt(0); var value = tile.val; var valueText = tileGroup.getAt(1); if (value == 0) { this.emptyTiles.add(tileGroup); } else { this.occupiedTiles.add(tileGroup); } }}, this);That might be helpful. We're typechecking tileGroup to make sure it's actually a group and has those functions.
  13. 1 point
    jpdev

    undefined forEach element

    assigning tileGroup to the Variable newGroup will not clone anything, it will just put a reference to the same object into newGroup. (newGroup is the same as tileGroup, not a copy or a clone - just another "pointer" to the same object) The phaser groups (at least as I understand them) are there to organize the sprites - but mainly in the sense that the group order defines the order in which the sprites are painted to the screen each time. This is why a sprite an only be in one group at a time. I am not exactly sure what you plan to do with your groups. If you just want to do dirrent "stuff" with different sprites, then you can create them all in the "tiles"-Group and leave them there. Now you can create Arrays in which you can organize those sprites, without removing them form the phaser tile group.) For example: //create a new empty array this.emptyTiles = new Array(); //put something in the array this.emptyTiles.push(someTileSprite); //iterate over the array content, and do something with each element in it for (var i = 0; i < this.emptyTiles.length; i++) { this.emptyTiles.destroy(); //kill them all <evil laugh/> }
  14. 1 point
    davrous

    Occulus rift Demo

    It's on our roadmap to support Chrome, but this is low priority as we have so much to do/update. I need to work on an abstraction of the device orientation events implementation to be cross-browsers compatible. Can't do anything for Firefox until they won't support Device Orientation API. All the magic comes from there in our support for Oculus.
  15. 1 point
    Colorful concept. Will like to see the finished game.
  16. 1 point
    well.. i don't know if it's good but it is definitely good enough for now... here is the final example where i combine the disabling of the equations with the velocity check.. (using a smaller number than in the given code example so it feels right) http://test.xapient.net/phaser/ALL/moving-jumpthrough-platform-4-nofrictionEq-velocheck.html i also added a little bit of air friction to make the jumps more realistic but this **** 'sticktothesideofobjectswhenapplyingforce' problem is something for another thread... i can't just disable all xAxis-forces when up in the air.. this leads to several other problems (a little bit of unrealistic movement needs to remain in a plattformer otherwise it's no fun.. i need to be able to jump and then decide to not jump and steer back for example.. so IMHO i need another contactEquation ^^ - find out if i'm coming from the left or the right and disallow using more force into that direction.. but i will start a seperate thread for this
  17. 1 point
    jpdev

    undefined forEach element

    you are iterating over the group using foreach and in the callback you remove (some) elements from the group. You can't do that, because the implementation of foreach is a for loop over all elements in the group. (So if you remove elements while iterating over the elements, you run out of elements before the loop is done see here: http://docs.phaser.io/Group.js.html#sunlight-1-line-1053)
  18. 1 point
    Heppell08

    How to manage overlays and dialogs?

    There is many ways to do what you need. You can have a full overlay on top of the whole game with a button or timer etc, then when the timer/button is pressed to kill or destroy it. If you ever needed it to exist again you can create the whole overlay again within a button function or whichever other way you desired from user input. There most certainly isnt any need for framework change or even states to achieve this because its just stack order. So create the overlay first, set it visible over everything, then kill when you desire. A lot of games use this approach including my own. In the new version 2.0.4 of phaser there is this: > /*** pauseUpdate is called while the game is paused instead of preUpdate, update and postUpdate.** @method Phaser.State#pauseUpdate*/pauseUpdate: function () {},/*** @property {function} onPauseUpdateCallback - This will be called every frame while the game is paused.*/this.onPauseUpdateCallback = null;So you can pause the game fully and use the callback to unpause the game without stoipping the loop entirely like what used to happen. There is a multiple amount of ways to achieve a pause but with that now added i dont see any need for hacking them in like ive done in the past. Hopefully this is of some use to you.
  19. 1 point
    CtlAltDel

    Ellipse body in P2?

    It's a special shape because capsules are usually used for representing characters in games. The rounded bottom makes it easier to get up slopes etc with physics. The equivalent is also used in 3d games.
  20. 1 point
    valueerror

    Trigger (with P2)

    hmm.. i didn't have that much of a problem with the bump.. actually it feels kinda natural to me.. stickiness would be a problem because it would affect the jump from the platform i guess.. i will see if i find a way to slow down mario when up in the air.. thats something that's definitely on my list... oh.. btw. just for information.. i continued this discussion (about the jumpthroug platforms) in it's very own thread http://www.html5gamedevs.com/topic/6148-the-moving-jumpthrough-platform-sum-up-thread-help-very-much-appreciated/
  21. 1 point
    No I'm not the developer of Don't Touch The Lava. Neat game. It's a lot more polished than mine. Thanks for sharing
  22. 1 point
    It will not work since this code is using a 2D canvas, and in BabylonJS we are using WebGL canvas, it is a little bit harder to do, you need to read data pixel by pixel from WebGL buffer first and then push data in a 2D canvas to create a PNG with the same method you did, I will push my method to create a screenshot from render canvas today or tomorrow @Dad72 : Not sure to understand what you are trying to do, you a creating a var, but not using it
  23. 1 point
    With the risk of diving into a lesson on JavaScript objects and the prototype chain, I've found a lot of the frustration people coming to JavaScript from other OOP languages have is that JavaScript isn't a typed language. That's the root of most of the issues between, say, coming to JS from Java, for example. Because JavaScript isn't a typed language, you can bind properties to nearly any object at any time. There are very few restrictions on that. JavaScript also borrows from some Functional Language aspects in how it handles execution scope too. A lot of its "weirdness" comes from how it binds the function scope of its this. Depending on the calling context, a function's this can be different things and still work correctly. As for the prototype property of objects, it might be helpful to know that, like in Java, all JavaScript objects inherit from Object too. However, the way inheritance works in JavaScript is that all objects created from another, preexisting object inherit all of its prototype properties too. Any object created through a constructor has all the prototype properties (including its functions) of its superclass. For example, unless the prototype.constructor property is overwritten on an object, it is an instance of Object in JavaScript (similar to how everything is based Java's Object class in that language). (It might be confusing to read now, but I've recently put together a crash course on my blog that covers JavaScript objects, classical inheritance in the language, and how to create hybrid classes.)
  24. 1 point
    Yeah, I totally agree with george. If you are going to be using classes (or anything with an inheritance structure), it is best to learn how the prototype property of objects works and when to use it. That can save you a great deal of code writing for larger projects. Trying to write object literals of everything would just be a waste of time in many cases. As for game states specifically, I agree with both sleekdigital and george. Since new instances of an object have all previously prototype properties defined for that object, it can make sense to define how, for example, a menu works once and then have subclasses only change simple settings. That could save you some time and lines of code, definitely. (However, like george, I rarely use this approach myself.) On the other hand, the disadvantage for associating all game objects to a specific state is that you can't easily use them outside of that scope without making a new reference. And switching between states is destructive too. Keep in mind that moving between a 'menu' and 'game' state means that all objects bound to the 'menu' state's 'this' scope will be wiped out. So, if we are talking about combining different patterns, I personally use a module pattern on a global level, creating a function closure and passing in the 'Phaser' object. Then, for my own sprites, I make subclasses of Phaser.Sprite and use a prototype pattern for the states themselves. That way, I can have a singleton instance of a player object existing outside of any one state and then move (update its coordinates) between states. (This is more useful when I map states to different levels. Each state's change is a level load.) However, as george wrote, which pattern to use is often dictated by how comfortable you are with JavaScript's prototype property. And generally what problem you are trying to solve too. All the different patterns are to solve different problems. Some can be used as solutions to the same issues, but not always. Or not without some knowledge of how they work in the first place and why they happen to solve a certain problem.
  25. 1 point
    I think the reuse argument is not so relevant to most people. I never reused a state. You question is a fundamental one to JS programming- many people ask if they should use prototypes or stick to object literals (that is: using x = {}, your second version ). For the usage as a Phaser state, there is really no advantage or disadvantage between them. I guess you're not using classes in JS yet, are you ? Because then you would have already made the decision for variant 1 as you would be comfort with prototypes. if you're not able to make a decision: Choose variant 1. Maybe this leads you to learn JS classes - and THAT would be a huge win for you! So go for variant 1 and with this look into classes & prototypes in JS. There is a compact reading I always recommend for beginners with some experience in programming: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Introduction_to_Object-Oriented_JavaScript Enjoy! Regards George Edit/By the way: You will also see the second version when someone (who usually uses variant 1) wants to create a fast & dirty example in phaser. It's simply faster to write a short literal than the whole prototype stuff.
  26. 1 point
    The prototype approach gives you the option of easily creating a new instance of the state if you wanted to. In other words you can reuse the state over and over without having to duplicate code. One use case for this might be procedural or random level generation. Hopefully my meaning is clear here, but if not let me know and I can explain further.
  27. 1 point
    Dad72

    Occulus rift Demo

    Hi, No, I have no oculus pairs. I just was curious to see with another browser. and seeing the result I thought it functioned. You think it will be compatible with other browsers in the future. It is in project or this will only work for IE 11 and +. I want to add this functionality in my project "editor of game". Thank you for the explanation.
  28. 1 point
    yes that was it, i wasted all saturday because of ().
  29. 1 point
    Could be this? group.forEachExists(player.onClick03Callback(), null);to group.forEachExists(player.onClick03Callback, null);
  30. 1 point
    ben0

    What Happened to Market.js?

    Quick correction: the premium ones are collaborated with select devs and partners. We're adding a few big features in the coming weeks, will definitely make an announcement. Sorry for the wait.
  31. 1 point
    codevinsky

    [Experiment] Triangles

    I've been playing around with triangles recently and I came up with this experiment: http://phaser-triangles.herokuapp.com I've added drawTriangles to the Phaser.Graphics class, and if you guys like it, I'll submit it to the repo and see what Rich says. Thoughts?
  32. 1 point
    Btw I'm also dealing with a similar issue - I load my assets and show a background image of 768x1104 (usually cropped height). Then I put a single animated sprite on top and the first few frames chug at a low frame rate before it 'catches' and starts playing smoothly. I only see the issue on slower/older devices like iPhone 4. However, the issue goes away if I don't show the background image. I figure there is some way to juggle this where you display sprites initally offscreen or hidden in some way to ensure textures are in the GPU before I really need them. Still investigating.
  33. 1 point
    Hi, Here's some personnal tests you can look at on any devices or on Desktop: http://yamago.com/site/html5/mathieu/ The viewPort is scaled as I explained in a previous post. Assets are related to resolution and HD, MD or LD version are loaded. As the "world" clip always keeps the same coordinates inside because it's the only container that is scaled to fit the screen, positions and all parameters linked to positions don't need any modification. The only thing you have to do is to change the scale of the assets related to the choice of resolution (HD, MD, LD). Whatever, I decided to stop using Phaser and return to an home made framework based directly on Pixi.js This framework is a JS version of the AS3/AIR or cocos2DX framework of my studio. I know that there's some problems with Cocoon JS or PhoneGap to get the good informations to scale or modify the viewPort but at the moment, I'm more interested in browser based HTML5 projects.
  34. 1 point
    austin

    LeaderBoards

    You don't need them for Google Play Services, here's their docs for the JavaScript implementation: https://developers.google.com/games/services/web/gettingstarted If you want things to be more secure, then you'll want to do a backend implementation, and in that case you'd use their REST API with something like Node.js or PHP. If you haven't looked into Clay.io, I'd suggest that as well http://clay.io/development-tools