SimGroup Syntax Error
by Glenn Prince · in Torque Game Builder · 02/10/2006 (1:26 pm) · 2 replies
Hi all,
Would anyone know why the following would generate a syntax error:
Would anyone know why the following would generate a syntax error:
//--------------------========================================--------------------
// The X-99 Project
//--------------------========================================--------------------
//--------------------========================================--------------------
// Enemy Animation Holders
//--------------------========================================--------------------
$enemy01 = new ScriptObject()
{
idle = enemy01_idle_anim; // Enemy Standing Idle
run = enemy01_run_anim; // Enemy Running
duck = enemy01_duck_anim; // Enemy Ducking
stand = enemy01_stand_anim; // Enemy Standing
jump = enemy01_jump_anim; // Enemy Jumping
fall = enemy01_fall_anim; // Enemy Falling
die = enemy01_die_anim; // Enemy Dieing
fire1 = enemy01_firepistol_anim; // Enemy Firing Primary
fire2 = enemy01_firerocket_anim; // Enemy Firing Secondary
fire1_air = enemy01_airpistol_anim; // Enemy Firing Primary in mid air
fire2_air = enemy01_airrocket_anim; // Enemy Firing Secondary in mid air
};
//--------------------========================================--------------------
// Enemy Sim Group
//--------------------========================================--------------------
new SimGroup(enemy_group);
//--------------------========================================--------------------
// Create Enemy Function
//--------------------========================================--------------------
//%chase, %stop_chase, %patrol_min, %patrol_max
function create_enemy(%pos, %type, %speed, %air_speed, %jump_height, %surface_angle)
{
%enemy = new t2dAnimatedSprite() // Make the player a Animated Sprite
{
scenegraph = t2dscene; // Add it to the overall scenegraph
};
%enemy.playAnimation($enemy01.idle); // Play the idle animation
%enemy.setCollisionActive(true, true); // Turn on send and receive collisions
%enemy.setCollisionPhysics(true, false); // Turn on sending of physics collisions
%enemy.setCollisionResponse(CLAMP); // Set Collision responses change velocities to 0
%enemy.setCollisionCallback(true); // Allow callbacks from the collision system
%enemy.setCollisionMaxIterations(2); // Only allow 2 collisions per iteration
%enemy.setLayer($enemy_layer); // Set the object layer to the global variable in game.cs
%enemy.setGroup($enemy_group); // Set the object group to the global variable in game.cs
%enemy.setCollisionMasks(BIT($platform_group), BIT($platform_layer)); // Set the collision makes to be platform group and layer
%enemy.setMaxLinearVelocity(250); // Set the maximum speed the enemy can reach
%enemy.run_speed = %speed; // Set the enemy max move speed
%enemy.air_speed = %air_speed; // Set the enemy max in air speed
%enemy.jump_height = %jump_height; // Set the enemy max jump height
%enemy.surface_angle = %surface_angle; // Set the max surface run angle
%enemy.setPosition(%pos); // Set the default position
enemy_group.add(%enemy);
};
Torque Owner David Bigerstaff
Try this.
function create_enemy(%pos, %type, %speed, %air_speed, %jump_height, %surface_angle) { ... etc etc }