Tilde

Members
  • Content Count

    119
  • Joined

  • Last visited

Everything posted by Tilde

  1. If I'm working on a huge Phaserv2 game in which optimization is going to be important going forward, is it worth it to change the whole thing up and make it v3 for the performance updates?
  2. This seems to be a recent development and I want in on this question
  3. Tilde

    Shoot a rope

    I actually think you shouldn't use Phaser.Rope for this. What you're trying to accomplish for the "rope" part of the entity can easily be done with a simple tilesprite that expands in height over its lifetime, with the spearhead being a "child" to that sprite with its Y offset updated to be half its height. I hope that makes sense, but basically, you'll be using game.add.tilesprite, game.add.sprite, and you'll be calling rope.addChild(spear).
  4. The thing I'm trying to create is this: I have a gamestate called a GameArea, which defines every playable space in the game, sort of a basic "Gameplay" gamestate. So we know that for every GameArea, I want to load the same HUD elements, player, etc., but I want to load different tilemaps and music depending on which area it is. So the idea is to call the base Load function first, followed by the Load function of the unique child state. I haven't been able to get any version of this to work yet, I'm having trouble creating something that'll play well with how Phaser calls the functions. Anyone have any ideas? The only other thing I can think of is making functions like loadGameAreaAssets() and createGameAreaBase() that I call for every gamestate, but that's maybe a little less clean.
  5. So this is weird, but my current solution doesn't even use scaling options, because I want my game to put certain elements relative to the edges of the screen. So I ended up with this in the update loop: if (game.width != window.innerWidth || game.height != window.innerHeight) { this.resizeScreen(); } And that looks like this: resizeScreen: function() { game.scale.setGameSize(window.innerWidth, window.innerHeight); game.world.setBounds(-game.width / 2, -game.height / 2, game.width, game.height); game.camera.focusOnXY(0, 0); game.scale.refresh(); console.log('Screen resized: ' + game.width + 'x' + game.height); /* this.test = game.add.sprite(0, 0, this.solidRectBmd); this.test.anchor.setTo(0.5); this.test.width = 100; this.test.height = 100; this.test.tint = 0; */ }, Just as valid hopefully?
  6. Currently working on this myself. The margin is because HTML bodies have a natural margin you have to get rid of: body { width: 100%; height: 100%; margin: 0; padding: 0; background-color: black; } #container { width: 100%; height: 100%; margin: 0; padding: 0; } Beyond that, RESIZE doesn't actually resize for me. EXACT_FIT does, but that also stretches the elements, which we don't want.
  7. I'll probably do that from now on instead of my current strategy of commenting "god damn it, Rich" everywhere I use audio
  8. game.bgm = game.add.audio('southSide'); game.bgm.addMarker('start', 0, 11.748, 0.7); game.bgm.addMarker('loop', 11.748, 110.769, 0.7, true); game.bgm.play('start', 0, 0.7, false); game.bgm.onMarkerComplete.add(function() { // This will only fire once, and the sound will NOT loop after heading into the loop section under any circumstances if (game.bgm.volume != 0.0) { console.log('yes'); game.bgm.play('loop', 0, 0.7, true); } }, this); I did a search on this and it turns out it's just never been fixed!
  9. Adding gamepad support to my game, and I'm pretty sure this is still a problem.
  10. I cannot for the life of me figure out why it turns into a giant, thinly-stretched column upon exiting frame 1. Even if I set its initial frame to 4 or something and I tell it not to update frames and then apply the filter, it works fine. I also can't figure out how to get the texture to cleanly connect to its edges in the same way before I used a bmd...but at least this is closer.
  11. Thanks for the info! I'm trying and getting some weird results, no luck yet with a direct transfer. My backgrounds have blank backgroundImage, backgroundTileSprite, and backgroundBmdImage objects that I load textures onto depending on the encounter. Here is what the battle background object looks like: create: function(gamestate) { // Shader by Kali (https://www.shadertoy.com/view/4dfGDM) // I slightly modified it! ~Tilde var fragmentSrc = [ "precision mediump float;", "uniform float time;", "uniform vec2 resolution;", "uniform sampler2D iChannel0;", "void main( void ) {", "vec2 uv = gl_FragCoord.xy / resolution.xy;", "uv.y *= -1.0;", "uv.x += (sin((uv.x + (time * 0.5)) * 10.0) * 0.1) + (sin((uv.x + (time * 0.2)) * 32.0) * 0.01);", "vec4 texColor = texture2D(iChannel0, uv);", "gl_FragColor = texColor;", "}" ]; gamestate.backgroundImage.loadTexture('mother3BG', 0); gamestate.backgroundImage.x = gamestate.world.centerX; gamestate.backgroundImage.y = gamestate.world.centerY; gamestate.backgroundImage.anchor.setTo(0.5); gamestate.backgroundImage.scale.setTo(3.6); gamestate.backgroundImage.fixedToCamera = true; gamestate.backgroundImage.visible = false; gamestate.backgroundImage.animations.add('natural'); gamestate.backgroundImage.animations.play('natural', 7, true); var gray = game.add.filter('Gray'); var customUniforms = { iChannel0: { type: 'sampler2D', value: gamestate.backgroundBmdImage.texture, textureData: { repeat: true } } }; var filter = new Phaser.Filter(game, customUniforms, fragmentSrc); filter.setResolution(900, 600); gamestate.backgroundBmdImage.filters = [filter, gray]; }, getFilters: function() { return null; }, update: function(gamestate) { gamestate.backgroundBmdImage.filters[0].update(); gamestate.backgroundBmd.draw(gamestate.backgroundImage); },
  12. I modified the sine wave filter from the examples ( http://phaser.io/examples/v2/filters/sinewave ) to create the background for this battle: http://www.hardmodeorders.com/vandal/vandal.php It works great, but that 256x256 texture originally comes from a sprite sheet, which I wanted to animate as it was being warped by that. Obviously, when you add more frames to the image, it's no longer a power of two, and it breaks the filter. Is there a way to reconcile this? What you see: What I want to use:
  13. This is great, the new update really helps. I'd love to see a feature where text can take a special character to "pause" like you see in RPGs. Like... "Well, (PAUSE) I guess I'll see you later." (END LINE)
  14. Needless to say, I disagree. I like HTML5 and javascript as a canvas for designing and developing games, and I find Flash cumbersome both on the developer end and the user end. Plus, there are many situations where you just want the device inputs of a keyboard and mouse. Of course, you seem to be talking more as an entrepreneur while I'm talking more as an artist. I'm currently developing a game that downright cannot legally be sold, so that colors my perspective a bit.
  15. Phaser seems like a mostly-mobile-oriented tool, but I like to make browser games on desktop, where I don't feel too burdened by performance issues. I'm curious what real the ratio is!
  16. I've been coding in camera shake myself, and these controls are way better than what I had. Thanks!
  17. I actually had to eliminate tweens for the sake of performance! But it is noteworthy that I can tween from a color to black to maybe affect brightness. Although every time I've tried something like that, it flickers through colors like crazy because it's reading a 3-part hex value from a decreasing integer amount.
  18. It actually seems pretty fast, but my formulas are just plain wrong. Part of the difficulty is that tint only takes a number(usually in the format 0xffffff), strings aren't valid. console.log(getTintFromLightness(red, 1.0)) should give me a number equal to 0xff0000, it instead gives me...-1
  19. Still no clue on this. My game runs in CANVAS, and from what I understand, Pixi's filters don't even work with that. Even knowing how to do basic hue rotation would be a massive help.
  20. Haven't really pursued this since last reply. Is anyone familiar with this filter's use?
  21. I'd like to see this made more crashproof, as I'm trying to use it for constantly-updating dialogue boxes that may be interrupted. And hey, maybe it could take "delay" commands in strings, like you see in a lot of text boxes in games.
  22. I'd like to bring this case back open!! I'm curious how people create extended classes with functions without using prototype. I haven't seen that done yet.
  23. Thanks for bringing this to my attention. There's a lot of interesting stuff in here, but it's still confusing to me right now. Here is all the documentation I can get: https://pixijs.github.io/docs/PIXI.filters.ColorMatrixFilter.html So from what I understand, instead of using Sprite.tint, I'd apply a filter to the Sprite(since it extends DisplayObject) and use the brightness function somehow. But I'm still pretty lost about how this is built and used, and whether its version of pixel processing is an expensive operation.