Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
0 registered members (), 16,302 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
cannot get event_shoot #309207
02/07/10 22:22
02/07/10 22:22
Joined: Jan 2010
Posts: 44
Galati, Romania
CItrok Offline OP
Newbie
CItrok  Offline OP
Newbie

Joined: Jan 2010
Posts: 44
Galati, Romania
I am not able to trigger the EVENT_SHOOT event.

I want to detect shoot event when moving "ent1" entity into "ent2", when supposedly the shoot event happen than a text is drawn.

Bellow is the code. What is wrong?

P.S. I will sugest 3gs team to improve the help. For the beginners is quite hard to get it fast and most of the example given in the manual are ambiguous whereas the examples given in the tutorial are clear so far as I'm concerned. What do you think about that?

///////////////////////////////////////////////////////////////////////////////////
#include <acknex.h>
#include <default.c>

ENTITY* ent1 = NULL;
ENTITY* ent2 = NULL;
ENTITY* ent3 = NULL;


function click_event1()
{


if(event_type == EVENT_SHOOT){
draw_text("Shoot event!!!",100,10,vector(255,255,255));
}
}

action cube1()
{
my.emask|=(ENABLE_SHOOT );
var i;var pos[3];
my.event = click_event1;

while (1)
{

if (key_s) c_move (my, vector(2*time_step , 0, 0), nullvector, ACTIVATE_SHOOT);
if (key_a) c_move (my, vector(-2*time_step , 0, 0), nullvector, ACTIVATE_SHOOT);

if (key_z) c_move (my, vector(0 , 2*time_step, 0), nullvector, ACTIVATE_SHOOT);
if (key_x) c_move (my, vector(0 , -2*time_step, 0), nullvector, ACTIVATE_SHOOT);

wait (1);
}
}


function main()
{
video_mode = 9;
ph_check_distance = 1;
mouse_mode = 2;
level_load ("work10.wmb");
vec_set(camera.x,vector(-550, -30, 100));

ent1=ent_create("modul2.mdl", vector(400, 300, -70), cube1);
c_setminmax(ent1);
set(ent1,POLYGON);

ent2=ent_create("baza.mdl", vector(-100, 300, -70), NULL);
c_setminmax(ent2);
set(ent2,POLYGON);

camera.pan = 0;


while(1)
{
camera.y -= (factor*joy_force.x);
camera.x += (factor*joy_force.y);
if (joy_4)camera.pan+=(0.3*factor);
if (joy_5)camera.pan-=(0.3*factor);
if (joy_3) camera.z += 1;
if (joy_2) camera.z -= 1;

if (joy_8) camera.tilt += (0.1*factor);
if (joy_9) camera.tilt -= (0.1*factor);


if (joy_1 && joy_2)
{

vec_set(camera.x,vector(-550, -30, 100));

}

mouse_pos.x = mouse_cursor.x;
mouse_pos.y = mouse_cursor.y;




wait(1);
}


}

Re: cannot get event_shoot [Re: CItrok] #309368
02/08/10 22:31
02/08/10 22:31
Joined: Sep 2009
Posts: 1,032
Budapest
Aku_Aku Offline
Serious User
Aku_Aku  Offline
Serious User

Joined: Sep 2009
Posts: 1,032
Budapest
I would try to detect does any collision event happen?
Add the ENABLE_IMPACT and ENABLE_ENTITY attributes to one of your object.
Test the event with if(event_type == EVENT_IMPACT) and if(event_type == EVENT_BLOCK).

And last but not least, if you read the manual careful, you can see, the EVENT_SHOOT will be triggered by c_trace.

Re: cannot get event_shoot [Re: Aku_Aku] #309546
02/09/10 23:03
02/09/10 23:03
Joined: Jan 2010
Posts: 44
Galati, Romania
CItrok Offline OP
Newbie
CItrok  Offline OP
Newbie

Joined: Jan 2010
Posts: 44
Galati, Romania
Thanks a lot Aku_Aku, I will consider your advices. Maybe I will solve it this week.


Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1