Jump to content


Vishnu V Das

Recommended Posts

The bouncer scene has been uploaded, the explained code is :


var config = {
  type: Phaser.AUTO,
  width: 800,
  height: 600,                                 //THE WIDTH AND HEIGHT OF SCENE IS DECLARED
    preload: preload,
    create: create,                    
    update: update
  scale: {
    autoCenter: Phaser.Scale.CENTER_BOTH                            //we place it in the middle of the page.
  gravity: {
    x: 10,                                                                                  //here the gravity of x and y coordinated are declared
    y: 10,
    debug: false,
  physics: {
    default: "arcade",
var game = new Phaser.Game(config);
  function preload () {
    this.load.image("background", "assets/background.png");                   // preloading the assets required for the scene
    this.load.image("ball", "assets/newball.png");
  function create(){
    this.add.image(300, 200, "background");                                                  //creating the scene with the pre loaded objects
    ball1 = this.physics.add.image(100, 0, "ball");
    ball1.setScale(0.9);                                                                                       // to change size of the image 1 is original
    ball1.body.velocity.setTo(200, 200);                                                           // velocity direction initial
    ball1.body.collideWorldBounds = true;                                                       //setting up the bounds
    ball1.body.bounce.set(1);                                                                               //adding the bounce value
  function update(){





Basket ball.rar

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...