First Person Shooter Shoot System

Posted By: gokhanuck

First Person Shooter Shoot System - 11/12/18 17:38

Hi Guys,

I just join the coummunity and started to work on a project trying to create a simple Fps shooter game demo. I created fps style character and added all the movement system succesfully im working on littlecity map. I was looked and worked but coundt find a way to attack like Fps game style. I added a crosshair middle of the screen thats all.

Also created an attack method but its not working.. Map slide and character dissappering when i try to implement workshop 24 basic shooter wizard attack system to me. There is my codes:


In player action function:

if(mouse_left )
{

fps_camera();

ent_create("spell.dds",vector(my.x+40,my.y,my.z+20),spell_fly);
ent_animate(me, "attack", my.skill12, ANM_CYCLE);
}


And this is my spell_fly function:

action spell_fly()
{
my.ambient = 50; // medium bright
my.lightrange = 300; // activate dynamic light
set(me,BRIGHT); // additive blending
vec_scale(my.scale_x,0.15); // small size
my.STATE = 1;

while(1)
{
// state 1: flying ///////////////////////////////////////////
if (my.STATE == 1)
{
my.roll += 20*time_step;
c_move(me,vector(40*time_step,0,0),NULL,IGNORE_YOU);
if (HIT_TARGET) // collided?
my.STATE = 2; // go to next state

}

// state 2: exploding ////////////////////////////////////////
if (my.STATE == 2)
{
// appear in front of close objects
my.roll = random(360);
my.lightrange *= 1+0.5*time_step; // increase light range
vec_scale(my.scale_x,1+0.5*time_step); // inflate size
if (my.scale_x > 1) { // explosion finished?
ent_remove(me);
return;
}
}

wait(1);
}
}


How can i fix this problem = how can i use fps style shooting system?

Best Regards..
Posted By: Ayumi

Re: First Person Shooter Shoot System - 11/13/18 09:56

You should use an Event, not states for flying objects. (EVENT_ENTITY)
© 2024 lite-C Forums