• Content count

  • Joined

  • Last visited

  • Days Won


alex_h last won the day on November 13 2014

alex_h had the most liked content!

About alex_h

  • Rank
    Advanced Member

Contact Methods

  • Website URL

Profile Information

  • Gender
    Not Telling
  • Location
    Plettenberg Bay

Recent Profile Visitors

1,890 profile views
  1. Find point on curve

    @m9dfukc I was also thinking about this very issue the other day, very useful - thanks!
  2. Graphics objects and WebGL

    Ok thanks, I'll have a look at the mesh option
  3. Graphics objects and WebGL

    Yes they changed shape, it was an outrun type 'psuedo-3D' game so each road segment was constantly modified for perspective, especially when going around bends. Something like this: If I recall correctly, at the time graphics objects were drawn using the stencil buffer under the webGL renderer, which also meant their edges could not be smoothed. Is this still how it works?
  4. Graphics objects and WebGL

    A while ago I made an outrun type racing game with pixi.js v2.2.9, using graphics objects to render the road and ground polygons. This meant I had to use the Canvas renderer because with the webgl renderer I'd have had to re-upload all the graphics objects to the GPU every frame as they constantly changed shape. I'm now thinking of making a similar game so I just wanted to check whether graphics objects are now rendered differently with webgl in the latest version of pixi? In which case I might be able to modify the vertex positions of graphics objects at run time while running the webgl renderer without worrying about the impact on performance?
  5. stage.removeChild() not working as expected

    It's not a dumb question, don't worry. What you need to know is that a sprite will still exist as long as there is a variable that references it that remains in scope somewhere. So you might remove it from the display list but if there is a reference to the sprite then it still exists, and its x property still has a value of 100. It's just the same as any other javascript object. So yes, you can still console log its properties if you have a reference to it, even after it has been removed from the stage.
  6. Bug in my ordering code?

    The idea of having immutable data for games always seemed crazy to me. In games things are moving around a lot and changing their data all the time. So if you have to throw away objects and arrays each time this happens you are going to generate masses of garbage for the GC and have hopelessly bad performance.
  7. Bug in my ordering code?

    Just curious, why do you want to replace the children array rather than adding the child back to the existing one using push or unshift?
  8. I'm thinking about putting some ads into a game that will be played primarily in mobile browsers but potentially also in desktop ones. I've tried doing a bit of background reading about what options are available for this but most of the info seems quite old so potentially out of date. Is there an easy solution available that will work for both target platforms? Or does anyone have up to date info about the pros and cons of the main players, or even just who they are? I've seen Leadbolt mentioned (apparently no good for desktop), Google Adsense (although I think they didn't used to be available for games?) and Admob (are they native only?). I've never implemented ads before so I don't really have much of a clue, lol - help me out here
  9. How do I package audio data for HTML5?

    You definitely want to be using webaudio not an <audio> element. I think web audio can receive a live stream: just do a google search for 'webaudio live stream' for more background info. I don't know about the server side of things I'm afraid though.
  10. In my experience having all game objects fire tends to be a real pain. You virtually never want this behaviour, and in those rare occasions that you do it would be easy enough to construct a system of your own to get all the objects at the point of the click. It's much better if the engine can just fire for the front most object.
  11. Animation Library

    You probably want to ask this on the phaser specific part of the forum, but Phaser has a built in tweening animation feature.
  12. You probably don't want to resize the canvas, you want to scale it up using css. You might then need to adjust the width or height a bit if the aspect ratios of the game and the window don't match.
  13. rendering sprites from svg's

    Sure its possible. You'd just have to draw the svg to a canvas first: http://view-source:
  14. .off() doesn't remove .on() event listeners

    .off has the same signature as .on does. So you have to pass the event id and a reference to the same function instance that you passed to the .on function. In your example code that would not even be possible because you have used an anonymous function which you defined within the call to .on itself. If you want to remove the event listener later then you definitely don't want to use that approach! You need to define the listener function elsewhere and have a way of referencing it either by name or through assigning it to a variable. Then pass that reference to both the .on and the .off calls. Pixi uses EventEmitter3 for event handling so you can easily check the source code to confirm that this is the way it works: So your example code needs to be like this: const sprite = new PIXI.Sprite(); const eventHandler = function(){}; sprite.on('pointerdown', eventHandler);'pointerdown', eventHandler);
  15. let vs var keyword?

    You only want 'var' in the deployed code, you can use const and let in dev and then transpile with babel to convert the code to es5. Depending on which es6 features you use and which browsers you want to support it is getting to the point where transpiling may soon no longer always be necessary though