lpbr

Members
  • Content Count

    26
  • Joined

  • Last visited

Everything posted by lpbr

  1. YEAHHHHHHHHHHHHHHHHH! Mickety, thanks again for your generous contribution! It was very easy indeed. I tried to enter my router by I couldn't because the frakking cable guy that came to install and configure my ISP service supposedly changed the password. But then I used the 'ipconfig' Windows at the command prompt and I quickly retrieved my local IP that in this case is 192.168.0.103 (IPv4). Then I did as you said and typed in the very same IP either on my Android mobile and my iPhone and they just found my localhost instantly.
  2. Thank you for answering Mickety! I am a bit confused on how to share my localhost on my wi-fi network. I work in home and here we have a router that broadcast Internet signal around through wi-fi. I use a desktop PC as my development computer and it has a wi-fi adapter hooked on one of the USBs. As you may suppose the localhost is running on THIS computer. How could I broadcast it making it visible to the other equipments? Thanks!
  3. Hello my friends! I am working on a simple game for kids that consists on a screen with objects that will produce sounds when they click or tap it. OK, I already made all needed adjustments to make it work well either on desktop computer browser as well on Android mobiles. For testing it on Android I used the debug mode of Chrome keeping an Android mobile hooked to the computer through an USB cable, then I could run it directly from my localhost (PC with Windows 7) that is very convenient: just change the code, save it and refresh the page. To make it happen I had to activate the 'developer mode' on my Android mobiles. Now it's time to tweak it to make it work on iOS platform also. I have two iOS gadgets (an iPhone 4 and an iPad 2) but I do NOT have a Mac. Now, how could I hook the iOS mobiles to my PC in a similar way I did to Androids in order to make my tests? I am afraid that there is NOT a way of doing this and that I will have to test my code with the exhaustive task of upload files to a live host and then load it back to the iPhone/iPad through Internet — that is very boring and time consuming. Please any input will be very welcome!
  4. Maybe it's a silly question. I am applying alpha to an image and in the line immediately after I alert a message on screen. The problem is that the alpha is being shown up only after the alert popup be closed. There is a method that I can invoke to force screen to update BEFORE the alert? Thanks!
  5. Sure... Perhaps I didn't express myself correctly – I didn't mean that the MOBILE crashes at all. What I meant is that this method of setting a var with the config parameters and then apply it to the Phaser.Game(config); was crashing the Phaser core on my two mobiles. I don't know why it happened but it definitively did... Anyway, it was with the oplayer example. With your example it seems to be working fine though. HOWEVER, to have it fully functional I had to change renderer: Phaser.AUTO to renderer: Phaser.CANVAS otherwise debugger will throw the following error: WebGL: INVALID_VALUE: vertexAttribPointer: index out of range phaser.min.js:3 WebGL: too many errors, no more errors will be reported to the console for this context. Nonetheless the application still works and mobile doesn't complain. I have no idea what it is. Thanks for the help!
  6. Thank you, rich, I will check and see if it does work on my mobiles without to crash them.
  7. Oh, I see... so even the oplayer example is all wrong then. Thank you! PS: I am still learning Phaser and there is not a bunch of specific Ph3 examples online. Since I have used the existing examples, certainly it's all Ph2 stuff!
  8. But I am using the latest Phaser build. Can I be using Phaser 3.x build and yet coding in 2.x? This is really confusing and weird!
  9. This is really a very nice approach but unfortunately if didn't work. I just tried it and: On PC = Works perfectly with no errors. However when I tried it on two of my Android mobiles... On Android Marshmallow = Pops a generic error alert and on Debugger I get "WebGL: INVALID_VALUE: vertexAttribPointer: index out of range" On Lollipop = Just freezes and on Debugger I get a "Uncaught SyntaxError: Unexpected identifier" in the line 2 (width etc). Man, working with mobile device is really a nightmare!
  10. I have this game with a salmon background color. I can set the background to the proper color into the create function with: game.stage.backgroundColor = '#f3cca3'; The problem is that it takes a little while preloading the images and sounds and so it stays black in the meantime. I tried: var game = new Phaser.Game(window.innerWidth, window.innerHeight, Phaser.CANVAS, 'meems_house', { preload: preload, create: create }); game.stage.backgroundColor = '#f3cca3'; But then it says 'Cannot set property 'backgroundColor' of null' indicating that it didn't find 'game' — however it doesn't make any sense because 'game' is NOT null as it was created one line above... PS: The only thing I can imagine is that although object 'game' was declared it was not properly instantiated yet because it's gonna happen into the create function — but this is still weird to me. Anyway I would like to know if there is a way to set the canvas background color before the create function... Thanks!
  11. lpbr

    Cannot STOP sounds...

    I figured the cause of the problem. I used the onStop event to loop the sound so when it stopped (finished to play) it started again. Of course when I was clicking to force stop it fired the event and restarted the sound. I should use onLoop instead.
  12. I have an array with a list of sounds and then I loop barely like this to add them to the game: for (var i=0;i<=aSounds.length-1;i++) window[aSounds[i].name+'_snd'] = game.add.audio(aSounds[i].name); To play the sound at the desired points of my code I just do: window[me.name+'_snd'].play() // works fine However I am not managing to STOP the sound with: window[me.name+'_snd'].stop(); // instead to stop the sound it just restarts What am I doing wrong? Thanks!
  13. Hey samme, good morning! I just made a quick test and it seems to have worked... The click spot area seems to be matching my pictures now. I just hope to not have more weird "surprises" like that. I will make more tests later today as I have a bunch of spot areas like that one. Thanks a lot for now, my friend!
  14. I was posting this thread at the wrong place (it was in Phaser 2). OK, I am having a very bad time with clickable objects. It works perfectly on desktop browser but when I run it on my Android mobile the hot spot is totally off. Please refer to the attached picture to have an idea what I am talking about. The blue square is the clickable object (it's a .png picture). Tapping the object won't fire the input event but if I tap around the position where I draw the marquee it will. In other words, the clickable area is off of the picture. I found this thread where the OP had a similar issue and mentioned that is could be related to the mobile devicePixelRatio when using Phaser.CANVAS but I couldn't establish a coherent relationship between the DPR and the displacement (otherwise it could be "compensated" with code). I really cannot see how to solve this. I am about to give up Phaser and try a different engine. Any idea?
  15. OK, this is weird. I spent a lot of time trying to figure out why my image objects wasn't firing when I tapped on it (it works on desktop). After several tests I noticed that it happened that on mobile screen the clickable area was off of the image (displaced). I found that someone had a similar issue and figured that it had something to do with devicepixelratio when using Phaser.CANVAS. I couldn't test with Phaser.AUTO because my mobile throws a WebGL error when I try to use it. Any idea how to fix this issue? Thanks!
  16. Thanks, I will check this out. Now I am running into another issue that may be related to. Since I didn't know about TexturePacker I had the "ingenuous" idea (LoL!) of chop my sprite sheet into two different halves (first half of frames on one and the second half of frames on another). Basically I made two animations and used onLoop event of the first one to trigger the second, I think you got the picture. Ok, it worked on my computer but then when I tried on an actual mobile (my Samsung J2) I just got a big black screen. Not nice. Anyway when I commented the lines of code that added the animations to the stage the code worked, so I am sure that the problem is there. After you mention the TexturePacker I am almost sure that this approach (using too wide sprite sheets) may be a real problem maker. Anyway, back to the square one. Let's check the TexturePacker stuff!
  17. Hi, I have a sprite sheet with 9694 pixels width that I can NOT make it narrower because it has 74 frames with 131 pixels each. However it is blowing WebGL (see snapshot with the error attached)... How could I solve this issue?
  18. lpbr

    Android won't play MP3

    Never mind... after a LOT of research and more tests I figured that it's a Chrome bug. It works perfectly on Opera. One whole day of work lost thanks to a stupid browser that doesn't work as it should.
  19. I just ran into another issue with Phaser and I'd like to know if it's a known bug – and of course if there is a solution! I am trying to play sounds (mp3) with no success. The sound plays fine on my computer using Windows browser but the same code won't produce any sound on Opera Mobile Emulator or on my actual mobile (Samsung J2). I didn't try 'ogg' format because I searched online and found other people with the same problem and that have actually tried with no success. After several frustrated tests with my own code I tried the following Phaser examples: https://phaser.io/examples/v2/audio/loop https://phaser.io/examples/v2/audio/play-music Guess what... same issue: works on computer but not on Opera Emulator neither my mobile. Since I am writing this code specifically for mobiles this is a MUST for me that sounds play on them. Any clue? Below my code... var game = new Phaser.Game(window.innerWidth, window.innerHeight, Phaser.AUTO, 'test', { preload: preload, create: create }); var aExtensions = [ ]; var aExtensions = ['.png','.mp3']; var aTypes = ['img','snd']; var aAssets = ['door','knock']; function preload() { game.load.image(aAssets[0],aTypes[0]+'/'+aAssets[0]+aExtensions[0]); game.load.audio(aAssets[1],aTypes[1]+'/'+aAssets[1]+aExtensions[1]); } function create() { var gamegroup = game.add.group(); gamegroup.inputEnableChildren = true; window[aAssets[0]] = gamegroup.create(0,0, aAssets[0]); window[aAssets[1]+'snd']= game.add.audio(aAssets[1]); window[aAssets[0]].inputEnabled = true; window['lst'+aAssets[0]] = function (me) { knocksnd.play(); me.visible = false; } window[aAssets[0]].events.onInputUp.add(window['lst'+aAssets[0]], this); } Thanks!
  20. Thank you very much, samme! "onInputUp" did the trick!
  21. I have this simple game for small children that consists on several images that when tapped should produce a sound. I got it working on the computer (mouse click) but not on mobiles (finger tap) and I suspect that's because I am listening to the wrong event. Could someone tell me how to listen to a image "tap"? My current working code for computers is: // I am adding the functions and listeners dynamically with a // loop so aAssets is an array containing the image elements // enable input window[aAssets[i]].inputEnabled = true; // create the function to be triggered by the listener window['lst'+aAssets[i]] = function (me) { alert (me.key); } // add the respective listener window[aAssets[i]].events.onInputDown.add(window['lst'+aAssets[i]], this); PS: I found the events "onDown" and "onTap" and tried them but both causes an error when added. Thanks!
  22. Thanks a lot Garlov... group the assets did the trick!
  23. There is a way to move the game stage or it's permanently locked to 0,0? I would like to be able to set its x,y like this... var game = new Phaser.Game(window.innerWidth, window.innerHeight, Phaser.AUTO, 'test', { preload: preload, create: create }); game.x = 10; game.y = 10; Is this possible? PS: I tested the above and obviously it didn't work. I checked documentation and see that there is no x,y properties available for Game class but I was wondering if there is any hack. I can recalculate all my assets coordinates to achieve the result but it would be too much simpler if I could just move the game stage around... Thanks!
  24. Thank you Harry for the links, but really not what I am after. All the texts examples are about make fancy text but no one of them show how to create a text that may be dynamically changed. I am starting to think that it may not be done? About JCreate, yeah, it is a GREAT stuff and I already have worked with it in the past. Unfortunately I am working right now on a project that came half done to my hands and the customer wants it in pure JS so I am not allowed to use 3rd party packages. Anyway, at the end I found a workaround for the problem. As I supposed (sorry if I look stupid, but there is a lot of time I don't do HTML5) the fillText method just 'paints' over the canvas, then that's why it cannot be edited. My bad not to have noticed it before. To fix the issue, and since I cannot use JCreate and other awesome packages, I just adjusted the game screen by stacking divs and putting the texts within them. Maybe not the ideal solution but it worked fine.