Jump to content

Thought I would just plug in code, but no go.


vmars316
 Share

Recommended Posts

Hello & Thanks;

Thought I would just plug in code from 


But chrome just gives me black image.

Logo1.png is in "panda.js-master\media" and "panda.js-master\".

Pls, what am I doing wrong?...Thanks

 

<!DOCTYPE html>

<html>

<head>

<meta charset="utf-8">

<title>Panda.js HTML5 game engine</title>

<script type="text/javascript" src="src/game/config.js"></script>

<script type="text/javascript" src="src/engine/core.js"></script>

<script type="text/javascript" src="src/game/main.js"></script>

</head>

<body>

//

game.module(

    'game.main'

)

.require(

    'engine.core'

)

.body(function(){

 

    game.addAsset('logo1.png');

 

    game.createScene('Main', {

        init: function() {

            var logo = new game.Sprite('logo1.png');

            //the offset is relative to the center of the screen. Here x:-20, y:10

            logo.center(-40,10);

            this.stage.addChild(logo);

         }

    });

});

</body>

</html>

Link to comment
Share on other sites

Hi @vmars316

 

When you download the Panda source, have a careful look and study how the code is organised into different files.

 

For example your javascript code should be inside main.js or another module and not in you index.html file.

 

Start by editing/playing around with the Panda source you downloaded, to see what the changes you make do. (keep a copy so you can restore if needed).

 

The best way to learn is experimentation / trial and error :)

 

PS. The code from http://vermeire.home...all.nl/panda/#  needs to go inside the main.js file.

Link to comment
Share on other sites

Hi @vmars316

The best way to learn is experimentation / trial and error :)

PS. The code from http://vermeire.home...all.nl/panda/#  needs to go inside the main.js file.

Thanks;

I finally figured out why doubleClicking on index.html, 

brought up black-screen and no Panda logo.

Turns out, I had two copies of mongoose running. 

Works as advertised now.

..vm

Link to comment
Share on other sites

Hi vm,

 

I plan to ad many many more examples to the website so it will be a very nice starting point for new developers. (In fact I am already collecting new code fragments at the moment).

If you want I can publish the code of the whole fiddler site as a package. It will inculde all images that are necessary to make the examples running.

 

Stephan

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