Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   angles (https://forums.graalonline.com/forums/showthread.php?t=22890)

LiquidIce00 02-03-2002 05:12 AM

angles
 
Does anyone know how to get the opposite (dont know how to explain) of an angle?
Like used in pong.
But I need it in sine/cosine form (pi being the 360º angle)

Goboom 02-03-2002 05:18 AM

did you just ask *Puts lips together makes humming noise and moves finger up and down hundereds of times*?

nyghtGT 02-03-2002 05:20 AM

Quote:

Originally posted by Goboom
did you just ask *Puts lips together makes humming noise and moves finger up and down hundereds of times*?
That was stupid.

Slaktmaster 02-03-2002 06:18 AM

Opposite angle = angle - pi.

LiquidIce00 02-03-2002 06:43 AM

Re: Re: angles
 
Quote:

Originally posted by Kaimetsu


Of course someone knows. What a silly question. Plus I think the word you are looking for is "radian".

I was looking at the radiant system and all that but I could not find a certain formula ..
I think I am not explaining myself well b/c in Pong the angle isnt always the opposite of what it was .. (specially when it hits the player tab thing)

btw whats getangle for?

and Slak I tried that.. not it .. hehe

TDO2000 02-03-2002 08:52 AM

hmmm I don't really know a formular for this but a way to emulate something like this is able with using vars for vertical and horizontal movement...

something like this for example:

NPC Code:

if(playerenters){
this.vx=1;
this.vy=-1;
timeout=.05;
}

if(timeout){
if(!onwall(x+(width/2)+this.vx+(.025*this.vx),y+height/2)){x+=this.vx;}
else {this.vx=this.vx*(-1);}

if(!onwall(x+(width/2),y+(height/2)+this.vy+(.025*this.vy))){y+=this.vy;}
else {this.vy=this.vy*(-1);}

timeout=.05;
}



it's like the pong ball

LiquidIce00 02-03-2002 09:12 AM

Quote:

Originally posted by TDO2000
hmmm I don't really know a formular for this but a way to emulate something like this is able with using vars for vertical and horizontal movement...

something like this for example:

<code>

it's like the pong ball

yes but the problem is that always goes in a certain angle
i need mine randomized to actually fit the real reflections of the angles ..
ok im confusing myself here..

nyghtGT 02-03-2002 10:21 AM

Re: angles
 
Quote:

Originally posted by LiquidIce00
Does anyone know how to get the opposite (dont know how to explain) of an angle?
Like used in pong.
But I need it in sine/cosine form (pi being the 360º angle)

I wish i could help, but I did not pay much attention in Geometry ... but remember (axa)+(bxb)=(cxc) ... I got
my forumals I could post for ya if ya want, they may help
a bit...

LiquidIce00 02-03-2002 10:23 AM

Re: Re: angles
 
Quote:

Originally posted by nyghtGT

I wish i could help, but I did not pay much attention in Geometry ... but remember (axa)+(bxb)=(cxc) ... I got
my forumals I could post for ya if ya want, they may help
a bit...

its ok
i wont bother w/ this till I come across this agn and really need it hehe

BocoC 02-03-2002 10:29 AM

Well, you could look for a Unit Circle for help. I had to use one last year in my Advanced Algebra/Trigonometry class. It is basically a circle with Radius 1 that has the Degree and Radian coordinates all along the circle. Like, 180 degrees is pi, while 90 degrees is pi/2. If you need to change degrees into radians, use this equation:
(degrees/180)*pi

TDK_RC6 02-03-2002 11:05 AM

if you would explain a little better, than i could help you, im great at mathmatics

LiquidIce00 02-03-2002 10:59 PM

Quote:

Originally posted by Kaimetsu
There are a couple of simple ways to do this, but I would suggest that you use dx/dy vars as somebody said, rather than inefficiently storing and manipulating the angle.
what is getangle(dx,dy) for?

Wes2000 02-04-2002 12:18 AM

Yea, I would like to know what getangle is also

newfeatures:
- new script function getangle(dx,dy)

commands:
getangle( dx,dy ) the angle of vector (dx,dy) to the x coordinate (0...2*3.14)

That really doesnt help to much :(

Faheria_GP2 02-04-2002 12:29 AM

Re: Re: Re: angles
 
Quote:

Originally posted by LiquidIce00


its ok
i wont bother w/ this till I come across this agn and really need it hehe

well, if you have an angle going / and you want it to suddenly go \ I think you would add/subtract "pi/2"

Wes2000 02-04-2002 12:40 AM

could you possibly post an example? thats the way i usually learn best.

LiquidIce00 02-04-2002 12:45 AM

Re: Re: Re: Re: angles
 
Quote:

Originally posted by Faheria_GP2


well, if you have an angle going / and you want it to suddenly go \ I think you would add/subtract "pi/2"

it depends though .. b/c like if ur angle is really small then if u add pi it would go totally diff direction .. its weird O.o

Faheria_GP2 02-04-2002 12:47 AM

when you add pi to an angle, it should go in the total opposite direction, like down would be up, left would be right

LiquidIce00 02-04-2002 11:02 AM

Quote:

Originally posted by Kaimetsu
It amazes me that you find this so hard. getangle returns the angle between the line (1,0) and (dx,dy) in radians. As for reversing the angle, it's an easy thing to do, but like I said you should be using dx and dy instead of ang.
I just wanted to know of a way to do it using a certain formula.
I can do it other ways too but I wanted a shorter way


All times are GMT +2. The time now is 03:43 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.