3man7

Members
  • Content Count

    31
  • Joined

  • Last visited


Reputation Activity

  1. Thanks
    3man7 got a reaction from newbie11 in problem about my html game   
    Hi,
    There's just a couple of minor problems with your game. Visit the links below to check the errors.
    index.html = https://www.diffchecker.com/OJDuSSht
    load.js = https://www.diffchecker.com/vtrZJTg9
    menu.js = https://www.diffchecker.com/QKSn5QeI
    play.js = https://www.diffchecker.com/wCfx8nyS
    win.js = https://www.diffchecker.com/dmXpemAh
    I've attached the fixed files in this post.
    Good luck! 
    index.html load.js menu.js play.js win.js
  2. Thanks
    3man7 got a reaction from onlycape in Touch screen problem in Kongregate   
    Hey,
    I haven't had any problems like that so I'm not entirely sure why that happens.
    Try adding: game.input.onDown.remove (this.myfunction, this);
    at the end of the function (this.myfunction)
    If that doesnt work... then
    Try adding: game.input.onUp.add (function(){}, this);
    below game.input.onDown.add (this.myfunction, this);
  3. Like
    3man7 reacted to onlycape in Touch screen problem in Kongregate   
    Hi,
    Thanks for your answer @3man7 . Using OnUp I was not able to fix the problem.
    In the end I found the solution using the monitorEvents() command in the chrome console using the device emulator, to detect the problem.
    Here, the events recorded by a tap on the screen:

    There are two events that I imagine that Phaser interprets as onDown events. (on my server the event 'mousedown' didn't appear).
    Solution:
    //Add the event listener for pointerdown event game.canvas.addEventListener('pointerdown', MyFunction); //For remove the event listener game.canvas.removeEventListener('pointerdown', MyFunction); I hope this saves time for others with the same problem.
    Regards.
  4. Like
    3man7 reacted to casey in changing animation frames of sprite in array   
    Oh crikey. It was simple. 
     
    The line just needed to send from the original array this.empty not "this" ,  so this.empty.events.onInputDown.add(this.changeFrame, this.empty).  Someday I'll grok this whole programming thing
  5. Like
    3man7 got a reaction from samme in buttons: weird behaviour   
    Hey,
    I think the problem is merely the code ordering + omitting specifying default proprieties + confusion.. ?
    Here's how I'd do it:
    Main.Game = function (game) {}; var pressedOne_bool = false; var pressedTwo_bool = false; var pressedThree_bool = false; var arr; Main.Game.prototype = { preload: function () { this.game.load.image('one', 'phone/phone1.png'); this.game.load.image('two', 'phone/phone2.png'); this.game.load.image('three', 'phone/phone3.png'); this.game.load.image('enter', 'images/enter.png'); }, create: function () { this.one = this.game.add.button(100, 100, 'one', this.pressedOne, this); this.one.tint = 0xFFFFFF; this.two = this.game.add.button(200, 100, 'two', this.pressedTwo, this); this.two.tint = 0xFFFFFF; this.three = this.game.add.button(300, 100, 'three', this.pressedThree, this); this.three.tint = 0xFFFFFF; this.arr = [0, 0, 0]; }, pressedOne: function () { switch (pressedOne_bool) { case false: pressedOne_bool = true; this.one.tint = 0xE6E2F4; this.arr[0] = 1; break; case true: pressedOne_bool = false; this.one.tint = 0xFFFFFF; this.arr[0] = 0; break; } }, pressedTwo: function () { switch (pressedTwo_bool) { case false: pressedTwo_bool = true; this.two.tint = 0xE6E2F4; this.arr[1] = 1; break; case true: pressedTwo_bool = false; this.two.tint = 0xFFFFFF; this.arr[1] = 0; break; } }, pressedThree: function () { switch (pressedThree_bool) { case false: pressedThree_bool = true; this.three.tint = 0xE6E2F4; this.arr[2] = 1; break; case true: pressedThree_bool = false; this.three.tint = 0xFFFFFF; this.arr[2] = 0; break; } }, EnterBtn: function () { console.log(this.arr); }, render: function () { game.debug.text("pressedOne_bool: " + pressedOne_bool, 32, 40); game.debug.text("pressedTwo_bool: " + pressedTwo_bool, 32, 60); game.debug.text("pressedThree_bool: " + pressedThree_bool, 32, 80); game.debug.text("arr: " + this.arr, 32, 120); } } The render function will make you see things better - although it has an impact on fps so be sure to remove it whenever you try to get the best out of your project/game.
    Good luck! 
  6. Like
    3man7 reacted to casey in buttons: weird behaviour   
    Thank you, that's helpful. 
  7. Like
    3man7 got a reaction from casey in buttons: weird behaviour   
    Hey,
    I think the problem is merely the code ordering + omitting specifying default proprieties + confusion.. ?
    Here's how I'd do it:
    Main.Game = function (game) {}; var pressedOne_bool = false; var pressedTwo_bool = false; var pressedThree_bool = false; var arr; Main.Game.prototype = { preload: function () { this.game.load.image('one', 'phone/phone1.png'); this.game.load.image('two', 'phone/phone2.png'); this.game.load.image('three', 'phone/phone3.png'); this.game.load.image('enter', 'images/enter.png'); }, create: function () { this.one = this.game.add.button(100, 100, 'one', this.pressedOne, this); this.one.tint = 0xFFFFFF; this.two = this.game.add.button(200, 100, 'two', this.pressedTwo, this); this.two.tint = 0xFFFFFF; this.three = this.game.add.button(300, 100, 'three', this.pressedThree, this); this.three.tint = 0xFFFFFF; this.arr = [0, 0, 0]; }, pressedOne: function () { switch (pressedOne_bool) { case false: pressedOne_bool = true; this.one.tint = 0xE6E2F4; this.arr[0] = 1; break; case true: pressedOne_bool = false; this.one.tint = 0xFFFFFF; this.arr[0] = 0; break; } }, pressedTwo: function () { switch (pressedTwo_bool) { case false: pressedTwo_bool = true; this.two.tint = 0xE6E2F4; this.arr[1] = 1; break; case true: pressedTwo_bool = false; this.two.tint = 0xFFFFFF; this.arr[1] = 0; break; } }, pressedThree: function () { switch (pressedThree_bool) { case false: pressedThree_bool = true; this.three.tint = 0xE6E2F4; this.arr[2] = 1; break; case true: pressedThree_bool = false; this.three.tint = 0xFFFFFF; this.arr[2] = 0; break; } }, EnterBtn: function () { console.log(this.arr); }, render: function () { game.debug.text("pressedOne_bool: " + pressedOne_bool, 32, 40); game.debug.text("pressedTwo_bool: " + pressedTwo_bool, 32, 60); game.debug.text("pressedThree_bool: " + pressedThree_bool, 32, 80); game.debug.text("arr: " + this.arr, 32, 120); } } The render function will make you see things better - although it has an impact on fps so be sure to remove it whenever you try to get the best out of your project/game.
    Good luck! 
  8. Like
    3man7 got a reaction from Fenopiù in Game list of phaser games   
    Hopefully no one minds but I've already posted my game on 'Game Showcase' section and I've wanted to post it here too as this is my first launch on Google Play! 
        Jelly Haven is an action-arcade HTML5 game in which you control a jellyfish going through the space gathering shiny gems and avoid being hit by dangerous obstacles like meteors and rockets. The game gets really fast paced as you purchase upgrades from the store which helps you survive much longer.
    * Translated in 9 languages: English, Russian, French, German, Italian, Spanish, Portuguese, Turkish and Romanian.
    Link to game: http://37dev.ga/jelly
    Quick Gameplay: https://youtu.be/nRIHGlr1X64
    Google Play: https://play.google.com/store/apps/details?id=com.thirtyseven.jellyhaven

  9. Thanks
    3man7 got a reaction from khleug35 in [Solved]How to rotate the object and reverse the image   
    Happy new year! : )
    EDITED:
    //variables var flip = 0; var gun_distX; //update gun_distX = game.input.x - this.gun.x; /* flip = 0 - mouse is on the right side of the gun flip = 1 - mouse is on the left side of the gun */ switch (flip) { case 0: if (gun_distX < 0) { flip = 1; this.gun.scale.y *= -1; } break; case 1: if (gun_distX >= 0) { flip = 0; this.gun.scale.y *= -1; } break; } You basically subtract x position of mouse and gun to get the distance between the two.
    If the value is positive then the mouse is on the right side of the gun and vice versa; flipping the gun accordingly.
    ~~~
    You might work with these too later on, altough the above is enough.
    var gun_distX, gun_distY, gun_angle, gun_degree; gun_distX = game.input.x - this.gun.x; gun_distY = game.input.y - this.gun.y; gun_angle = Math.atan2(gun_distX, gun_distY); gun_degree = gun_angle * 180 / Math.PI;  
    Good luck! 
  10. Like
    3man7 reacted to khleug35 in [Solved]How to rotate the object and reverse the image   
    Thanks!!!! It works!!! thanks 3man7!!!!
    thank you for your help!!! you are awesome, Thanks
  11. Like
    3man7 reacted to DavidPesta in Phaser game Audion MP3 vs WAV vs OGG   
    Good news for everyone who used to be worried about MP3 patents. The last important patent expired on April 16, 2017.
    As a result, the company that owned and enforced the MP3 as intellectual property terminated their licensing program on April 23, 2017:
    https://www.iis.fraunhofer.de/en/ff/amm/prod/audiocodec/audiocodecs/mp3.html
    This means you no longer need to worry about MP3 licensing issues.
    Because of this, Wikimedia now started to host MP3 files on their own websites:
    https://blog.wikimedia.org/2017/12/04/wikimedia-mp3-support/
    Additionally, "Fedora received the permission to ship MP3 encoding from Red Hat Legal.":
    https://opensourceforu.com/2017/05/fedora-linux-add-native-mp3-support/
    With Wikimedia and FOSS able to use MP3s unrestricted, it is now safe for the rest of us, and soon MP3 will become supported by devices and browsers that were once hindered by these patents and we will no longer need to accompany our MP3 files with a redundant version in OGG format.
    Here is another excellent article for further reading:
    https://www.vox.com/culture/2017/5/29/15653564/the-mp3-not-dead-license-expires-free
  12. Like
    3man7 got a reaction from Fenopiù in button mute sound problem   
    @DanielKlava answer is spot on. I don't see why it wouldn't work for you.
    Credit goes to him for answer; I'll just provide the code if that's easier to understand.
    1.
    Delete the '1' at the end to make the default frame 0. (aka unslashed/unmuted sprite). (or change it to 0, same thing).
    this.button = game.add.button(this.posx, this.posy, this.image, this.anim_on_click, this, 0); Frames starts at 0; so you specified the button to go to the next frame (aka slashed/muted sprite) therefore the code skipped the first part.
    2.
    Use a variable instead of checking the current frame of the sprite.
    var mutedYN = 0; _button_stay.prototype.anim_on_click = function () { switch (mutedYN) { case 0: //mute this.audio_click(); music.pause(); music_ambiance_mute(); this.button.frame = 1; break; case 1: //unmute this.audio_click(); music.resume(); music_ambiance_activate(); this.button.frame = 0; break; } mutedYN = mutedYN ? 0 : 1; };  
  13. Thanks
    3man7 got a reaction from DanielKlava in button mute sound problem   
    @DanielKlava answer is spot on. I don't see why it wouldn't work for you.
    Credit goes to him for answer; I'll just provide the code if that's easier to understand.
    1.
    Delete the '1' at the end to make the default frame 0. (aka unslashed/unmuted sprite). (or change it to 0, same thing).
    this.button = game.add.button(this.posx, this.posy, this.image, this.anim_on_click, this, 0); Frames starts at 0; so you specified the button to go to the next frame (aka slashed/muted sprite) therefore the code skipped the first part.
    2.
    Use a variable instead of checking the current frame of the sprite.
    var mutedYN = 0; _button_stay.prototype.anim_on_click = function () { switch (mutedYN) { case 0: //mute this.audio_click(); music.pause(); music_ambiance_mute(); this.button.frame = 1; break; case 1: //unmute this.audio_click(); music.resume(); music_ambiance_activate(); this.button.frame = 0; break; } mutedYN = mutedYN ? 0 : 1; };  
  14. Like
    3man7 reacted to DanielKlava in button mute sound problem   
    Hello espace!
    I think the issue is in the following line:
    this.button=game.add.button(this.posx,this.posy,this.image,this.anim_on_click,this,1); The sixth parameter defines which frame the button will be when you move the cursor over it. Since you are passing "1", Phaser will set the button's frame to 1 in a mouse over event.
    As of now, the result logic is:
    Player moves the cursor over the button; Button's frame is "1", as specified; Player clicks the button; Function "anim_on_click" is called, and since the frame was set to "1", it will always enter in the first condition. One simple solution would be to remove the last argument in your function call, I guess.
    Also, one other way to do it is to, inside your "anim_on_click" function, try to control the state of the button with a boolean variable instead of checking it's frame number, but that's just a suggestion.
    Hope it works!
  15. Like
    3man7 got a reaction from samme in Game list of phaser games   
    Hopefully no one minds but I've already posted my game on 'Game Showcase' section and I've wanted to post it here too as this is my first launch on Google Play! 
        Jelly Haven is an action-arcade HTML5 game in which you control a jellyfish going through the space gathering shiny gems and avoid being hit by dangerous obstacles like meteors and rockets. The game gets really fast paced as you purchase upgrades from the store which helps you survive much longer.
    * Translated in 9 languages: English, Russian, French, German, Italian, Spanish, Portuguese, Turkish and Romanian.
    Link to game: http://37dev.ga/jelly
    Quick Gameplay: https://youtu.be/nRIHGlr1X64
    Google Play: https://play.google.com/store/apps/details?id=com.thirtyseven.jellyhaven

  16. Thanks
    3man7 got a reaction from Yehuda Katz in cannot apply gray filter to sprite   
    The filter option will definitely have an impact on the performance. I would personally apply the filter to the batch of images in Photoshop using 'Action'.
    Here's a good tutorial: youtube.com/watch?v=lcZp2h5WXdA
    Don't forget to backup your original images!
    This method only applies if your sprites will remain grayscale the entire project. If you want to transition from color to grayscale and back on color then I would advice against this method and instead try to find a fix for the code.
    Sorry that I cannot help you enough with the filter code as I haven't used them before.
  17. Like
    3man7 got a reaction from Yehuda Katz in cannot apply gray filter to sprite   
    Well, like @samid737 said, the issue is that you are using CANVAS.
    In the testing I've used Phaser 2.6.2 and Phaser.AUTO.
    I am not entirely sure if there are filters that can be used with CANVAS as they are meant to work with WEBGL only.
     
    Refer to:
    https://github.com/photonstorm/phaser/issues/2223
    http://phaser.io/docs/2.6.2/Phaser.Filter.html
     
  18. Like
    3man7 got a reaction from Yehuda Katz in cannot apply gray filter to sprite   
    I did a quick test and the code works for me.
    Are there any errors on console from your app?
  19. Like
    3man7 got a reaction from Jax in [Phaser] Jelly Haven   
    Hey guys,
    I just wanted to let you know about my first HTML5 game made with Phaser!
    It is an action-arcade game in which you control a jellyfish going through the space gathering shiny gems and avoid being hit by dangerous obstacles like meteors and rockets.
    Link to game: http://37dev.ga/jelly
    Quick Gameplay: https://youtu.be/nRIHGlr1X64



    The game starts off slowly but it gets really fast paced as you purchase upgrades from the store which helps you survive much longer.
    Endless fun game with great performance. Optimized for mobile devices but fully playable in desktop as well. Audio support for all mobile operating systems. Easily localized as the texts are stored in a .json file. Saving/loading game with cookies system. Translated in 9 languages: English, Russian, French, German, Italian, Spanish, Portuguese, Turkish and Romanian.  
    The game is currently looking for sponsorship and has not yet been published before.
    Let me know what you guys think!
    Enjoy!
  20. Like
    3man7 got a reaction from rich in [Phaser] Jelly Haven   
    Hey guys,
    I just wanted to let you know about my first HTML5 game made with Phaser!
    It is an action-arcade game in which you control a jellyfish going through the space gathering shiny gems and avoid being hit by dangerous obstacles like meteors and rockets.
    Link to game: http://37dev.ga/jelly
    Quick Gameplay: https://youtu.be/nRIHGlr1X64



    The game starts off slowly but it gets really fast paced as you purchase upgrades from the store which helps you survive much longer.
    Endless fun game with great performance. Optimized for mobile devices but fully playable in desktop as well. Audio support for all mobile operating systems. Easily localized as the texts are stored in a .json file. Saving/loading game with cookies system. Translated in 9 languages: English, Russian, French, German, Italian, Spanish, Portuguese, Turkish and Romanian.  
    The game is currently looking for sponsorship and has not yet been published before.
    Let me know what you guys think!
    Enjoy!
  21. Like
    3man7 got a reaction from PhasedEvolution in [Phaser] Jelly Haven   
    Hey guys,
    I just wanted to let you know about my first HTML5 game made with Phaser!
    It is an action-arcade game in which you control a jellyfish going through the space gathering shiny gems and avoid being hit by dangerous obstacles like meteors and rockets.
    Link to game: http://37dev.ga/jelly
    Quick Gameplay: https://youtu.be/nRIHGlr1X64



    The game starts off slowly but it gets really fast paced as you purchase upgrades from the store which helps you survive much longer.
    Endless fun game with great performance. Optimized for mobile devices but fully playable in desktop as well. Audio support for all mobile operating systems. Easily localized as the texts are stored in a .json file. Saving/loading game with cookies system. Translated in 9 languages: English, Russian, French, German, Italian, Spanish, Portuguese, Turkish and Romanian.  
    The game is currently looking for sponsorship and has not yet been published before.
    Let me know what you guys think!
    Enjoy!
  22. Like
    3man7 reacted to samid737 in Tween problems / onComplete   
    q1:
    they are in your case not the same. You are chaining methods here, but the assigned variable will be different. here is a reference about chaining your methods. The error in your case is because your smiley_tw becomes A signal when it is chained, not A tween. A simplified example of what is kind of happening:
    //a car class var car= function(){ this.brand=''; this.model=''; } //set the brand of the car car.prototype.setBrand=function(brand){ this.brand=brand; return this; } //set the model of the car car.prototype.setModel=function(model){ this.model=model; return this; } //drive the car car.prototype.drive=function(){ console.log("wroom im driving my beautiful "+this.brand+" "+this.model); return this; } //this works,but here you are not chaining the methods: var myCar=new car(); myCar.setBrand('fiat'); myCar.setModel('multipla'); myCar.drive(); //in one line via chaining: var myCar = new car().setBrand('nissan'); console.log(myCar);//this object has only a brand var myCar2 = new car().setBrand('nissan').setModel('skyline').drive(); console.log(myCar2);//this object is all inclusive. //myCar is not the same as myCar2  
    q2:
    The reason why you are getting an undefined error is because you have never defined your tween when you press pause the game initially via the button. The  smiley_tw_pass prevents resuming/pausing within the timer function. If I understand you correctly, you want to start yourtween after 3 seconds, but if the game is paused (via the button) it should pause everything, including the tween timeout. In your case you can add the tween in create() and pause it there. 
    The not a function error is occuring because you are trying to  start() a signal object (the smiley_tw becomes a signal object, not a tween), see example  below to inspect properties via console logs.
    You can probably find a better way to code by looking at the properties/methods of your timer .The timer for example can be paused via the paused flag:
    var game = new Phaser.Game(800,600, Phaser.CANVAS, 'My CV',); var Test = function (game) {}; var mygamepaused = false; var smiley_tw_pass = false; Test.prototype = { preload: function(){ this.load.baseURL = "//examples.phaser.io/"; this.load.crossOrigin = "anonymous"; this.load.image("smiley", "assets/sprites/block.png"); }, create: function () { //create button this.mybutton = game.add.button(this.world.centerX, 600, 'smiley', this.myfunction, this); this.mybutton.anchor.setTo(.5); this.mybutton.scale.setTo(.2); this.mybutton.inputEnabled = true; //create smiley this.smiley = game.add.sprite(this.world.centerX, this.world.centerY, 'smiley'); this.smiley.anchor.setTo(.5); this.smiley.scale.setTo(.5); //this will not work: //miley_tw = game.add.tween(this.smiley).to({alpha: 0},1200, "Linear", false).onComplete.add(function () {this.smiley.y = 100;this.smiley.alpha = 0.1;}, this); //console.log(smiley_tw);//a signal, not a tween //smiley_tw.start(); //smiley_tw.pause(); //smiley_tw.onComplete.add(function () {this.smiley.y = 100;this.smiley.alpha = 0.1;}, this); //this will work: smiley_tw = game.add.tween(this.smiley).to({alpha: 0},1200, "Linear", false); console.log(smiley_tw);//a tween object smiley_tw.start(); smiley_tw.pause(); smiley_tw.onComplete.add(function () {this.smiley.y = 100;this.smiley.alpha = 0.1;}, this); //create mytimepass mytimepass = game.time.create(false); mytimepass.add(3000, function () { smiley_tw.resume(); }); mytimepass.start(); }, myfunction: function () { mytimepass.paused=mytimepass.paused?false:true; }, render: function () { game.debug.text('mygamepaused: ' + mygamepaused, 20, 20); game.debug.text('smiley_tw_pass: ' + smiley_tw_pass, 20, 40); game.debug.text('mytimepass: ' + mytimepass.duration.toFixed(0), 20, 80); } }; game.state.add("test",Test); game.state.start("test");  
  23. Like
    3man7 reacted to samme in Tween problems / onComplete   
    Can you explain what you want to happen? I think there's an easier way to code it, but I can't follow it yet.
  24. Like
    3man7 got a reaction from samid737 in 'Kill' and 'Revive' sprites individually in a Group   
    @samid737
    Ooohh yeah I get it, that makes sense now. Thanks for the explanation!
    It works great now, assigning a property did the job.
    Thank you both very much for your help!
  25. Like
    3man7 reacted to samid737 in 'Kill' and 'Revive' sprites individually in a Group   
    The sprites created within the for loops are all exactly the same objects when you are adding them to the group:
    e_blue = enemy_wave.create(40 + 40 * j, 40 + 40 * i, 'object'); e_red = enemy_wave.create(40 + 40 * j, 40 + 40 * i, 'object'); console.log(e_blue);//exact same object, with same properties and values console.log(e_red); //exact same object, with same properties and values When you use the enemy_wave.forEach and are meaning to refer to a blue enemy, you are still saying:
    foreach object-which I will name e_blue within this function- in enemy_wave-->kill e_blue. Javascript will do as told and kill every e_blue in the enemy_wave group. As a result all your objects are killed in the process... very sad indeed.
    You could add some (custom) property to distinguish red enemies from blue ones in enemy_wave:
    var e_blue = enemy_wave.create(40 + 40 * j, 40 + 40 * i, 'object'); e_blue.tint=0x000fff; e_blue.unitColor=0; enemy_wave.add(e_blue); var e_red = enemy_wave.create(40 + 40 * j, 40 + 40 * i, 'object'); e_red.tint=0xff0000; e_red.unitColor=1; enemy_wave.add(e_red); and then say this:
    enemy_wave.forEachAlive(function (enemy) { if(enemy.unitColor==0){ enemy.kill(); } }, this);