Having trouble with static sprite moving with astar
by Brandon Bercovich · in iTorque 2D · 05/02/2009 (2:51 pm) · 5 replies
I just got iTGB and I did a few of the tutorials and now I'm trying to port a game I made with TGB to iTGB. Unfortunately the search functional of these forums aren't really up to par. I've noticed a few gothca so far when trying to port for instance you can't use resources. So now I've got my level loaded and it spawns a character that is an astarActor and it tries to go from the spawn point to the end point.
What happens is my character spawns and then doesn't move forward at all. I've been seeing a lot of talk about having to optimize code for the iphone so I thought some of my onUpdateScenes might be too much for the iphone so I started to remove some functionally to get the sprite to move at least.
Does anyone have any ideas why the moveto or astar isn't working correctly. I also noticed when I fired a projectile it would show up on the screen but not move toward it's target.
The projectile is using setLinearVelocityPolar.
Also does anyone have a link to a forum topic that would list things you should watch out for when porting or thing you should look for that you might have to optimize.
Thanks
What happens is my character spawns and then doesn't move forward at all. I've been seeing a lot of talk about having to optimize code for the iphone so I thought some of my onUpdateScenes might be too much for the iphone so I started to remove some functionally to get the sprite to move at least.
Does anyone have any ideas why the moveto or astar isn't working correctly. I also noticed when I fired a projectile it would show up on the screen but not move toward it's target.
The projectile is using setLinearVelocityPolar.
Also does anyone have a link to a forum topic that would list things you should watch out for when porting or thing you should look for that you might have to optimize.
Thanks
#2
One thing that I thought was strange but it just might be the way it works but when I setUsesPhysics and compile it on xcode it works but when I have that in my code and build it with iTGB or TGB it gives me the following error:
Unknown command setUsesPhysics.
Object (1592) Enemy -> aStarActor -> t2dStaticSprite -> t2dSceneObject -> BehaviorComponent -> DynamicConsoleMethodComponent -> SimComponent -> SimObject
Is that just how it is?
05/02/2009 (3:49 pm)
Thanks Bret I just figured that out.One thing that I thought was strange but it just might be the way it works but when I setUsesPhysics and compile it on xcode it works but when I have that in my code and build it with iTGB or TGB it gives me the following error:
Unknown command setUsesPhysics.
Object (1592) Enemy -> aStarActor -> t2dStaticSprite -> t2dSceneObject -> BehaviorComponent -> DynamicConsoleMethodComponent -> SimComponent -> SimObject
Is that just how it is?
#3
See the cheat sheet thread at the top
05/02/2009 (3:54 pm)
setUsesPhysics only works on the iphone unless you build the desktop version with PUAP_OPTIMIZESee the cheat sheet thread at the top
#4
But again thanks for everyone's quick replies and help.
05/02/2009 (4:15 pm)
thanks I read the cheat sheet but maybe I read it wrong but to me it wasn't clear that I had to build the desktop version with PUAP_OPTIMIZE.But again thanks for everyone's quick replies and help.
#5
This is required for the iphone as it is significantly slower than any pc you will get your hands on (even a netbook blows the iphone to dust)
05/02/2009 (4:18 pm)
You don't need to build with it, but if you don't do you need to add a setUsesPhysics dummy function as it is otherwise not present on the desktop. Reason is that without puap_..., all objects have physics enabled. with it beeing present its only active on the objects you activate it.This is required for the iphone as it is significantly slower than any pc you will get your hands on (even a netbook blows the iphone to dust)
Torque Owner Bret Patterson