Gamestudio Links
Zorro Links
Newest Posts
Zorro Trader GPT
by TipmyPip. 12/04/23 11:34
Newbie Questions
by AndrewAMD. 12/04/23 11:14
Square root rule
by Smallz. 12/02/23 09:15
RTest not found error
by TipmyPip. 12/01/23 21:43
neural function for Python to [Train]
by TipmyPip. 12/01/23 14:47
Xor Memory Problem.
by TipmyPip. 11/28/23 14:23
Training with command line parameters
by TipmyPip. 11/26/23 08:42
Combine USD & BTC Pairs In Asset Loop
by TipmyPip. 11/26/23 08:30
AUM Magazine
Latest Screens
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Who's Online Now
2 registered members (TipmyPip, izorro), 556 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
fairtrader, hus, Vurtis, Harry5, KelvinC
19019 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 2 of 2 1 2
Re: i`m confused, again lol [Re: jigalypuff] #145812
08/04/07 20:28
08/04/07 20:28
Joined: Nov 2005
Posts: 1,007
jigalypuff Offline OP
Serious User
jigalypuff  Offline OP
Serious User

Joined: Nov 2005
Posts: 1,007
Quote:

A phaser that is a model that scales on x axis until reaches the target (no move, just scale),



this one mate,


Why does everyone like dolphins? Never trust a species which smiles all the time!
Re: i`m confused, again lol [Re: jigalypuff] #145813
08/04/07 20:42
08/04/07 20:42
Joined: Mar 2006
Posts: 752
Portugal
demiGod Offline
User
demiGod  Offline
User

Joined: Mar 2006
Posts: 752
Portugal

Try something like this.

Dont forget you need to change the modelīs origin to one extremity and not at the center, so this way the model will start scaling correctly.

Code:

function c_phaser
{
vec_for_vertex(temp,player,3894);
ent_create (fphaser_mdl, temp, beam_weapons);

}

var phaser_speed;
var distance;
var ship;
function beam_weapons
{
wait(1);
c_setminmax(me);
snd_play(beam_wav, 100, 0);
my.scale_y = 0.2;
my.scale_z = 0.2;
my.passable = off;
my.oriented = on;
my.flare = on;
my.bright = on;
my.ambient = 100;
my.pan = player.pan;//--->player.pan and tilt set to camera
my.tilt = player.tilt;
my.enable_entity = on;
my.enable_block = on;
my.enable_impact = on;
//my.polygon = on;
//phaser_speed.x = 50 * time;
//phaser_speed.y = 0;
//phaser_speed.z = 0;
while (my != null)
{
distance = vec_dist(player.x, enemy.x );
my.scale_x = distance * 0.1; // play with this value
wait(1);
}
}

on_mouse_left = c_phaser;




Re: i`m confused, again lol [Re: demiGod] #145814
08/04/07 21:32
08/04/07 21:32
Joined: Nov 2005
Posts: 1,007
jigalypuff Offline OP
Serious User
jigalypuff  Offline OP
Serious User

Joined: Nov 2005
Posts: 1,007
this is what i`m getting mate, the beam no longer stops and still passes through the enemy, might it be because there is no collosion detection without the c_move ?



Why does everyone like dolphins? Never trust a species which smiles all the time!
Re: i`m confused, again lol [Re: jigalypuff] #145815
08/04/07 21:54
08/04/07 21:54
Joined: Mar 2006
Posts: 752
Portugal
demiGod Offline
User
demiGod  Offline
User

Joined: Mar 2006
Posts: 752
Portugal
Yeah, without c_move you will not have collision this way, but you said you dont want move, just scale on the phaser.

Keep in mind that there are many ways to do this, and this one could not be the best.

But now you can do a trace from the player to the enemy and if hits then remove the phaser.

Hope it helps.

Re: i`m confused, again lol [Re: demiGod] #145816
08/04/07 23:41
08/04/07 23:41
Joined: Mar 2006
Posts: 3,538
WA, Australia
J
JibbSmart Offline
Expert
JibbSmart  Offline
Expert
J

Joined: Mar 2006
Posts: 3,538
WA, Australia
after a brief scan through the thread, these are my thoughts:

the phaser model should have its origin at its tail end:
Code:

+------------


in this illustration, '+' is the origin and '------------' is the model.

when you shoot, do a c_trace in the direction and distance you want to shoot. this will let you detect the enemy that gets hit, and will return the distance from the gun to the point of impact. place the 'phaser_model' at the gun, use vec_to_angle to get the phaser to point in the direction of the shot, and phaser.scale_x = result / factor; where result is the distance traced to the target (c_trace will return this distance) and factor is the length of your phaser model.

^^ sorry, that's an instant beam. i didn't realize until just now you need it to move over time. in this case, when you shoot you need the trace distance to increase by phaser_speed * time_step, until eventually it hits something or reaches a maximum distance. this would need to be done in a while loop.

bugger! i did a search for c_trace to see if either of you had already though of this idea, and didn't find any. but i should've searched for "trace" because demiGod has already said that

julz


Formerly known as JulzMighty.
I made KarBOOM!
Page 2 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