Posted By: oldschoolj
Motion problems - 07/28/07 20:04
SO I finally got a bit of code working smoothly with Lite-C, but now I'm kinda stuck. I can't seem to get the balllight_mdl to move. When I press LMB it creates it at the player.x position, but doesnt move. Any suggestions?
It seems that everything is fine, until shoot_balllight and fire_balllight
Code:
It seems that everything is fine, until shoot_balllight and fire_balllight
Code:
#include <acknex.h>
#include <default.c>
#include "ingame_ui.c"
BMAP* ptrail_map = "plasmaglow_blue.tga";
STRING* balllight_mdl = "gem.MDL";
BMAP* sun_farbe3 = "sun_blue.tga";
var balllightparts = 30; //number of particles used for this effect
var player_speed;
function fire_balllight();
function shoot_balllight();
function remove_balllight();
function enemy_event();
function particle_trail();
function fade_trail();
function balllightcool();
//////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////
function main()
{
video_set (1360,768,32,1);
freeze_mode = 0;
warn_level = 2; // announce bad texture sizes and bad wdl code
mouse_mode = 0;
wait(3);
// now load the level
level_load("spelltesting.wmb");
/////////////////////////////////////////////////////////////////////////////////////////
wait(5);
}
action player_moves ()
{
player = my;
set(my,INVISIBLE | IGNORE_MODELS); // no need to see the player because we are in 1st person mode
while (1)
{
c_move (my, vector(20 * (key_cuu - key_cud) * time_step, 10 * (key_cul - key_cur) * time_step, 0), nullvector, IGNORE_PASSABLE | GLIDE);
vec_set (camera.x, player.x); // use player's x and y for the camera as well
camera.z += 30; // place the camera 30 quants above the player on the z axis (approximate eye level)
camera.pan -= 10 * mouse_force.x * time_step; // rotate the camera around by moving the mouse
camera.tilt += 10 * mouse_force.y * time_step; // on its x and y axis
player.pan = camera.pan; // the camera and the player have the same pan angle
if (mouse_left == 1)
{
fire_balllight();
}
wait (1);
}
}
function fire_balllight()
{
proc_kill(4); // only one instance of this function is running
while (mouse_left == 1) {wait (1);}
ent_create (balllight_mdl, player.x, shoot_balllight);
}
function shoot_balllight()
{
wait(1);
set (my, ENABLE_BLOCK | ENABLE_ENTITY);
my.event = remove_balllight;
my.pan = camera.pan;
my.tilt = camera.tilt;
while (1)
{
c_move(me, nullvector, vector(15 * time_step, 0, 4 * time_step), GLIDE);
wait (1);
}
remove_balllight();
}
function remove_balllight()
{
wait (1);
ent_remove(me); // now remove it
}
action enemy()
{
my.emask |= ENABLE_SCAN; // sensible for scans
}
