Gamestudio Links
Zorro Links
Newest Posts
Newbie Questions
by fairtrader. 12/05/23 10:32
Zorro Trader GPT
by TipmyPip. 12/04/23 11:34
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
6 registered members (AndrewAMD, alibaba, fairtrader, ozgur, TipmyPip, Quad), 604 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
fairtrader, hus, Vurtis, Harry5, KelvinC
19019 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
How to code? #120896
04/01/07 18:18
04/01/07 18:18
Joined: Apr 2006
Posts: 329
M
molotov Offline OP
Senior Member
molotov  Offline OP
Senior Member
M

Joined: Apr 2006
Posts: 329
I've have a player that approches a wall, then I press a button and the player creates a trace to detect the wall. When he detects a wall, the player should be placed a 10 quants away from that wall and facing the wall, no matter what the player original position and angle was. Does someone know to code this effect. Hope this makes sense to someone, thanks anyway. Molotov

Re: How to code? [Re: molotov] #120897
04/01/07 20:21
04/01/07 20:21
Joined: Mar 2006
Posts: 2,503
SC, United States
xXxGuitar511 Offline
Expert
xXxGuitar511  Offline
Expert

Joined: Mar 2006
Posts: 2,503
SC, United States
var tDist = 100;

Function doIt()
{
vec_set(temp, vector(tDist, 0, 0));
vec_rotate(temp, my.pan);
if (c_trace(my.x, temp, ignore_me))
{
// Found a wall!
vec_to_angle(my.pan, normal);
ang_rotate(my.pan, vector(180, 0, 0));
//
vec_set(my.x, target);
vec_set(temp, vector(-10, 0 0));
vec_rotate(temp, my.pan);
vec_add(my.x, temp);
}
}



tDist is the range it should trace for a wall. Then just call tDist from your entity's action. If it finds a wall, then it will face it from 10 quants away.


xXxGuitar511
- Programmer
Re: How to code? [Re: xXxGuitar511] #120898
04/02/07 12:47
04/02/07 12:47
Joined: Apr 2006
Posts: 329
M
molotov Offline OP
Senior Member
molotov  Offline OP
Senior Member
M

Joined: Apr 2006
Posts: 329
Thanks xXxGuitar511, it's working great, just like I wanted.

Re: How to code? [Re: molotov] #120899
04/02/07 13:32
04/02/07 13:32
Joined: Mar 2006
Posts: 2,503
SC, United States
xXxGuitar511 Offline
Expert
xXxGuitar511  Offline
Expert

Joined: Mar 2006
Posts: 2,503
SC, United States
That'll be $5 please...


Just kiddin' - your welcome... lol.


xXxGuitar511
- Programmer

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