Advanced Logic. Tutorials?

ozboybrianozboybrian PRO Posts: 2,102
edited February 2012 in Miscellaneous
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.

Comments

  • POMPOM Member Posts: 2,599
    Not sure exactly what your asking here Brian .. Maybe try to be a bit more specific , cause I think I can help..
    Are you asking what this function "%" does ?

    Roy
  • ozboybrianozboybrian PRO Posts: 2,102
    Hey 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.
  • POMPOM Member Posts: 2,599
    Well.. I believe the cookbook has an explanation on all the functions that can be used in the expression editor ..
    Have you looked there?!

    Roy.
  • dmilinovichiiidmilinovichiii Member Posts: 620
    It sounds more like you need to learn/relearn (depending on your age) high school math. It might help just to find some website explaining basic trigonometry.
  • ozboybrianozboybrian PRO Posts: 2,102
    I guess my math could be better lol. I'm 24. Scraped through Math. That was due to laziness though.
    Math cool. But tutorials explaining with GS would be cool.
  • POMPOM Member Posts: 2,599
    edited February 2012
    Since you are so lazy (you said first :) ) here is some food for your brain :

    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.
  • ozboybrianozboybrian PRO Posts: 2,102
    edited February 2012
    lol! I will give you that Roy ;)

    Thanks mate I Will have a read over this and think of what I can do :D
    @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.
  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922
    I'm dyslexic so you don't want me teaching math..lol
  • ozboybrianozboybrian PRO Posts: 2,102
    edited February 2012
    Bahahaha... I've spoken to you on Skype, I can make out what you're saying :P
  • ozboybrianozboybrian PRO Posts: 2,102
    @Anyone - So. Do I have to go back to school to understand how to make this work in games?
  • simo103simo103 Member, PRO Posts: 1,331
    edited February 2012
    @ozboybrian ... 'I resemble your remarks' ..... hey Brian you're not alone ... I play around with some of the great demoes people put out and change a few numbers around and sometimes it does what I wanted ... but I have no clue why :D. Try poking around here: http://www.khanacademy.org/ I have learnt a few things from here and they seem great at explaining it for us mortals.
  • DimensionGamesDimensionGames PRO Posts: 993
    @simo thats a pretty sweet website! Might try and work through some of that stuff :'(
  • imGuaimGua Member Posts: 1,089
    I would love to see tutorials on use of that stuff. With a lot of in game examples.
Sign In or Register to comment.