Jump to content

Search the Community

Showing results for tags 'sine wave'.

  • 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. Hey guys! First time posting here and I'm really new to using phaser. So far I'm having a fun time learning how to use this framework, but I'm having a bit of trouble with moving my sprite. Basically I have a sprite drawn to the left of the game canvas, around 0,300 (On a 800, 600 canvas) and I want to be able to drag my sprite and it moves in a sine wave across the screen. I've been playing and getting the movement right of the sine wave, but when I click to drag the sprite, it moves it up on the screen. Any tips on making the box stay fixed when I first click it to drag? Thank you very much! Right now I have this in my code: function create() { // This creates a simple sprite that is using our loaded image and // displays it on-screen block = game.add.sprite(0, 0, 'block'); block.inputEnabled = true; block.input.enableDrag(); game.stage.backgroundColor = '#ffffaa'; block.input.allowVerticalDrag = false; block.y = game.height/2-(block.height); block.x = block.width/2; orginX = block.x; orginY = block.y; block.events.onDragStop.add(onDragStop, this);} function onDragStop(sprite, pointer) { block.x = orginX; block.y = orginY;} function update(){ console.log(block.x); if(block.input.isDragged){ block.y = (100*Math.sin(block.x/35)); }}
×
×
  • Create New...