ciminiera May 29th, 2016 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);
};
});
};
};
echar May 29th, 2016 var guy = wade.getSceneObject('guy');
foxcode May 30th, 2016 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 May 30th, 2016 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 May 30th, 2016 guy.getBehavior('IsoCharacter').setDestination(data.gridCoords);
ciminiera May 31st, 2016 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 May 31st, 2016 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.