1 registered members (AndrewAMD),
692
guests, and 1
spider. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: How can I make a bullet ? ( I have a code / look here )
[Re: WickWoody]
#300316
12/01/09 14:16
12/01/09 14:16
|
Joined: Oct 2009
Posts: 90
WickWoody
OP
Junior Member
|
OP
Junior Member
Joined: Oct 2009
Posts: 90
|
I create a action and event for bullet.
function mermi_event()
{
if(event_type == ENABLE_IMPACT)
{
ent_remove(me);
}
}
function mermi()
{
set(my, ENABLE_IMPACT);
my.event = mermi_event;
reset(my, PASSABLE);
my.pan = player.pan + 270;
my.tilt = player.tilt;
my.ambient = 100;
while (1)
{
you = player;
c_move(me, vector(0,60*time_step,0), nullvector,IGNORE_FLAG2+IGNORE_CONTENT+IGNORE_PASSABLE+IGNORE_ME+IGNORE_SPRITES+IGNORE_YOU);
wait (1);
}
}
But, event is don't work. Below is picture. Bullet not disappeared. ![](http://img690.imageshack.us/img690/3627/srnn.jpg)
Last edited by WickWoody; 12/01/09 17:35.
|
|
|
Re: How can I make a bullet ? ( I have a code / look here )
[Re: WickWoody]
#300465
12/02/09 16:42
12/02/09 16:42
|
Joined: Jul 2009
Posts: 1,198 Berlin, Germany
Liamissimo
Serious User
|
Serious User
Joined: Jul 2009
Posts: 1,198
Berlin, Germany
|
Mach doch bei mermi_event um das If ne while(1) schleife sonst prüft es das nur ein einziges mal!
"Ich weiss nicht genau, was Sie vorhaben, aber Sie können keine Triggerzonen durch Ihr Level kullern lassen." -JCL, 2011
|
|
|
Re: How can I make a bullet ? ( I have a code / look here )
[Re: Liamissimo]
#300474
12/02/09 17:20
12/02/09 17:20
|
Joined: Nov 2009
Posts: 43 Turkiye
Machera
Newbie
|
Newbie
Joined: Nov 2009
Posts: 43
Turkiye
|
gamestudio wiki den weapons part 1'e bak ve kendi koduna uydurmaya calis. link part 1 ayrica; mermin ne olursa olsun carpinca yok olacagina göre; set(my,ENABLE_IMPACT); yerine, my.emask = ENABLE_IMPACT|ENABLE_ENTITY|ENABLE_BLOCK; de. mermi_event'in içine wait(1); ent_remove(me); yaz.
Last edited by Machera; 12/02/09 17:24.
|
|
|
Re: How can I make a bullet ? ( I have a code / look here )
[Re: Machera]
#300697
12/04/09 14:27
12/04/09 14:27
|
Joined: Oct 2009
Posts: 90
WickWoody
OP
Junior Member
|
OP
Junior Member
Joined: Oct 2009
Posts: 90
|
Thanks but now I have a other problem. If player is closest an object when firing weapon, player is moving to up. My code is below. On press CTRL key:
if(key_ctrl == 1)
{
my.durum = saldir;
}
if(my.durum == saldir)
{
hareket_vektoru.x = 5*time_step;
ent_animate(me, "attack", anim, ANM_CYCLE);
ent_create("mermi.mdl", vector(me.x+2, me.y+5, me.z+13), mermi);
}
Bullet's event & action:
action mermi_event()
{
wait(1);
ent_remove(me);
}
action mermi()
{
my.emask |= ENABLE_IMPACT | ENABLE_BLOCK | ENABLE_ENTITY;
my.event = mermi_event;
my.pan = player.pan;
my.tilt = player.tilt;
while(1)
{
you = player;
c_move(me, vector(60*time_step, 0, 0), nullvector, IGNORE_ME+IGNORE_YOU);
wait(1);
}
}
Edit: I capturing video for this problem. Please wait some.
Last edited by WickWoody; 12/04/09 14:35.
|
|
|
Re: How can I make a bullet ? ( I have a code / look here )
[Re: Erick_Castro]
#300872
12/06/09 10:13
12/06/09 10:13
|
Joined: Oct 2009
Posts: 90
WickWoody
OP
Junior Member
|
OP
Junior Member
Joined: Oct 2009
Posts: 90
|
I create bullet for against enemy. Now I don't have problem for bullet creating but enemy don't detect bullet. I using EVENT_IMPACT but enemy don't detect bullet. I using this code for bullet & enemy:
ENTITY* mermie;
function enemy_event()
{
if(you == mermie && event_type == EVENT_IMPACT)
{
ent_remove(me);
}
}
action bullet()
{
mermie = me;
..
...
....
}
But, this code don't run.
|
|
|
Re: How can I make a bullet ? ( I have a code / look here )
[Re: WickWoody]
#300878
12/06/09 13:39
12/06/09 13:39
|
Joined: Jul 2009
Posts: 150
Blackchuck
Member
|
Member
Joined: Jul 2009
Posts: 150
|
here this musted work; ________________________________________________________________________________
function enemy_event(); function remove_bullets();
action your_player() { VECTOR bullet_pos; ..... if (mouse_left && (total_frames % 24 == 1)) { vec_for_vertex(bullet_pos, my, ...); ent_create("....mdl", bullet_pos, move_bullets); } ...... } .....
action your_enemy() { my.emask = ENABLE_IMPACT | ENABLE_ENTITY; my.event = enemy_event; ..... }
function enemy_event() { if (you.skill100 != 999999) {return;} my.event = NULL; wait (1); set (my, PASSABLE); wait (1); ent_remove(me); }
action bullet() { VECTOR bullet_speed[3]; my.emask = ENABLE_IMPACT | ENABLE_ENTITY | ENABLE_BLOCK; my.event = remove_bullets; my.pan = you.pan; my.tilt = you.tilt; my.skill100 = 999999; bullet_speed.x = 35 * time_step; bullet_speed.y = 0; bullet_speed.z = 0; while (my) { c_move (my, bullet_speed, nullvector, IGNORE_PASSABLE | IGNORE_YOU); wait (1); } }
function remove_bullets() { wait (1); ent_remove (my); } ________________________________________________________________________________
Last edited by Blackchuck; 12/06/09 13:48.
I have know Gamestudio/A7 Commercial Edition 7.84
|
|
|
Re: How can I make a bullet ? ( I have a code / look here )
[Re: Blackchuck]
#300879
12/06/09 13:53
12/06/09 13:53
|
Joined: Mar 2009
Posts: 207
Erick_Castro
Member
|
Member
Joined: Mar 2009
Posts: 207
|
if you see the bullet go through the enemy without hurt him , you have to write
c_setminmax ( me );
in the enemy action declarations. That adjust the collicion box of the enemy.
Last edited by Erick_Castro; 12/06/09 13:55.
|
|
|
|