How can you attack an actor multiple times unitl they get destroyed?

reginald.bernardinreginald.bernardin Member Posts: 346
edited May 2012 in Working with GS (Mac)
Ya i want to attack an actor multiple times to destroy him, kind of like a boss character. I want to make a rule like this: if the actor is pressed like 7 times destroy the actor? any suggestions?

Answers

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited May 2012
    Create an integer attribute self.health and set it to 7.

    When Touch is Pressed --> Change Attribute self.health to self.health-1.

    When attribute self.health<=0 Destroy Actor.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • GLGAMESGLGAMES SingaporeMember Posts: 988
    oh so index are only positive integers?
  • MotherHooseMotherHoose Member Posts: 2,456
    edited May 2012
    numbers are numbers to a computer (by definition a computer computes numbers)
    a bit is either a 0 or 1; a byte is a group of bits
    your OS translates your input to the computer's language of zeroes and ones
    while translating the computer's stored/computed values to human language for output

    In GS … attributes store values:

    boolean: stores 0 (false) or 1 (true)

    text: stores text and numerical values
    … if there are no letters in text field
         numerical values are treated as numbers (1, 2, 3, 4, etc.)

    integer: stores positive or negative whole numbers (no fractional/decimal values)

    index: stores positive whole numbers

    real: stores positive or negative whole or irrational numbers (fractional/ decimal)

    angle: stores positive or negative whole or irrational numbers within the range 0-359

    for all default attributes … the type is preset
    for those attributeTypes and for the attributeTypes we create
    -bytes in RAM are allocated by the computer
    … obviously: booleanTypes require the least amount of RAM
        then indexTypes … then integer … then angle … then real … then text
    so selecting the correct type … is efficient use of the computer's resources

    all types of numericalValues can be manipulated with the mathematical operants (+-*/)

    (enumeration is another numericalType of attribute with a specific range value
    … but we can not alter those during runTime)

    image MH
Sign In or Register to comment.