XHH

Members
  • Content Count

    14
  • Joined

  • Last visited

About XHH

  • Rank
    Member

Contact Methods

  • Website URL
    http://xhhstuff.co.nr

Profile Information

  • Gender
    Male
  1. I'm trying to use '>>' and '&' in fragment code for a Filter. It said bit-wise operator supported in GLSL ES 3.00 and above only". I tried adding "#version 300 es" to the top of my fragment shader code, but it keeps giving me "#version directive must occur before anything else, except for comments and white space" (it's at the very top, without any white space too) How can I enable bitwise operators? Or is there an alternative?
  2. Ok this helps a whole lot. Thanks! For the int constant I ended up putting `#define focusDetail 7` at the top instead of using js interpolation, but I do understand the benefits interpolation can bring. Edit: I made some small changes to compensate for alpha blending (I think that might be the right term). I'll post it here in case someone else wants to use this. I'm using this on a container where it's filterArea = app.renderer.screen and center is a uniform passed in. precision highp float; varying vec2 vTextureCoord; uniform sampler2D uSampler; uniform vec2 center; uniform vec4 inputSize; uniform vec4 outputFrame; uniform float time; #define focusDetail 7 void main() { float focusPower = 10.0; vec2 fragCoord = vTextureCoord; vec2 uv = fragCoord.xy; vec2 mousePos = (center.xy - outputFrame.xy) / inputSize.xy; // same as * inputSize.zw vec2 focus = uv - mousePos; vec4 outColor; outColor = vec4(0, 0, 0, 0); for (int i=0; i<focusDetail; i++) { float power = 1.0 - focusPower * (1.0/inputSize.x) * float(i); vec4 c = texture2D(uSampler, focus * power + mousePos).rgba; if (texture2D(uSampler, focus * power + mousePos).a > 0.0) outColor.rgba += c; else outColor.rgb += c.rgb; } outColor.rgba *= 1.0 / float(focusDetail); gl_FragColor = outColor; }
  3. Do I have to pass in filterArea manually as a uniform then?
  4. I've look at these pages and still have a hard time figuring this out, so I'll just wait till someone is available. I think I'm mainly having issue understanding the measurements of coordinates and what values are given to the shader. For example, it looks like iResolution should be filterArea instead, but I'm not sure how to make that work properly. Also, inputSize doesn't seem to be passed to the shader. Thanks!
  5. I'm very new to shaders and trying to create a zoom blur effect on a container. I have one uniform 'center' where i just give it some coordinates. But this just gives me a black screen. I would love any help with this. I'm trying to convert the code from https://www.shadertoy.com/view/3slSRj Here's the shader code: precision mediump float; varying vec2 vTextureCoord; uniform sampler2D uSampler; uniform vec3 iResolution; uniform vec2 center; void main() { float focusPower = 10.0; const int focusDetail = 7; vec2 uv = vTextureCoord.xy / iResolution.xy; vec2 mousePos = center.xy / iResolution.xy; vec2 focus = uv - mousePos; vec4 outColor; outColor = vec4(0, 0, 0, 1); for (int i=0; i<focusDetail; i++) { float power = 1.0 - focusPower * (1.0/iResolution.x) * float(i); outColor.rgb += texture2D(uSampler, focus * power + mousePos).rgb; } outColor.rgb *= 1.0 / float(focusDetail); gl_FragColor = outColor; } Thanks in advance!
  6. XHH

    new phaser IDE - BlankE

    This is possible without the IDE. However, it's a lot quicker and less messy with the IDE.
  7. XHH

    new phaser IDE - BlankE

    bump
  8. XHH

    new phaser IDE - BlankE

    If you want to have variables that are seen by all objects you should put that in the global code file (Edit > Global Code). To change to another state you can still use: game.state.start('nameOfState');
  9. XHH

    new phaser IDE - BlankE

    I am thinking about making it open source. What do you mean by drag and drop? Do you mean dropping images or sound files onto the ide to add it to the project? I can work on adding that.
  10. XHH

    new phaser IDE - BlankE

    Yes you can by right clicking the state and selecting edit code. If you've done that, do you mind showing me what state code you are trying to run?
  11. Hi guise, I have been working on my own game making software for the past year or so. I plan on using to make games in the future. I'll just get to the point of this thread. I want to share this with yall and maybe get some feedback. It's called BlankE IDE. LINK--> Blankeide.co.nr Selecting an option from the build menu will make an EXE for windows or a ZIP that's ready to upload to CocoonJS. It uses PhaserJS. You can edit the code using your favorite code editor (Sublime Text, Notepad++, notepad...) When testing your game, it runs a local server that updates whenever you click "Run game" In "IDE Settings" you can change the color of the background, grid, and text (make it look nice lol) Has a WYSIWYG scene editor. I'm hoping this software will be of use to someone. Here's a LINK to a demo video Here's a sample screenshot:
  12. That one works ^.^ Thank you!
  13. Hello, I've made a game in phaser. It's all in a html file with the assets folder next to it. Now how do I actually put it on my website that is hosted on Google Sites? I'm very new to web development. Thanks.
  14. Hello, I'm using Arcade physics to detect collisions in a platformer I'm working on. However when my player jumps while moving towards a wall, the player can stand on the wall and just hang there (see image below). How can I get the player to stop hanging on walls? Here is my code. Sorry for the weird formatting/organization. I put my code together using an IDE I'm working on. Really hope someone can help me with platforming. Thanks in advance. var game = new Phaser.Game(640,762,Phaser.CANVAS,'', { preload: preload, create: create, update: update, render: render});var G_Player;var G_Ground;var G_Collision_box;function Player(x,y,frame){ this._name='Player'; this.x=typeof x !== 'undefined' ? x : 0;; this.y=typeof y !== 'undefined' ? y: 0;; this.sprite = G_Player.create(this.x,this.y,'player_stand',frame); OBJECTS.push(this); this.onCreate = function(){ // physics setup code game.camera.follow(this.sprite); game.world.setBounds(0, 0, 1920, 1200); this.sprite.body.collideWorldBounds = true; this.sprite.body.gravity.y = 700; this.sprite.body.setSize(13,30,2,2); this.sprite.body.bounce.x = 0.1; this.sprite.animations.add('stand'); this.sprite.animations.play('walk'); this.jump_height = 400 this.hspeed = 150 this.jumped = true;}this.onUpdate = function(){ // Horizontal Movement this.sprite.body.velocity.x = 0; if(K_ARROWS.right.isDown && !this.sprite.body.touching.right){ this.sprite.body.velocity.x = this.hspeed; } else if(K_ARROWS.left.isDown){ this.sprite.body.velocity.x = -this.hspeed; } if(K_ARROWS.up.isDown && !this.jumped){ this.sprite.body.velocity.y = -this.jump_height; this.jumped = true; } if(this.sprite.body.touching.down)this.jumped = false; if(K_ARROWS.down.isDown){ this.destroy(); }}this.onRender = function(){ game.debug.body(this.sprite,'#7FFFD4');} if(typeof this.onCreate == 'function')this.onCreate() this.update=function(){ if(typeof this.onUpdate == 'function')this.onUpdate() }; this.render=function(){ if(typeof this.onRender == 'function')this.onRender() }; this.destroy=function(){ if(typeof this.onDestroy == 'function')this.onDestroy() delete this }}function Ground(x,y,frame){ this._name='Ground'; this.x=typeof x !== 'undefined' ? x : 0;; this.y=typeof y !== 'undefined' ? y: 0;; this.sprite = G_Ground.create(this.x,this.y,'ground',frame); OBJECTS.push(this); this.onCreate = function(){ game.physics.enable(this.sprite, Phaser.Physics.ARCADE); this.sprite.body.immovable = true;}this.onRender = function(){ game.debug.body(this.sprite,'#7FFFD4');} if(typeof this.onCreate == 'function')this.onCreate() this.update=function(){ if(typeof this.onUpdate == 'function')this.onUpdate() }; this.render=function(){ if(typeof this.onRender == 'function')this.onRender() }; this.destroy=function(){ if(typeof this.onDestroy == 'function')this.onDestroy() delete this }}function Collision_box(x,y,frame){ this._name='Collision_box'; this.x=typeof x !== 'undefined' ? x : 0;; this.y=typeof y !== 'undefined' ? y: 0;; this.sprite = G_Collision_box.create(this.x,this.y,'32x32collisionbox',frame); OBJECTS.push(this); if(typeof this.onCreate == 'function')this.onCreate() this.update=function(){ if(typeof this.onUpdate == 'function')this.onUpdate() }; this.render=function(){ if(typeof this.onRender == 'function')this.onRender() }; this.destroy=function(){ if(typeof this.onDestroy == 'function')this.onDestroy() delete this }}var state0 = { OBJECTS:[], preload: function() {// IMAGES game.load.spritesheet('player_stand','assets/IMAGES/player_stand.png',18,35,1); game.load.spritesheet('player_walk','assets/IMAGES/player_walk.png',18,35,2); game.load.spritesheet('ground','assets/IMAGES/ground.png',33,33,16); game.load.spritesheet('32x32collisionbox','assets/IMAGES/32x32collisionbox.png',32,32,1);}, create: function() { G_Player = game.add.group(); G_Player.z = 0; G_Player.enableBody = true; G_Player.physicsBodyType = Phaser.Physics.ARCADE; G_Ground = game.add.group(); G_Ground.z = 0; G_Ground.enableBody = true; G_Ground.physicsBodyType = Phaser.Physics.ARCADE; G_Collision_box = game.add.group(); G_Collision_box.z = 0; G_Collision_box.enableBody = true; G_Collision_box.physicsBodyType = Phaser.Physics.ARCADE;K_ARROWS = game.input.keyboard.createCursorKeys(); new Ground(0,762,2.0,'ground'); new Ground(33,762,2.0,'ground'); new Ground(64,762,2.0,'ground'); //... and so on... i took this out just to make this clip shorter}, render: function() { for (var i=0; i<OBJECTS.length; i++){ if (typeof OBJECTS[i].render == 'function')OBJECTS[i].render() }}, update: function() {game.physics.arcade.collide(G_Player, G_Ground); for (var i=0; i<OBJECTS.length; i++){ OBJECTS[i].update() }},}game.state.add('state0',state0,false);function create() { game.physics.startSystem(Phaser.Physics.ARCADE); game.state.start('state0', true, true); game.stage.backgroundColor = '#FFFFFF';}function update () { game.world.sort('z', Phaser.Group.SORT_DESCENDING)}function render(){ for (var i=0; i<OBJECTS.length; i++){ if (typeof OBJECTS[i].onDraw == 'function')OBJECTS[i].onDraw() }}