AdamRyanGameDev

Members
  • Content Count

    54
  • Joined

  • Last visited

Everything posted by AdamRyanGameDev

  1. Found this and was curious if it-d be Phas3r or not.... unfortunately this doesn't state that it is actually Phas3r... but yeah it is! Anyways posting because there are not that many video tutorials out there
  2. Var & Let Please be aware of Var; being function scoped and for example that it can be 'hoisted'. Depending on your programming background Let; may be more intuitive for many/most situations.
  3. Thanks samme! My bad,.... seems to work fine in the labs now. Maybe I was loading too little... apologies!
  4. I am trying to implement a simple loader with scenes set up with the constructor, as so from the labs.io class MyScene extends Phaser.Scene { constructor (config) { super(config); } preload () { var progress = this.add.graphics(); this.load.on('progress', function (value) { progress.clear(); progress.fillStyle(0xffffff, 1); progress.fillRect(0, 270, 800 * value, 60); }); this.load.on('complete', function () { progress.destroy(); }); this.load.image('face', 'assets/pics/bw-face.png'); } create () { this.face = this.add.image(400, 300, 'face'); } } var config = { type: Phaser.WEBGL, width: 800, height: 600, backgroundColor: '#000000', parent: 'phaser-example', scene: MyScene }; var game = new Phaser.Game(config); Which is basically a cut and paste from the following 2 labs... http://labs.phaser.io/edit.html?src=src\scenes\scene from es6 class.js http://labs.phaser.io/edit.html?src=src\loader\load progress.js How do i get the progress bar? I know that the progress is function is called because I have console logged as it goes from 0.0 to 1.0, but I am having trouble accessing the screen in the preload, (this includes attempts to place a gif and to place text), clearly my Es6 classes knowledge is the problem here, what can i do? Where am I going wrong?
  5. Yeah I wondered the same thing and I had tried rearranging the order. It changed nothing. (that-s why I put my sprite covering half of the scroling text). Thanks @snowbillr all the same! The behaviour is a little erratic because while the text is visible when depth <=0 and not visible above depth> 0 in my example... ..however..if I make the other sprite on the screen visible=0 then the text stays visible at any depth.
  6. The plot thickens... is this a bug? I made a page exactly as follows It is basically a smaller png and bitmap text sharing a x,y and with and a log on an changing depth.. <!doctype html> <html lang="en"> <head> <meta charset="UTF-8" /> <title>My Tester</title> <script src="//cdn.jsdelivr.net/npm/phaser@3.1.1/dist/phaser.js"></script> <style type="text/css"> body { margin: 0; } </style> </head> <body> <script type="text/javascript"> var config = { type: Phaser.AUTO, width: 800, height: 600, scene: { preload: preload, create: create, update: update } }; var game = new Phaser.Game(config); var scroller; var scrollerContent = ['line1','line2','line3']; var spriteSCROLLERs1; var text0s1; function preload () { this.load.bitmapFont('desyrel', 'media/desyrel.png', 'media/desyrel.xml'); this.load.image('spriteSCROLLERs1', 'media/beigeboard.png'); } function create () { scroller = this.add.dynamicBitmapText(200, 200,'desyrel', scrollerContent, 55); scroller.setSize(200,200); scroller.depth = -2000; spriteSCROLLERs1 = this.add.image(200, 200, 'spriteSCROLLERs1'); spriteSCROLLERs1.displayWidth = 100.0; spriteSCROLLERs1.displayHeight = 100.0; spriteSCROLLERs1.setDepth = 1000; } function update (time, delta) { scroller.scrollY += 0.03 * delta; scroller.depth += 0.05 * delta; console.log(scroller.depth); if (scroller.depth > 2000) { scroller.depth = -2000; } if (scroller.scrollY > 300) { scroller.scrollY = 0; } } </script> </body> </html> What is interesting/strange is that the bitmap text is only visible with depth <=0 and that at NO point will it overlap the png. It always goes 'under' Is this desired behaviour? How do I get bitmap text visible on any thing (but the phaser container)????
  7. I am trying to debug a problem with dynamicBitmapText The code was pretty much lifted out of phaser labs.io in preload() this.load.bitmapFont('robotoBitmap', 'media/roboto.png','media/roboto.fnt'); in create() scroller = this.add.dynamicBitmapText(200, 200,'robotoBitmap', scrollerContent, 18); scroller.setSize(200,200); in update(time,delta) scroller.scrollY += 0.03 * delta; if (scroller.scrollY > 200) { console.log('called!'); scroller.scrollY = 0; } global vars var scroller; var scrollerContent = ['line1','line2','line3']; I have entered the scene it is happening and with the console (chrome) i have inspected the "var scroller." Depth, Alpha, Visible, valid xy pos, xy height all fine, the content is there and the png and fnt files are not empty! I have put a console.log in the middle of the only update loop it is calling... if (scroller.scrollY > 200) { console.log('called!'); scroller.scrollY = 0; } and the console is logging 'called' every few seconds. What/Where to do/go next? Any ideas much appreciated!
  8. UPDATE: i tried just for double sure both the following lines let timedEvent = this.time.delayedCall(3000, stopRotation, ['atlasFrame'], this); let timedEvent = this.time.delayedCall(3000, stopRotation, [atlasFrame], this); As per code in OQ, but in both cases it stops ALL rotations, not just the nameString/object passed to it... [which should be passed?]
  9. Thx Rich! I tried that in the labs but it didnt work hmmm I will have another look! Prob did something stupid! Thx again!
  10. Probably more of an issue with my js knowledge but how can I pass a parameter, for example here one of the sprites? (edited version of the lab, https://labs.phaser.io/edit.html?src=src\time\timer event.js ) function update() { atlasFrame.rotation += 0.01; singleImage.rotation += 0.01; let timedEvent = this.time.delayedCall(3000, stopRotation, [], this); } function stopRotation(spriteName){ let spriteNamehere = spriteName; window[spriteNamehere].rotation=0; }
  11. Have you considered functions that sit (globally) outside of preload/create/update? Or have i misunderstood?
  12. https://github.com/photonstorm/phaser There are the docs inside. Download and browse offline... See also this chat Mentions github and the sandbox lab
  13. I am having some problems with a game where players enter safe and danger zones... some of these areas have sprites that are angled (rotated) but appear to fire collision when the 'character' sprite collides with their total X Y rectangle space (ie minXpoint to maxXpoint, minYpoint to maxYpoint)[imagine an angled rectangle pushing out its boundaries by its 4 corners] would this be right? Or am I having other issues? TO counter act i guess I will have to create n number of collision boxes (sides parallel to X-Y axe) overlapping along angleX.
  14. Thanks! ha ha you should mention it plays audio... scared the pants off me! Anyways off to have a look.
  15. Check out this video in phaser news https://phaser.io/news/2018/03/gamefromscratch-phaser-3-video And this tutorial from phaser.io https://phaser.io/tutorials/making-your-first-phaser-3-game Good luck and enjoy!
  16. I am wondering how to create a title/loading scene, ideally with.... A % downloaded progress bar B that also if possible preloads all assets for all scenes if possible? Any ideas/examples?
  17. Good news: My modest mini games' attempts haven't provoked any problems so far on mobile... Design issue: How do others handle the physical world problems... namely movement across a desktop screen will appear faster than movement across a smaller screen (even though obviously they are traversing the same %value of the game screen)? How do you more experienced guys handle outputting to large and small screens?
  18. Thanks Rich! I will have to be careful because I normally use a modular code base divide into small reusable functions that generate my code server side (so order of event handlers is not always guaranteed...)
  19. I have stared in the face of madness with this little problem, converting some old games from a different engine I used phases to space out calls, but I hadn-t realised this wouldn-t work with the underlying js... eg I had a function with pointerdown that reset which sprite was selected input.on('pointerdown', function... following calling that function I LATER call a second function on pointerdown which relied on getting a possible new sprite selection (but the two functions couldnt be merged for technical purposes) input.on('pointerdown', function It didnt work well, it seemed the code was a click 'behind' , I tore my hair out, I drank coffee until i started itching all over, then i realised this was mitigated by a double click... ah ha! I simply made the second function pointerup. input.on('pointerdown', function... input.on('pointerup', function... Ok it isnt essential for me right now, but I would like to know how i could guarantee that two event driven functions are called in a certain order, is it possible? I appreciate this was probably javascript ignorance!
  20. I would like to make a group interactive. The following did not work groupOfZombies.setInteractive(); Then just to add the resulting code to discover which sprite was clicked needs to me access the sprite-key, i have been looking for it but I can't seem to find it (mainly because most code functions using 'this') spriteCat2.setInteractive(); spriteCat2.on('pointerdown', function () { var thisSpriteName = this.key; console.log(thisSpriteName); }); any help would be appreciated!
  21. Ok, maybe my inexperience with developing games in html is at fault here, the warning is a general Browser Versus Js warning, not phaser3 related. If anyone in the future is interested one link to start looking at could be on StackO https://stackoverflow.com/questions/41218507/violation-long-running-javascript-task-took-xx-ms/41218580 Ciao!
  22. I have been getting this warning in my console.log, but I am not exactly sure how to interpret it... does it mean I am overloading the 'load' handler (btw, what-s that?). Is it a serious warning or just a FYI warning?
  23. And the labs with working examples to phaser3Fiddle with.... https://labs.phaser.io/index.html?dir=
  24. Yeah! I got to the platformer part!