David Higuita

Use panda with ES6

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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Recently Browsing   0 members

    No registered users viewing this page.