Jump to content

Search the Community

Showing results for tags 'tradjectory'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • HTML5 Game Coding
    • News
    • Game Showcase
    • Facebook Instant Games
    • Web Gaming Standards
    • Coding and Game Design
    • Paid Promotion (Buy Banner)
  • Frameworks
    • Pixi.js
    • Phaser 3
    • Phaser 2
    • Babylon.js
    • Panda 2
    • melonJS
    • Haxe JS
    • Kiwi.js
  • General
    • General Talk
    • GameMonetize
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered
    • Marketplace (Sell Apps, Websites, Games)

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website URL


Twitter


Skype


Location


Interests

Found 1 result

  1. Hi all , I've been trying to create a cannonball that flys relative to gravity and relative to the player's mouse position on the canvas + velocity. Further away the mouse cursor higher the velocity with gravity as a constant. I'm using createjs and not wanting to include any physics engine. Here is where I've got so far var w = canvas.width; var h = canvas.height; var ox = 20; var oy = h - 20; bullet1 = new createjs.Shape(); bullet1.graphics.beginFill( "black" ).drawCircle(5, 5, 10); bullet1.graphics.beginFill( "white" ).drawCircle(2, 5, 2); // shiney spot on bullet1 bullet1.x = cannon.x; bullet1.y = cannon.y; bullet1.regX = 5; bullet1.regY = 5; bullet1.alpha = 0; scene1.addChild(bullet1); // add cannonball kaPow = false; // haven't fired the cannon yet oneback.on("click", function(){ //oneback is the background image kaPow = true; scene1.addChild(bullet1); bullet1.x = cannon.x; bullet1.y = cannon.y; }); oneback.on("mouseup", function(){ kaPow = false; }); stage.on("tick", function(){ if(kaPow == true){ bullet1.rotation += 8; bullet1.alpha = 1; var vx = (stage.mouseX - ox) / 50; var vy = (stage.mouseY - oy) / 50; bullet1.x += vx; bullet1.y += vy; } });The cannonball (bullet1) moves along and across the stage. cannon.rotation is working nicely. I've managed the cannonball velocity ok - ish. and direction ok - ish. But there is heaps missing here such as time and gravity. Thanks for any insights
×
×
  • Create New...