Advanced Logic. Tutorials?
ozboybrian
PRO Posts: 2,102
Ok, so I understand 99% of the basics.
I get my Attributes. I get Rules. I get how to tell things to relate to each other and work together. I get basically all the behaviours.
But I never really use code.. e.g. (x729372**),(7%,gameX) whatever that is lol.
I would love it if there where some advanced tutorials for stuff like that explained every character and how and why they do what they do.
I get my Attributes. I get Rules. I get how to tell things to relate to each other and work together. I get basically all the behaviours.
But I never really use code.. e.g. (x729372**),(7%,gameX) whatever that is lol.
I would love it if there where some advanced tutorials for stuff like that explained every character and how and why they do what they do.
Comments
Are you asking what this function "%" does ?
Roy
Well for example. My skills go as far as ChangeAtt. Self.postionX to 100.
I'm use to only putting numbers in.
But anything else, that's like Brackets and stuff (like things used for custom fonts on the score board) I don't understand.
I can follow along to a video telling you what to type in to get those special things to work with math and what not.
But I don't understand How/Why it works.
Have you looked there?!
Roy.
Math cool. But tutorials explaining with GS would be cool.
abs
Usage: abs(x)
The absolute value of the number. i.e. make the number positive if it is negative.
Usage Example: Combined with a cosine or sine function, you can make an actor “hop” in a pattern. See cos for more information.
acos
Usage: acos(x)
The trigonometric arccosine (inverse cosine) function. Values can only range from -1 to 1 with results from 180 to 0, respectively. Any other input values will result in 'nan'.
asin
Usage: asin(x)
The trigonometric arcsine (inverse sine) function. Values can only range from -1 to 1 with results from -90 to 90, respectively. Any other input values will result in 'nan'.
atan
Usage: atan(x)
The trigonometric arctangent (inverse tangent) function. Results will range from -90 to 90.
ceil
Usage: ceil(x)
The integer when you round up a value. e.g. ceil(0) = 0 , ceil(0.004) = 1
cos
Usage: cos(x)
The trigonometric cosine function. If the value that you use the cosine function on starts at 0, your resulting value will start at the maximum value of cosine. i.e. cos(0) = 1.
exp
Usage: exp(x)
The exponential function, e^x where e is the number (approximately 2.718281828).
floor
Usage: floor(x)
The integer when you round down a value.
Example: floor(0) = 0 , floor(0.004) = 0
ln
Usage: ln(x)
The natural logarithm of a value. The natural logarithm is the logarithm to the base e, where e is an irrational constant approximately equal to 2.718281828.
Example: ln(e) = 1
log10
Usage: log10(x)
The base 10 logarithm of a value.
Example: log10(10) = 1, log10(100) = 2
magnitude
Usage: magnitude(x,y)
Find the length of a line segment from the origin, (0,0), to the given point. You can include an offset,(x',y'), to find the length between the two points. i.e. magnitude(x-x',y-y')
Example: If I wanted to find the length between my actor at coordinates (25,30) and another actor at coordinates (100,240), I would use the expression magnitude(25-100,30-240).
max
Usage: max(x,y)
Return the higher value of two numbers or variable values.
min
Usage: min(x,y)
Return the smaller value of two numbers or variable values.
Example: min(12,35) = 25
random
Usage: random(x,y)
Generate a random integer equal to or between the first integer value and the second integer value.
Example: random(1,10) can be any number from the set of {1,2,3,4,5,6,7,8,9,10}.
sin
Usage: sin(x)
The trigonometric sine function. This is similar to the cosine function but it is offset by one quarter of a wave cycle.
Tip: If you use the sine function and start your incrementing variable at 0(using the example above), your actor's movement does not start at the middle between the minimum and maximum points of the wave.
sqrt
Usage: sqrt(x)
Square root of a value. Input values less than 0 will result in 'nan'.
tan
Usage: tan(x)
The trigonometric tangent function.
vectorToAngle
Usage: vectorToAngle(x,y)
Find the angle relative to the origin, (0,0), given an X and Y coordinate. You can include an offset,(x',y'), to find an angle relative to the offset.
e.g. vectorToAngle(x-x',y-y')
Implicit Math Functions
() : Parenthesis are used to perform all math functions within them before calculating with anything else.
^ : Exponent character. e.g. A^3 = A*A*A , A^(1/2) = squareroot of A
* : Multiply
/ : Divide. Be careful with divide by zero. Its undefined.
+ : Add. e.g. B + C = A
- : Subtract. e.g. A - B = C. (Also unary minus)
% : Modulo is the remainder after dividing by a certain value. e.g. 10 % 3 = 1.
Cheers
Roy.
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS
Thanks mate I Will have a read over this and think of what I can do
@FryingBaconStudios - This is definitely something I would love to see in your tutorial videos and I think it would be a GS first in a whole new area.
- Edit. HOLY CONFUSING! lol. Can't wait till I learn it all.
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS
Shadows Peak is an atmospheric psychological horror that explores the dark side of a player.