Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (AndrewAMD, degenerate_762, ozgur), 1,311 guests, and 0 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 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: 993
Budapest
Aku_Aku Offline
User
Aku_Aku  Offline
User

Joined: Sep 2009
Posts: 993
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 | chip programmers | 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