problem with the simple isometric game in the tutorial
ciminiera

As first sorry for my english,

what's wrong in this code, i copied exactly the tutorial, but the compiler says  that in line: var * guy wade.getSceneObject('guy');  Uncaught SyntaxError: Unexpected token *

App = function()
{
    // this is where the WADE app is initialized
	this.init = function()
	{
        // load a scene
		wade.loadScene('scene1.wsc', true, function()
        {
            // the scene has been loaded, do something here
            wade.app.onIsoTerrainMouseDown * function(data)
          {
            var * guy wade.getSceneObject('guy');  
            guy.getBehavior('isoCharacter').setDestination(data.gridCoords);          
              
          };
        });
            
	};
};

 

All 7 Comments
echar

var  guy = wade.getSceneObject('guy'); 

foxcode

Can confirm. The star should not be there.

I think you have made the same mistake here too 

wade.app.onIsoTerrainMouseDown * function(data)

Should probably be

wade.app.onIsoTerrainMouseDown = function(data)
ciminiera

Than you for the answers... :)

i used programming in c long time ago... i am new in javascript and objects... but after the correction you suggested the prog is still not working the compiler says : app.js:15 Uncaught TypeError: Cannot read property 'setDestination' of null

it should be som problem with the object data? maybe because it is undefined?

Thank you!

App = function()
{
    // this is where the WADE app is initialized
	this.init = function()
	{
        // load a scene
        var data;
		wade.loadScene('scene1.wsc', true, function()
        {
            // the scene has been loaded, do something here
            wade.app.onIsoTerrainMouseDown = function(data)
            { 
             //var guy = wade.getSceneObject('guy');
             var  guy = wade.getSceneObject('guy');    
             guy.getBehavior('isoCharacter').setDestination(data.gridCoords);          
               
                 
            }  
        });
	};
};

 

echar
guy.getBehavior('IsoCharacter').setDestination(data.gridCoords);
ciminiera

thank you echar, but i can't see any difference between your and mine... but your it works !!

guy.getBehavior('IsoCharacter').setDestination(data.gridCoords);
 guy.getBehavior('isoCharacter').setDestination(data.gridCoords);
Gio

It's the capital I :)

As an aside, if that's the only behavior of your character, you can just do:

guy.getBehavior().setDestination(data.gridCoords);

No need to specify the behavior name if there's only one.

ciminiera

Ohhhh.... Thank you Gio!

Post a reply
Add Attachment
Submit Reply
Login to Reply