Parasyte

Members
  • Content count

    22
  • Joined

  • Last visited

About Parasyte

  • Rank
    Member
  • Birthday

Contact Methods

  • Twitter
    kodewerx
  1. We will probably need to see the full class definition you created. The error console is telling you that you don't have an onSelect method on the class. Your original snippet is practical; the method you are binding exists. But you did not describe any errors for that code.
  2. Hi, Yes, zooming and panning are just transformation functions. This can be done by carefully controlling the renderer matrix at the correct points in your scene hierarchy. For example, if you have a HUD element in your scene, you probably don't want the zoom function to affect it. If you use a Container element that is a sibling of the HUD and apply your transformations to that container, then everything inside of it will inherit those transformations. Scale/translate the renderer at the top of the Container's draw method, draw all of its children, and reset the transformation matrix on the way out of the draw method. Something like that, anyway. It's actually incredibly simple.
  3. Documentation is linked on the website and the README. Here's a direct link: http://melonjs.github.io/melonJS/docs/
  4. That's pretty old. I guess we'll have to update the generator: https://github.com/melonjs/generator-melonjs/blob/master/app/templates/index.html#L25
  5. We don't support NPOT textures with the WebGL renderer. WebGL is picky about texture size (just like OpenGL ES) It is technically possible to support NPOT textures just by adjusting some of the texture flags, but it comes at a performance cost. We wanted melonJS to run as fast as possible (or just not run at all, as you saw) so we decided to force users to use correctly sized textures. MDN also makes a good argument against NPOT textures: https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API/Tutorial/Using_textures_in_WebGL#Non_power-of-two_textures For example, it is not possible to create repeating backgrounds with NPOT textures. See: http://melonjs.github.io/melonJS/docs/me.WebGLRenderer.html#createPattern And the Platformer example linked above makes use of texture repeat for the parallax scrolling backgrounds. I agree, the limitation needs to be documented better. I suppose we kind of expect users to be somewhat familiar with WebGL internals if they intent to use the WebGL renderer ... In any case, you should have seen error messages in your developer console when loading NPOT textures. Hopefully that was enough to point you in the right direction.
  6. Whoops, I got confused. melonJS isn't currently on npm. I think the only thing it really needs is a small change to package.json to get it working. But once it's there, you won't be able to just `require('melonJS')` ... There's a JavaScript file in the `build/` directory that you can link in your web app with a <script> element. For a quick workaround, you can install melonJS right now using bower; the same linking instructions above work for this method.
  7. Hi! I had no idea our recently releases haven't been published to npm. (I've been away from the project for quite some time.) Thank you for pointing that out. I'll get those published shortly!
  8. Maybe you could share an example that demonstrates the issue? A zip file with the complete code is probably good enough. But if you can put it all on github (gh-pages), that's even better! With a demo like that, I can investigate and find a solution for you.
  9. Hi, To use this callback, you have to set the isHoldable property to true. That should fix the issue with the callback not firing. But I've never used it, so I don't really know what to expect. From the source code, it looks like the callback fires once and only once. And the timer value controls how long the button must be held before the callback fires. If you want a callback to trigger every frame, you need to override the `update` method. You can use the various properties that keep track of click state: https://github.com/melonjs/melonJS/blob/4.0.0/src/renderable/GUI.js#L96-L97 That said however, it's probably better if you use the `onClick` and `onRelease` callbacks with `me.input.triggerKeyEvent`; the second param indicates whether the key event is a click (true) or a release (false), and that maps nicely to the GUI_Object click and release callbacks.
  10. Nope, no known issue that I'm aware of. Do you have other object in the scene? Or just the ImageLayer? The platformer example uses ImageLayer for its parallax backgrounds, and you can run it with WebGL: http://melonjs.github.io/melonJS/examples/platformer/#webgl This shows that it does work as expected, but it might actually rely on something obscure, like having moving entities in the scene ...
  11. Yep, the supported way is now `this.renderable.flipX()`. See the platformer example for usage: https://github.com/melonjs/melonJS/blob/bca659885eb2782d3730193843b94da2b58d6e88/examples/platformer/js/entities/player.js#L69-L75 We should probably remove the deprecated method on me.Entity ...
  12. I think this is the problem: https://github.com/melonjs/melonJS/blob/50597e86b39e5dd7a0efaf8aa74de1142013ffaa/src/renderable/sprite.js#L378-L379 When setting an animation, it replaces the name of the first frame with the animation name. As the animation cycles, the current frame will not have the name of the animation. This [incomplete] workaround was added here: https://github.com/melonjs/melonJS/commit/a0e084ad68c58f6a9a0599982c6d4b39f02176f7
  13. Ah good! That would really surprise me if it didn't work. I used JSFiddle all the time for whipping up quick demos.
  14. Hi Ellison! Glad to see your projects keeping up with melonJS release cycles. The rotate method on the transformation matrix can only apply rotation deltas; it's not able to set absolute angles. I see two solutions off the top of my head: You have a currentAngle property which you could continue using. When it's time to apply the angle to the matrix, just reset the matrix with `this.renderable.currentTransform.identity()` and then use the rotate method with the value of currentAngle. Create a Tween on the currentAngle property, and in the Tween's update callback, rotate the renderable by the update delta (it's passed to the callback). Don't forget to reset the matrix with identity() and rotate() when the flap key is pressed! I hope one of these ideas works for you. Just let us know!
  15. Glad we were able to help out! Olivier identified the issue was actually a regression introduced in version 3.0.0. The stress testing I ran was on 2.1.0! I committed the workaround to the master branch, and we now have a feature request ticket to opt-out of collision detections on a per-object basis, instead of a hard-coded inheritance check.