Jump to content

vmars316

Members
  • Posts

    435
  • Joined

  • Last visited

Everything posted by vmars316

  1. Hello & Thanks : The full game is here: 1) http://vmars.us/javascript/BenghaziGame.html 550 statements. I have stripped it down to 450 statements here: 2) http://vmars.us/javascript/Hillary-Only-Phone.html . I stripped it down to debug "why it doesn't run properly on a phone" . Both run fine in PC browser . 1) runs on phone , but images get screwed up (on collisions) , often appearing on screen bottom . Game uses interval code , not requestAnnmation . 2) runs on phone , but stops dead on collisions . Game uses requestAnnmation code . Any ideas what I am doing wrong ? Thanks
  2. Foxy Mod ; I still working on your suggestions: You have quite a lot of messy code. Just replace this: With this: It's more readable and more efficient. I am hung up on how to turn tru01 into a function: I tried a few things , like this: But I keep getting this type of error: Uncaught TypeError: tru01.update is not a function I need some help . Thanks
  3. Foxy Mod , Ah , much better : liesandcowpies.com/javascript/measureTimestamp.html Thank You very much !
  4. Thanks All , Ah , finally , I get it . I misread And thought I must use 'timestamp' in some way , until I started tinkering with the code above , turning it into this : This works as intended , except for the 1st loopDuration which reports as '2454857.5550000095' . I am curious why that happens . It seems that loopDuration runs between 16.xxx to 32.xxx . Also , there is a 1 ==> 2 second delay for this to happen : window.location.reload(); Another anomaly (to me) is that when I run code online : It runs fine except that when it encounters if (loopCount > 399) { stopMe(); window.location.reload(); } It goes into a loop . And I have to use TaskManager to shut it down . Thanks
  5. Thanks , but I don't understand : Is 'TIMESTAMP' a js reserved word or function . I am having trouble to piece it all together . I decided to make rAF a separate issue : And then come back to the other code problems you mentioned above . Thanks
  6. Hello & Thanks , From topic : http://w3schools.invisionzone.com/index.php?showtopic=55453#entry304554 I have lots of questions about requestAnimationFrame So I decided to make this question a separate issue : The code size is trimmed way down from the actual running game , to make it easy to follow . Here is the updated function to start and stop animation : How come the 'stop' function doesn't work ? And here is the game loop : Also : Here are my ?s : How come the 'stop' function doesn't work ? Why is it so slow ? I have tried several speeds , but always , soooo slow . And this really puzzles me : I can increase the speed by simply clicking the 'start' button repeatedly . Though , I suppose I could add another 'start' button and call it 'Increase Speed' button I would rather use the methods (timestamp & performance.now) here : and here : But I can't piece it all together , to make it work . I would like some help with this also . Thanks
  7. Thanks , In the info above , they mention a 'timestamp' . Is timestamp absolutely necessary . Here http://bencentra.com/canvas/canvas2.html He has an example without any timestamp . Is there a default value involved ?
  8. Actually , I am searching for Posts that contain 'requestAnimationFrame' . Just curious , why do people show code all on one line ? To me it is downright unpleasant , to have to copy/paste , then edit code into one statement per line . Or is there a way to unravel code into multilines , that I don't know about ? Thanks
  9. This may not be timely , but here is site of many .js metronomes , http://www.metronomebot.com/talking-metronome-in-four.html
  10. Hello & Thanks , Can someone aim me at a w3schools how to "requestAnimationFrame()" ? I can't seem to find one . Thanks
  11. Thanks Ingolme I see I have lots more work to do . Should keep me busy for a while . Thanks again .
  12. Hello & Thanks , I am having trouble with my phone version of BenghaziGame . My viewport : <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/> Also , I changed the camvas dimensions from this: <canvas id="canvas" width="800" height="550" style="background-color:#992D2D"></canvas> to this: <canvas id="canvas" width="360" height="400" style="background-color:#992D2D"></canvas> And it looks like I'll need to adjust a bunch of other stuff to make it visually acceptable . Running the program on desktop , it all runs fine . But running same code on phone , the collision detection doesn't work , and the prog runs very , very slow . I could use some recommendations on what can I tweak to improve phone I am running it on my Lumia 640 windows phone . http://liesandcowpies.com/ gives options to run on phone or desktop . Thanks
  13. Hello & Thanks , A javascript Tutorial for BenghaziGame : I just wanted to let you know that I have written a javascript tutorial for my BenghaziGame , and to thank all you folks on this Forum who have helped me to convert this game to javascript . Benghazi Game is a shoot 'em up political satire browser game . But instead of bullets , we throw cowpies at politicians when we see them lying . How do we know when they are lying ? When their noses turn into long carrot noses , they are lying . The Tutorial game begins here : http://liesandcowpies.com/javascript/BenghaziGame.00-TUTORIAL.html I have also posted the whole Tutorial for download here : http://liesandcowpies.com/javascript/BenghaziGame-TUTORIALS.zip My disclaimer: I am going to let w3schools.com do most of the heavy lifting , and use their GameTutorial resources to do the explaining on specific keywords . Here is a list of their web pages that we will be using: http://www.w3schools.com/games/ http://www.w3schools.com/games/game_canvas.asp http://www.w3schools.com/games/game_components.asp http://www.w3schools.com/games/game_controllers.asp http://www.w3schools.com/games/game_obstacles.asp http://www.w3schools.com/games/game_score.asp http://www.w3schools.com/games/game_images.asp http://www.w3schools.com/games/game_sound.asp and more as the need arises . Thanks...Vern
  14. Hello & Thanks , A javascript Tutorial for BenghaziGame : I just wanted to let you know that I have written a javascript tutorial for my BenghaziGame , and to thank all you folks on this Forum who have helped me to convert this game to javascript . Benghazi Game is a shoot 'em up political satire browser game . But instead of bullets , we throw cowpies at politicians when we see them lying . How do we know when they are lying ? When their noses turn into long carrot noses , they are lying . The Tutorial game begins here : http://liesandcowpies.com/javascript/BenghaziGame.00-TUTORIAL.html I have also posted the whole Tutorial for download here : http://liesandcowpies.com/javascript/BenghaziGame-TUTORIALS.zip My disclaimer: I am going to let w3schools.com do most of the heavy lifting , and use their GameTutorial resources to do the explaining on specific keywords . Here is a list of their web pages that we will be using: http://www.w3schools.com/games/ http://www.w3schools.com/games/game_canvas.asp http://www.w3schools.com/games/game_components.asp http://www.w3schools.com/games/game_controllers.asp http://www.w3schools.com/games/game_obstacles.asp http://www.w3schools.com/games/game_score.asp http://www.w3schools.com/games/game_images.asp http://www.w3schools.com/games/game_sound.asp and more as the need arises . Thanks...Vern
  15. Ah , perfect , Thanks Don I knew it would be something simple , just couldn't see it ...Vern
  16. Hello & Thanks ; I am having trouble with my http://liesandcowpies.com/javascript/BenghaziGame.html Javascrtip and html are all one file : Prob: all buttons work fine, except for <button onmousedown="touchRightArrow" . the onmouseup="touchEndRight()" works fine . But I havent been able to figure out why <button onmousedown="touchRightArrow" isn't working . I need a new set of eyes to help me . I am happy to Post all code if necessary , but its 557 lines . <div id="canvasDiv" align="center" > <canvas id="canvas" width="800" height="550" style="background-color:#992D2D"></canvas> <br> <button onclick="myGameArea.pause()" ontouchstart="myGameArea.pause()" >Pause</button> <button onclick="myGameArea.play()" ontouchstart="myGameArea.play()" >Play</button> ___ <button onmousedown="touchLeftArrow()" onmouseup="touchEndLeft()" ontouchstart="touchLeftArrow()" ontouchend="touchEndLeft()">MoveLeft</button> _ <button onclick="touchUpArrow()" ontouchstart="touchUpArrow()">Throw</button> _ <button onmousedown="touchRightArrow" onmouseup="touchEndRight()" ontouchstart="touchRightArrow" ontouchend="touchEndRight()">MoveRight</button> ___ <button onclick="clearIt()" ontouchstart="clearIt()">Clear</button> <button onclick="quitIt()" ontouchstart="quitIt()">Quit</button> </div> // function touchRightArrow() { alert("function touchRightArrow() {"); thrower.directionX = 1; thrower.moveMe = true ; if (thrower.x > canvas.width -40) { thrower.moveMe = false ; } } // function touchEndRight() { //alert("function touchEndRight() {"); rightPressed = false ; thrower.moveMe = false ; drawThrower(); } //
  17. Hello ; I wrote a browser game in Enchant.js , where I did some collisions . It is contained in this .zip file : http://liesandcowpies.com/BenghaziGame/BenghaziGame-Demo/BenghaziGame.zip The file you are probable most interested is this one : BenghaziGameTest.js I stopped using enchantjs because they apparently stopped developing it . So I rewrote it in Phaser , here : http://liesandcowpies.com/testMe/vm-phaser/vm-vertical-collision-Web.html Didn't care for Phaser too much . It is so laaarge . So I rewrote it in Quick.js , here : http://liesandcowpies.com/quickjs/BenghaziGame.html Runs great , but the DOCs weren't very good . Then I thought 'why keep fiddling with all these languages . Since they are all based on javascript , why not just learn javascript .' So I am writing it in javascript here : http://liesandcowpies.com/javascript/BenghaziGame.html It is almost complete . Just having trouble with the 'MoveRight' button . The folks on this Forum are awesome !!! Anyways , take a look at enchant.js code : http://liesandcowpies.com/BenghaziGame/BenghaziGame-Demo/BenghaziGame.zip Happy Trails...
  18. Ah , working real well , Thanks Again Onwards ! http://liesandcowpies.com/javascript/BenghaziGame-09-Sound.html I am hoping to turn this into a Tutorial ...
  19. Hey dsonesuk , Thanks a lot ! I am studying it a bit .
  20. Thanks Folks , The code is for a computer game: http://liesandcowpies.com/javascript/BenghaziGame-starter-08-TCT-Collisions.html Here is the code to play sound: Here is line to play sound: and here is the 'playAudio function': Everytime there is a collision between a cowpie and a person , I need to play/replay that sound . So , I need to know 'how to replay sound from cache' , without any controls visible . Thanks
  21. Ooooh... , Thanks Newbie: In the mean time I discovered the format below : My question on that is ; Does the playThis file remain in memory ? Or does it get released after the audio.play(); ? If it remains in memory , how can I access it multiple times ? Thanks
  22. What I am passing into playAudio is this: And when I code the following , I get same error: Thanks
  23. Hello & Thanks , I am getting an error : Uncaught SyntaxError: Unexpected token < on the line <audio src=playThis> in this code : Pls , what am I doing wrong ? Thanks
×
×
  • Create New...