Jump to content

Use panda with ES6


David Higuita
 Share

Recommended Posts

Hi, How can I use panda with ES6?
I mean, I downloaded the code (with get an index.html, engine and game dorectories)
I have tested and in main.js works fine, but I want to import panda on another javascript file to get all core using the import, just

import game from 'engine/core'


But i get a small object, but doesn't get a full object, for example, I don't get the complete object

 

My structure is this

.
└── demo
    ├── _demo
    │   ├── assets
    │   │   └── Images
    │   │       ├── frog.jpg
    │   │       └── logo.png
    │   └── settings.json
    ├── app.js
    ├── index.html
    ├── js
    │   └── pandajs
    │       ├── engine
    │       │   ├── analytics.js
    │       │   ├── audio.js
    │       │   ├── camera.js
    │       │   ├── core.js
    │       │   ├── debug.js
    │       │   ├── keyboard.js
    │       │   ├── loader.js
    │       │   ├── particle.js
    │       │   ├── physics.js
    │       │   ├── pixi.js
    │       │   ├── pool.js
    │       │   ├── renderer.js
    │       │   ├── scene.js
    │       │   ├── storage.js
    │       │   ├── system.js
    │       │   ├── timer.js
    │       │   └── tween.js
    │       └── game
    │           ├── config.js
    │           └── main.js
    ├── media
    │   └── logo.png
    ├── scss
    └── styles.scss

This is my app.js file

 

import game from './js/pandajs/engine/core';

game.module(
    'game.main'
)
.body(function() {

game.addAsset('logo.png', 'logo');

game.createScene('Main', {
    backgroundColor: 0xb9bec7,

    init: function() {
        var logo = new game.Sprite('logo');
        logo.anchor.x = 0.5;
        logo.anchor.y = 0.5;
        logo.position.x = game.system.width / 2;
        logo.position.y = game.system.height / 2;
        this.stage.addChild(logo);

        var tween = new game.Tween(logo.scale);
        tween.to({ x: 1.1, y: 1.1 }, 1000);
        tween.repeat();
        tween.yoyo();
        tween.start();
    }
});

});

 

And I want use the app.js to import panda and create my game with classes. Is it possible?

I want to do it to because we need create many simple games, but I have tested pixi.js and really doesn't like me and I want to use panda but I must use it with ES6

Thanks

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.

Guest
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.

Loading...
 Share

  • Recently Browsing   0 members

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