harrywatson

Members
  • Content count

    107
  • Joined

  • Last visited

  • Days Won

    2

harrywatson last won the day on October 16 2014

harrywatson had the most liked content!

About harrywatson

  • Rank
    Advanced Member

Recent Profile Visitors

843 profile views
  1. Not sure what google web designer does. You could always try a True - False statement within your function. function if reverse == true. go in reverse else if foward == true. go forward. But you'll need some variables first; here is something I wrote for opening and closing a door; var door1open = false; var ghostly = true; door1.on("click", function(event){ createjs.Tween.get(uparrow) .wait(1800) .to({alpha: .5}, 100); if (ghostly == true){ createjs.Tween.get(ghost1) .wait(800) .to({scaleX: 3, scaleY: 3, x: 300, y: 200}, 800) .wait(800) .to({alpha: 0}, 500);} ghostly = false; if(door1open == false){ createjs.Tween.get(door1) .to({scaleX: -.3}, 1000); createjs.Sound.play("creak"); door1open = true;}else if(door1open == true){ createjs.Tween.get(door1) .to({scaleX: 1}, 1000); createjs.Sound.play("creak"); door1open = false;} Now we've got two variables; ghostly and door1. In your case set your own two variables to something like reverse and forward. So if you've played your forward animation, your reverse animation is false and if you play your reverse animation your forward animation is false. Very simple, very useful. You'll need to strip out my own commands to replace them with your own and it's framework neutral so you can ignore 'createjs.tween' etc '==' means compares true to false and = tells a variable what to do, so if you say 1 = 2 then that's a certainty and if you say 1==2 that compares one to two. It'd be nice to see how you get on.
  2. harrywatson

    Timer onComplete callback not working

    Hey great, well done! Code is fantastic fun. Like a crossword on steroids. Yes you're right setTimeout and some others are wrong for games. Though don't shy off raw code altogether. It's where you might do your most original work. I've made a door opener and closer and a combination lock code for click and point or escape type games. The combination lock one took about three weeks. Plus I adapted a shoot 'em code which was raw javascript. Now it's unrecognisable from the original and I now see it as my own. Great adventures!
  3. harrywatson

    Timer onComplete callback not working

    Ahh! You need maybe some 'if' and 'else' statements going on in there. sorry in advance for the not code var continue=true; var pause=false; function stopMe (pause continue){ if continue==true( //your date and timer functions here )}else if{ continue==false //your date and time functions here if (whatYouWant <= 10 timer=stop){ eradicateNastyOne } else if {whatYouWant <= 20 timer=continue} eradicateNastyTwo and so on. Also you could say ; if nastyOne is eradicated your timer = +whatever value Also just a quick word on debugging; You could take out each 'this' statement. one by one and then re run the application. and then re instate each 'this' statement and then re run the application. If there is one statement 'this' or any other that doesn't effect the application, comment it out. So: One 'this' delete - re run - re instate. Second 'this' delete - re run - re instate, and so on..... I know it's a pain in the proverbial but it's the fastest learning curve I've found. Have you looked at a plain javascript solution? Good Luck
  4. harrywatson

    Timer onComplete callback not working

    Hey ! Good on ya ! that's what it's all about ! Sounds to me as though you'll crack it !
  5. harrywatson

    Timer onComplete callback not working

    OK not sure I can help, I use createjs. Though here is a successful timer in that framework; First createjs uses RAF (request animation frame); createjs.Ticker.timingMode = createjs.Ticker.RAF_SYNCHED; function createCountDown(timeRemaining) { var startTime = Date.now(); return function() { return timeRemaining - ( Date.now() - startTime ); } } Timer text, so we can watch the countdown. var timerText = new createjs.Text("Time Remaining: ", "30px Acme","#8e2f2f"); timerText.x = 20; timerText.y = 480; level1.addChild(timerText); Let's set the countdown time var currentCountDown = createCountDown(49000);////////////////////////COUNT DOWN Now we watch it work level1.on("tick", function(event) { var countDownValue = currentCountDown(); timerText.text = "Time Remaining: " + countDownValue; if (countDownValue <= 0){ splashText.text = "Your score was: "+ hitCount; stage.removeChild(level1); stage.addChild(splash); createjs.Tween.get(splash) .to({y: 50}, 400);}else if(bulletCount <= 0){ splashText.text = "Your score was: "+ hitCount; stage.removeChild(level1); stage.addChild(splash); createjs.Tween.get(splash) .to({y: 50}, 400);} }); There is some other things going on there in the last snippet like 'bulletCount' and 'hitCount'. You might want to use a math.round, to get it showing in seconds or minutes or however you want it displayed. Aside from it being based on a framework that's just a minimal part of some decent raw code for a timer. Hope that's useful. You can see it work here; http://harrywatson.altervista.org/Happyapp/happy.html
  6. harrywatson

    Free Source Code of 2D/3D Games and examples in HTML5/WebGL

    http://corehtml5canvas.com/
  7. harrywatson

    Learning to draw

    Pencils and paper and loads of determination
  8. harrywatson

    Happy App

    Hello everyone. I'm working on a 'happyapp'. Could take years (hope not). Just a wee game that cheers you up. Bit of a complicated question really. What cheers you up? I like watching horror movies so it's not simple. We don't want one of those. I've got some objects moving around.... http://harrywatson.altervista.org/Happyapp/happy.html Any suggestions ? Funny bone tickle ideas?
  9. harrywatson

    Pause Button

    paused = true, That should fix all your problems. http://corehtml5canvas.com/code-live/ch05/example-5.9/example.html
  10. harrywatson

    Hello, a simple doubt about framework

    The best framework for making games is the one you are most familiar with.
  11. harrywatson

    Createjs index hack

    Ok here's the code; hopefully it's a bit like a css - inline override, rather than a code butchering: pic1 = new createjs.Bitmap("images/marae.png"); pic1.x = 0; pic1.y = 0; pic1.scaleX = .1; pic1.scaleY = .1; pic1.cursor = "pointer"; stage.addChild(pic1); And then I want it to scale up in front of another lot of thumbnail images. When the picture is clicked again, it goes back to it's grid of thumbnails. I can add as many 'pics' as will nicely fit the page. Note the whole reason for this post: stage.addChild again: var pic1big = false; pic1.on("click", function(event){ stage.addChild(pic1); if(pic1big == false){ createjs.Tween.get(pic1) .to({scaleX: 1, scaleY: 1}, 600); pic1big = true;}else if(pic1big == true){ createjs.Tween.get(pic1) .to({scaleX: .1, scaleY: .1}, 600); pic1big = false;} }); So am I bad? Have I done wrong? Happy day
  12. harrywatson

    Canvas GUI inquiry

    Great idea ! Lot's of time involved. You probably won't be paid for it. Don't let me squash your dreams! (annoying smiley here)
  13. harrywatson

    load games on javascript file

    Hmm.
  14. harrywatson

    Createjs index hack

    Hey great @gregmax17 ! That makes clear what I've been staring at for over a year. I'd been trying to use a z-index without declaring a variable, I think my brain has just dribbled out onto the floor.. Thanks! I'm away from Mrs computer but would like to post my; 'stage.addChild, stage.addChild' type code hack soon. happy day h (annoying smiley face here)
  15. harrywatson

    Createjs index hack

    This is a question and answer at the same time. So during an 'onclick' event I've used createjs to 'addChild' so that the 'child' or 'displayObject' is re - added to the canvas every time it's clicked. I've done this so that the 'displayObject' (in this case a bitmap), has a primery z-index, so it overlays all other children of the canvas or the canvas container. It seems a bit of a hack in that there doesn't seem an easy way to arrange your z-index with javascript. I haven't got the code in front of me but it's something like this; -bit map created stage.addChild(picture1); function(event){'click' -- bla bla addChild(picture1) } ....So I'm adding 'picture1' during the 'event'. when it's already added to the stage. So if you have a number of images say 20, each time it's clicked, it becomes the top of the stack. and the order 'addChild(picture"whatever")' is fired as many times as the user wants. This might be a createjs hack rather than a canvas hack, as the canvas is supposed to be continually redrawn. Any thoughts would be great and I'll grab the code and post it when I get the chance. H