Gamestudio Links
Zorro Links
Newest Posts
zorro 64bit command line support
by 7th_zorro. 04/20/24 10:06
StartWeek not working as it should
by jcl. 04/20/24 08:38
Data from CSV not parsed correctly
by jcl. 04/20/24 08:32
Zorro FIX plugin - Experimental
by jcl. 04/20/24 08:30
folder management functions
by VoroneTZ. 04/17/24 06:52
lookback setting performance issue
by 7th_zorro. 04/16/24 03:08
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:46
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (7th_zorro, 1 invisible), 581 guests, and 0 spiders.
Key: Admin, Global Mod, Mod
Newest Members
EternallyCurious, howardR, 11honza11, ccorrea, sakolin
19047 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Something ...> copy and paste ? < #473541
07/20/18 17:26
07/20/18 17:26
Joined: Jun 2018
Posts: 29
B
bbn1982 Offline OP
Newbie
bbn1982  Offline OP
Newbie
B

Joined: Jun 2018
Posts: 29
// Shootable entity & weapon + more ///////

STRING map001map = <map001.wmb>; // filename 4 map

SOUND weap001snd = <shot4.wav>; // Sound when shoots

SOUND robdie = <aaahh.wav>; // Sound when dying
SOUND robhit = <metalhit.wav>; // Sound when hitted

define digit_font,"digfont.pcx";


var ent001health;

function main()
{
level_load (map001map); // load level
gun001(); // trigger gun
}

function gun_muzzle() // what will happen to the gun_muzzle
{
wait(30); // Wait 30 frames
ent_remove(me); // And remove it
}

function gun001() // a gun ...
{
while(1) // shall happen forever
{
if(mouse_left == 1)||(key_ctrl == 1) // If pressing mouse left or ctrl
{
vec_set(temp,camera.x); // copy 2 camera
temp.x = 30000; // What to copy , to the camera position ...
vec_rotate(temp,camera.pan); // Rotate with camera's pan
trace(camera.x,temp); // Trace forward (30000)
trace_mode = ignore_sprites + ignore_passable + activate_shoot; // What shall be brought up (in trace)
ent_create("particle.pcx",target,gun_muzzle);// Create a particle (bitmap) at position where trace ray hit and add the function > gun_muzzle < to it
snd_play(weap001snd,100,1);// weapon sound
wait(30); // Time between shots ...
}
wait(1); // Wait 1 frame
}
}


function change_d()
{
if(event_type == event_block)||(event_type == event_entity){my.pan = random(360);} // When hit wall or entity , rotate in a random vaue ...
if(event_type == event_shoot){my.skill5 -=1;snd_play(robhit,100,0);} // If shooted at decrease health with 1
}
}


PANEL digits_pan ()
{
pos_x = 4; pos_y = 4;
digits(18,20,4,digit_font,1,ent001health);
//digits(18,40,4,digit_font,1,kulsprute_ammo);
//digits(18,60,4,digit_font,1,shotgun_ammo);
//digits(18,80,4,digit_font,1,enemkills);
//digits(18,100,3,digit_font,1,shotgun_ammo);
//digits(18,120,3,digit_font,1,scan_mode);
//digits(60,0,4,digit_font,1,player._speed);
//digits(120,0,4,digit_font,1,my_height);
flags = SHOW;
}

action ent001
{
my.fat = on; // big bounding box
my.enable_block = on; my.enable_entity = on ; my.enable_shoot = on; my.event = change_d; // Make entity sensible 4 blocks and other entities & make it shootable
my.skill5 = 13;// health
while(my.skill5 > -1) // while health is higher then 0
{
ent001health = my.skill5;
my.skill1+=0.3; ent_cycle("walk",my.skill1); // animate entity
my.skill2 = 0.3; move_mode = ignore_me + ignore_passable + ignore_sprites; ent_move(my.skill2,nullvector);// & move it
wait(1); // wait 1 frame
}
my.skill1 = 0;// restore animation
while(my.skill1 < 100) // if the animation cycle lower then 100
{
my.skill1+=1; // increased it
ent_frame("death",my.skill1);// play death animation

wait(1);
}
my.passable = on;
snd_play(robdie,100,1);
waitt(30); ent_remove (me);
}

action look_at_camera // attach to entity , which shall look at , camera ...script much be attach to , level , every time , it is changed (action is added to script)... in WED , that is ...
{
while(1) // while this happens , the loop , shall run ... 1 frame that is
{
var lookatcam[3]; // Where to look
lookatcam.x = camera.x - my.x; // x position
lookatcam.y = camera.y - my.y; // Y position
lookatcam.z = 0; // z position
//lookatcam.z = camera.z - my.z;
vec_to_angle(my.pan,lookatcam); // turn towards camera ...
wait(1);
}
}

// Have it good!

//B

