Game Development Community

Shooter tutorial can not work on iPhone (or even simulator)

by speedbeeqs · in iTorque 2D · 02/25/2010 (3:51 am) · 4 replies

Everybody,

I tried to make Shooter tutorial, it worked very well on the TGBGame but it hang on when I tried to run it on my iPhone.

Even I created a simple project with simple function that moving the ship through the screen like:
- Having a ship on TBG
- Set the ship name and class name as well (pShip/playerShip)
- On Dynamic field, set minSpeed and maxSpeed (50/100)
- Create a player.cs on scripts folder with simple code:
function playerShip::onLevelLoaded(%this, %scenegraph)
{
%this.startX = %this.getPositionX();
%this.spawn();
}

function playerShip::onWorldLimit(%this, %mode, %limit)
{
if(%limit $= "left")
{
%this.spawn();
}
}

function playerShip::spawn(%this)
{
%this.setLinearVelocityX(getRandom(%this.minSpeed, %this.maxSpeed));
%this.setPositionY(getRandom(%this.minY, %this.maxY));
%this.setPositionX(%this.startX);
}
- Edit game.cs file by adding exec command.
- Run on TGB. It's work. The ship move.
- Close TGBGame.
- Then open xCode by click build button
- Clean All
- Add "common, game" folder and main.cs
- Compile them
- Build and Go.
- Build successful but the ship hang on the screen without any moving.

Does anyone know why? Did I miss anything? Thanks for your help.

Speed.

About the author

Recent Threads


#1
02/25/2010 (6:13 am)
My first guess is you need to set uses physics.

in playerShip::spawn() try add this %this.setUsesPhysics( true ); before you do anything else and see if it helps.
#2
02/25/2010 (7:46 am)
@speedbeeqs - Could you check your e-mail inbox? I sent you a message.
#3
02/25/2010 (12:42 pm)
Naughty naughty dodgey downloader it looks like!
#4
02/26/2010 (1:52 pm)
@Christopher Evans: Thanks, it works right now ;)