3-hit combo ?

Diese Seite verwendet Cookies. Durch die Nutzung unserer Seite erklären Sie sich damit einverstanden, dass wir Cookies setzen. Weitere Informationen

  • 3-hit combo ?

    Hi ho leute

    ich hab folgendes problem:

    ich haette bei meinem rpg helden gerne eine "3er-schlag combo"

    so sollte es funktionieren:

    wenn man die space taste drueckt soll die 1. angriffsanimation starten
    wenn man innerhalb der animation noch einmal space drueckt soll die 2. animation starten
    und wenn man innerhald dieser animation space drueckt soll die 3. starten
    zum schluss sollte der charakter wieder in die ausgangsanimation

    ausserdem sollte man die combo auch nach 1nem oder 2 schlaegen beenden koennen koennen

    ausserdem haette ich das ganze script gerne nur in einem object

    bisher hab ich nur die 1.animation hinbekommen.
    danach weis ich nichtmehr weiter

    Hier ist das script dass ich bis jetzt habe:

    create Event

    attacking=false
    combo=0

    Step Event

    if attacking = false and combo = 0
    {
    if keyboard_check_pressed(vk_space)
    {
    if direction > 90 and direction < 270
    {
    sprite_index = hero_left_attack_1
    speed = 0
    image_index = 0
    image_speed = 0.8
    attacking = true
    combo = 1
    }
    else
    {
    sprite_index = hero_right_attack_1
    speed = 0
    image_index = 0
    image_speed = 0.8
    attacking = true
    combo = 1
    }
    }
    else if keyboard_check_pressed(vk_space) and combo = 1
    {
    if direction > 90 and direction < 270
    {
    sprite_index = hero_left_attack_2
    speed = 0
    image_index = 0
    image_speed = 0.8
    attacking = true
    }
    else
    {
    sprite_index = hero_right_attack_2
    speed = 0
    image_index = 0
    image_speed = 0.8
    attacking = true
    }
    }
    }

    animation end Event

    if sprite_index = hero_left_attack_1 or sprite_index = hero_right_attack_1
    {
    attacking = false
    combo = 0
    }

    so wie es jetzt ist funzt es fuer den 1. Schlag

    Ich bedanke mich schonmal im vorraus fuer die antworten ;)

    - StillBurn
  • Ok, also ich bn grad in der Arbeit aber ich denke ich hab einen guten Ansatz.
    Du brauchst ein Array/grid in dem die Animationen gespeichert sind für dei Combo

    GML-Quellcode

    1. comboanim[0] = hero_idle;
    2. comboanim[1] = hero_attack_01;
    3. comboanim[2] = hero_attack_02;
    4. comboanim[3] = hero_attack_03;

    Dann brauchst du eine variable combo und am besten auch gleich eine für die Zeit die du hast ncohmal zu drücken um die combo auszulösen, der Schwierigkeitsgrad kann diese zeit dann knapper machen

    GML-Quellcode

    1. combo = 0;
    2. combo_time = 30;

    dann machst du in etwa sowas hier:

    GML-Quellcode

    1. if keyboard_check_released(vk_space) && combo < 3
    2. {
    3. combo += 1
    4. alarm[0] = combo_time
    5. sprite_index = combo_anim[combo]
    6. }

    und im alarm[0]

    GML-Quellcode

    1. combo = 0;

    combo steht wieder auf 0 udn die combo beginnt wieder von vorne. solange der Spieler allerdings space drückt wir d die combo am leben gehalten bzw bis zu 3x

    es gäbe ncoh ein paar andere Wege zu diesem ziel zu kommen, aber das sollte dich schonmal auf den richtigen Weg bringen

    ancient-pixel.com
    youtube.com/user/SebastianMerkl <<< ich freu mich über einen Besuch ;)
  • ok habe versucht das ganze anzuwenden und es funktioniert :thumbsup:

    abe ich habe jetzt das problem das wenn man die space taste mashed das mitten in der animation gleich zur naechsten springt :|

    create event

    GML-Quellcode

    1. combo = 0
    2. animationleft[0] = hero_left_idle
    3. animationleft[1] = hero_left_attack_1
    4. animationleft[2] = hero_left_attack_2
    5. animationleft[3] = hero_left_attack_3
    6. animationright[0] = hero_right_idle
    7. animationright[1] = hero_right_attack_1
    8. animationright[2] = hero_right_attack_2
    9. animationright[3] = hero_right_attack_3
    Alles anzeigen


    step event

    GML-Quellcode

    1. if keyboard_check_released(vk_space) and combo < 3
    2. {
    3. if direction > 90 and direction < 270
    4. {
    5. combo += 1
    6. sprite_index = animationleft[combo]
    7. speed = 0
    8. image_index = 0
    9. image_speed = 0.8
    10. alarm[0] = 15
    11. }
    12. else
    13. {
    14. combo += 1
    15. sprite_index = animationright[combo]
    16. speed = 0
    17. image_index = 0
    18. image_speed = 0.8
    19. alarm[0] = 15
    20. }
    21. }
    Alles anzeigen


    alarm 0

    GML-Quellcode

    1. combo = 0