Last edited by bbn1982; 07/20/18 20:51.
Re: Something ...> copy and paste ? < [Re: bbn1982] #473542
07/20/18 17:34
07/20/18 17:34
Joined: Jun 2018
Posts: 29
B
bbn1982 Offline OP
Newbie
bbn1982  Offline OP
Newbie
B

Joined: Jun 2018
Posts: 29
// Everything must be in one Place (files , in one folder) ...

// Have it good

// B

Re: Something ...> copy and paste ? < [Re: bbn1982] #473544
07/20/18 20:47
07/20/18 20:47
Joined: Jun 2018
Posts: 29
B
bbn1982 Offline OP
Newbie
bbn1982  Offline OP
Newbie
B

Joined: Jun 2018
Posts: 29

// Updated code ...

// Shootable entity & weapon + more ///////

STRING map001map = <map001.wmb>; // filename 4 map

SOUND weap001snd = <shot4.wav>; // Sound when shoots

SOUND robdie = <aaahh.wav>; // Sound when shoots
SOUND robhit = <metalhit.wav>; // Sound when shoots

define digit_font,"digfont.pcx";


var ent001health;

function main()
{
level_load (map001map); // load level
gun001(); // trigger gun
}

function gun_muzzle() // what will happen to the gun_muzzle
{
wait(30); // Wait 30 frames
ent_remove(me); // And remove it
}

function gun001() // a gun ...
{
while(1) // shall happen forever
{
if(mouse_left == 1)||(key_ctrl == 1) // If pressing mouse left or ctrl
{
vec_set(temp,camera.x); // copy 2 camera
temp.x = 30000; // What to copy , to the camera position ...
vec_rotate(temp,camera.pan); // Rotate with camera's pan
trace(camera.x,temp); // Trace forward (30000)
trace_mode = ignore_sprites + ignore_passable + activate_shoot; // What shall be brought up (in trace)
ent_create("particle.pcx",target,gun_muzzle);// Create a particle (bitmap) at position where trace ray hit and add the function > gun_muzzle < to it
snd_play(weap001snd,100,1);// weapon sound
wait(30); // Time between shots ...
}
wait(1); // Wait 1 frame
}
}


function change_d()
{
if(event_type == event_block)||(event_type == event_entity){my.pan = random(360);} // When hit wall or entity , rotate in a random vaue ...
if(event_type == event_shoot){my.skill5 -=1;snd_play(robhit,100,0);} // If shooted at decrease health with 1
}
}


PANEL digits_pan ()
{
pos_x = 4; pos_y = 4;
digits(18,20,4,digit_font,1,ent001health);
//digits(18,40,4,digit_font,1,kulsprute_ammo);
//digits(18,60,4,digit_font,1,shotgun_ammo);
//digits(18,80,4,digit_font,1,enemkills);
//digits(18,100,3,digit_font,1,shotgun_ammo);
//digits(18,120,3,digit_font,1,scan_mode);
//digits(60,0,4,digit_font,1,player._speed);
//digits(120,0,4,digit_font,1,my_height);
flags = SHOW;
}

action ent001
{
my.fat = on; // big bounding box
my.enable_block = on; my.enable_entity = on ; my.enable_shoot = on; my.event = change_d; // Make entity sensible 4 blocks and other entities & make it shootable
my.skill5 = 13;// health
while(my.skill5 > -1) // while health is higher then 0
{
ent001health = my.skill5;
my.skill1+=0.3; ent_cycle("walk",my.skill1); // animate entity
my.skill2 = 0.3; move_mode = ignore_me + ignore_passable + ignore_sprites; ent_move(my.skill2,nullvector);// & move it
wait(1); // wait 1 frame
}
my.skill1 = 0;// restore animation
while(my.skill1 < 100) // if the animation cycle lower then 100
{
my.skill1+=1; // increased it
ent_frame("death",my.skill1);// play death animation

wait(1);
}
my.passable = on;
snd_play(robdie,100,1);
waitt(30); ent_remove (me);
}

action look_at_camera // attach to entity , which shall look at , camera ...script much be attach to , level , every time , it is changed (action is added to script)... in WED , that is ...
{
while(1) // while this happens , the loop , shall run ... 1 frame that is
{
var lookatcam[3]; // Where to look
lookatcam.x = camera.x - my.x; // x position
lookatcam.y = camera.y - my.y; // Y position
lookatcam.z = 0; // z position
//lookatcam.z = camera.z - my.z;
vec_to_angle(my.pan,lookatcam); // turn towards camera ...
wait(1);
}
}

// Have it good!

//B

Re: Something ...> copy and paste ? < [Re: bbn1982] #473545
07/20/18 20:52
07/20/18 20:52
Joined: Jun 2018
Posts: 29
B
bbn1982 Offline OP
Newbie
bbn1982  Offline OP
Newbie
B

Joined: Jun 2018
Posts: 29
// Everything must be in one Place (files , in one folder) ...

// Have it good

// B


Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

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