Gamestudio Links
Zorro Links
Newest Posts
Executing Trades on Next Bar Open
by Zheka. 06/20/24 14:26
Lapsa's very own thread
by rki. 06/19/24 11:27
A simple game ...
by VoroneTZ. 06/18/24 10:50
Face player all the time ...
by bbn1982. 06/18/24 10:25
Zorro Beta 2.61: PyTorch
by jcl. 06/10/24 14:42
New FXCM FIX Plugin
by flink. 06/04/24 07:30
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AndrewAMD, degenerate_762), 1,240 guests, and 7 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Mino, squik, AemStones, LucasJoshua, Baklazhan
19061 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
Making a "Hitbox" #134337
06/06/07 20:01
06/06/07 20:01
Joined: May 2006
Posts: 69
Canada
L
Leaf Offline OP
Junior Member
Leaf  Offline OP
Junior Member
L

Joined: May 2006
Posts: 69
Canada
The idea is common, but no tutorial on how to make a 2d or 3d Hitbox.
Example: http://www.spoonix.org/downloads/hitbox.jpg

What I am looking for is:

{
(If 0x,0y of player camera is looking at self <= Number of quants //distance away that the bounding box will show up so you wont see it if your 0x,0y crosses over it half way accross the level//)

Show bounding box
}



So basicly, how do I write that so when I look over at a desk from 100 quants away the boundingbox/"hitbox" will apear when my aimer is over it.

Thanks, Leaf

Last edited by Leaf; 06/06/07 20:02.
Re: Making a "Hitbox" [Re: Leaf] #134338
06/06/07 20:39
06/06/07 20:39
Joined: Mar 2006
Posts: 2,503
SC, United States
xXxGuitar511 Offline
Expert
xXxGuitar511  Offline
Expert

Joined: Mar 2006
Posts: 2,503
SC, United States
*Deleted*

Eh, that code was wrong

Last edited by xXxGuitar511; 06/06/07 20:44.

xXxGuitar511
- Programmer
Re: Making a "Hitbox" [Re: xXxGuitar511] #134339
06/07/07 01:31
06/07/07 01:31
Joined: May 2006
Posts: 69
Canada
L
Leaf Offline OP
Junior Member
Leaf  Offline OP
Junior Member
L

Joined: May 2006
Posts: 69
Canada
Bump for help

Re: Making a "Hitbox" [Re: Leaf] #134340
06/07/07 12:36
06/07/07 12:36
Joined: Jan 2007
Posts: 1,619
Germany
Scorpion Offline
Serious User
Scorpion  Offline
Serious User

Joined: Jan 2007
Posts: 1,619
Germany
i don't have the time for a code, but try this:
use a easy particle with the beam flag, the direction you give with the effect-instruction
the partilce must ahve a lifespan of 1....
youy haveto make a while, that emmit every frame 12 effects, which go from one of the 8-points to another one

Re: Making a "Hitbox" [Re: Scorpion] #134341
06/07/07 20:57
06/07/07 20:57
Joined: May 2006
Posts: 69
Canada
L
Leaf Offline OP
Junior Member
Leaf  Offline OP
Junior Member
L

Joined: May 2006
Posts: 69
Canada
Quote:

i don't have the time for a code, but try this:
use a easy particle with the beam flag, the direction you give with the effect-instruction
the partilce must ahve a lifespan of 1....
youy haveto make a while, that emmit every frame 12 effects, which go from one of the 8-points to another one




I under stand what you mean, but I dont know hwo to write the IF statment so when im looking at it and im within so many quants it will show up

Re: Making a "Hitbox" [Re: Leaf] #134342
06/07/07 22:26
06/07/07 22:26
Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
Xarthor Offline
Expert
Xarthor  Offline
Expert

Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
Code:

...
if(my.clipped != on && vec_dist(my.x,camera.x) <= many_quants)
{
draw_bounding_box(); //your draw function
}
...



Re: Making a "Hitbox" [Re: Xarthor] #134343
06/08/07 02:19
06/08/07 02:19
Joined: May 2006
Posts: 69
Canada
L
Leaf Offline OP
Junior Member
Leaf  Offline OP
Junior Member
L

Joined: May 2006
Posts: 69
Canada
I dont under stand, can you explain a little more pelase

Re: Making a "Hitbox" [Re: Leaf] #134344
06/08/07 05:05
06/08/07 05:05
Joined: Mar 2006
Posts: 2,503
SC, United States
xXxGuitar511 Offline
Expert
xXxGuitar511  Offline
Expert

Joined: Mar 2006
Posts: 2,503
SC, United States
Wow, I didn't know about the clipped flag, and it's exactly what I was looking for! Thanks XArthor!


xXxGuitar511
- Programmer
Re: Making a "Hitbox" [Re: xXxGuitar511] #134345
06/08/07 05:51
06/08/07 05:51
Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
Xarthor Offline
Expert
Xarthor  Offline
Expert

Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
@Leaf:
Well you wanted some help with the IF statement, so I wrote it
Basicly it checks if the my entity was clipped in the last frame, which means that it is potentially invisible (if clipped = on), so I check if clipped is off or not on (!= on).
Then I check if the distance of the my entity to the camera is below or equal a certain value.
Just enter a value for "many_quants"

@xXxGuitar: No problem mate

EDIT:
An quick example Code:

action my_bounding_box_char
{
wait(1);
c_updatehull(my,my.frame);
wait(2);

while(me)
{
if(my.clipped != on && vec_dist(my.x,camera.x <= 500)
{
beep;
}
wait(1);
}
}


That code should bring some noise into your level (due to the "beep;")

Last edited by Xarthor; 06/08/07 05:56.
Re: Making a "Hitbox" [Re: Xarthor] #134346
06/08/07 07:18
06/08/07 07:18
Joined: May 2006
Posts: 69
Canada
L
Leaf Offline OP
Junior Member
Leaf  Offline OP
Junior Member
L

Joined: May 2006
Posts: 69
Canada
Quote:

@Leaf:
Well you wanted some help with the IF statement, so I wrote it
Basicly it checks if the my entity was clipped in the last frame, which means that it is potentially invisible (if clipped = on), so I check if clipped is off or not on (!= on).
Then I check if the distance of the my entity to the camera is below or equal a certain value.
Just enter a value for "many_quants"

@xXxGuitar: No problem mate

EDIT:
An quick example Code:

action my_bounding_box_char
{
wait(1);
c_updatehull(my,my.frame);
wait(2);

while(me)
{
if(my.clipped != on && vec_dist(my.x,camera.x <= 500)
{
beep;
}
wait(1);
}
}


That code should bring some noise into your level (due to the "beep;")




Thanks man I got it figured Needed to move some brackets around and shorten the action name. Got "action not found" error because the name was too long Also, added a wait to the action so it doesn't beep out of control and lag to hell. Heres what ive changed it too.

Perfect script man I can now use it to make triggers to open doors easier Well here it is working script for it:

ACTION bounding_box {

my.shadow = on;
my.gravity = 1;
my.entity_type = 2;
my.enable_scan = on;
wait(1);
my.enable_impact = on;
my.polygon= on;
c_updatehull(my,my.frame);
wait(2);

while(1)
{
if(my.clipped != on && vec_dist(my.x,camera.x) <= 500)
{
wait(100);
beep;
}
wait(1);
}
}




Your if statement was:
if(my.clipped != on && vec_dist(my.x,camera.x <= 500)

Mine changed to work:
if(my.clipped != on && vec_dist(my.x,camera.x) <= 500)

Just a mixup of brackets

Last edited by Leaf; 06/08/07 07:20.
Page 1 of 2 1 2

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