Page 1 of 1

Problem in my game

PostPosted: Sat Jan 05, 2013 7:13 pm
by BogdansB
hello

i would appreciate if you could find where the problem is.
after clicking on the FIGHT button , the game works fine. the enemy hits and moves , everything good.
after him killing you or you killing him, you get in the menu. still all good. but when you click FIGHT again , the enemy just doesn't attack.
i wonder why..



here is the game.(not finished at all)

Re: Problem in my game

PostPosted: Sat Jan 05, 2013 8:35 pm
by skydereign
There is no fight button. This just seems to be the fighting mechanic. Perhaps you had a menu ged? Also, it doesn't seem to try to move back to the menu when the player or enemy dies.

Re: Problem in my game

PostPosted: Sun Jan 06, 2013 2:08 pm
by BogdansB
whoops wrong file :S sorry

Re: Problem in my game

PostPosted: Sun Jan 06, 2013 6:16 pm
by skydereign
Ok, the problem is you don't reset your variables. At the start of the game, gegner_attack is by default zero. All variables that weren't set are. That variable is used to prevent the actor from attacking while already attacking. The player and enemy can only lose the game when the other is attacking, and therefore that variable is set to one at the time. The actors involved are destroyed before the variable can ever be set back to zero, therefore stopping the ability to attack next game.

A tip if you don't already know. You can use text actors to help debug your game. What I used to find your problem was an sprintf of the variables I found in enemy -> collision with attack zone -> script editor. Here's the sprintf I used in a text actor I created.
text_display -> Draw Actor -> Script Editor
Code: Select all
sprintf(text, "attack: %d\nattack_if: %d", gegner_attack, gegner_attack_if);

That way you can know what values those variables have, and determine yourself why the if statement isn't triggering.

Re: Problem in my game

PostPosted: Sun Jan 06, 2013 7:22 pm
by BogdansB
thank you ! :) :mrgreen: :mrgreen: :mrgreen: :mrgreen: