harrywatson

Members
  • Content Count

    107
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by harrywatson

  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. 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. 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. Hey ! Good on ya ! that's what it's all about ! Sounds to me as though you'll crack it !
  5. 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

    Learning to draw

    Pencils and paper and loads of determination
  7. 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?
  8. harrywatson

    Pause Button

    paused = true, That should fix all your problems. http://corehtml5canvas.com/code-live/ch05/example-5.9/example.html
  9. The best framework for making games is the one you are most familiar with.
  10. 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
  11. 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)
  12. 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)
  13. 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
  14. Hey go for it ! Nothing like the passion ! Good learning curve too. There is a way of creating a wee map (polygons) quite easily then recording mouse moves but you've cracked it as far as I can tell. I like to read so I wouldn't want to avoid a book shelf however you could create a 'no go' class; function (avoid){if character bla bla bla, XY (closest point on your mesh)} When you make your bookshelf - scene.add(bookshelf) class = avoid. Very simple way of making things fluid. If you write the code please post. could be useful for all sorts of things.
  15. I've always found clicking a space to where your character should move to be a cumbersome gameplay. like that sentence. Also if you are capturing co-ordinates, could you not use your mouse click anywhere on canvas then create exceptions? I mean we are talking 2d? Then all you'd need is a nice little collision script to get your character moving between rooms. "if harry.x > = door.x" Welcome to another room of delights! Umm I guess keys out of the question? O well here is a keyboard script with X Y exceptions and rules - could always replace key co-ordinates with mouse clicks. Full source here; http://momogames.altervista.org/haunted/ var KEYCODE_SPACE = 32, KEYCODE_UP = 38, KEYCODE_LEFT = 37, KEYCODE_RIGHT = 39, KEYCODE_DOWN = 40; var keyDn = false, play=true, dir="right"; var vy = 0, vx = 0; var lfHeld, rtHeld, helpmeghost; //var base, base2; var jumping = false, inAir = true, gravity = 2; document.onkeydown = handleKeyDown; document.onkeyup = handleKeyUp; //OBVIOUSLY WILL NEED TO HANDLE ALL KEYS ^^ // JUST CODE SNIPPETS HERE QUESTIONS WELCOME //THERE ARE FIVE PLATFORMS (BASES) (EXCEPTIONS ?) base1 = new createjs.Bitmap(base1); base1.width = 250; base1.height = 5; base1.x = 450; base1.y = 180; base1.scaleX = .3; // CHARACTER IN IDLE STATE helpmeghost = new createjs.Sprite(mns); helpmeghost.framerate = 10; helpmeghost.scaleX = .8; helpmeghost.scaleY = .8; helpmeghost.x = 210;//550 helpmeghost.y = 100; helpmeghost.gotoAndPlay("idle"); //CHARACTER MOVING //move left and right if (lfHeld){ vx = -5; } if (rtHeld){ vx = 5; } if(lfHeld && keyDn==false && inAir==false){ helpmeghost.gotoAndPlay("walk"); //createjs.Sound.play("squish"); helpmeghost.scaleX = -1; keyDn=true; } if(rtHeld && keyDn==false && inAir==false){ helpmeghost.gotoAndPlay("walk"); //createjs.Sound.play("squish"); helpmeghost.scaleX = 1; keyDn=true; } if (dir=="left" && keyDn==false && inAir==false){ helpmeghost.gotoAndPlay("idle"); } if (dir=="right" && keyDn==false && inAir==false){ helpmeghost.gotoAndPlay("idle"); } helpmeghost.x+=vx; vx=vx*0.5; } }); // MY OWN CLUNKY SOLUTION FOR 'EXCEPTIONS'. if(helpmeghost.y < base4.y){ path = base4;}else if(helpmeghost.y > base4.y && helpmeghost.y < base.y){ path = base;}else if(helpmeghost.y > base.y && helpmeghost.y < base2.y){ path = base2;}else if(helpmeghost.y > base2.y && helpmeghost.y < base3.y){ path = base3;} // THE PATH FUNCTION function path(width, height, x, y){ this.width = width; this.height = height; this.x = x; this.y = y; } // NOW I'M JUST MAKING THIS UP BUT HOW ABOUT RECORD A CO-ORDINATE ON 'MOUSEDOWN, THEN'GOTOANDPLAY' //ONMOUSEUP?
  16. Sounds great, when can we see an example? I'd be interested to see, even a scene change. Hotspots have never been a problem for me. Either using Createjs or native code. I suck at maths but I have a calculator. And I code co-ords into every game I make to place everything. Just mouse over it and write it down. Keep smiling Harry
  17. Hmm? Very nice looking and got me started for awhile, well done, it looks great, Could have done with a few simple levels to start. That's all I can think of. Lovely looking. H
  18. Have you tried createjs? http://createjs.com/Home It's based on the display list of AS and Making migration simple
  19. Here is Psionic games most recent game. He's a one man band and to my mind about the best indie game dev out there. http://www.psionicgames.com/ He started in flash and went to unity for 3d. Wow! That's passion! You'll need to download unity web player if you haven't already got it. here's the game.. http://www.psionicgames.com/games/ghostscape3dweb.html H
  20. Very good skills making this game. Nice and slick. No background sound. and only played 5 levels and got bored. On second thoughts I had another go and thought it was very impressive but no background sound on pc (mac).
  21. Keep working on this game - would be my humble comment. Love the way you use space to play
  22. Hi Chan, I couldn't see what you were asking for in all that code.... Also was it 'hint' or 'hit' points you wanted ? I'm sure you'll get there, you seem a much better programmer than me. You could take some of your code that works well and change it to fit what you want.