Problem in my game

Talk about making games.

Problem in my game

Postby BogdansB » Sat Jan 05, 2013 7:13 pm

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)
Attachments
Gladiator.rar
please don't copy my game ^^ :D
(13.15 MiB) Downloaded 145 times
BogdansB
 
Posts: 94
Joined: Tue Oct 25, 2011 2:30 pm
Score: 0 Give a positive score

Re: Problem in my game

Postby skydereign » Sat Jan 05, 2013 8:35 pm

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.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: Problem in my game

Postby BogdansB » Sun Jan 06, 2013 2:08 pm

whoops wrong file :S sorry
Attachments
gladiator.zip
this one should be the right one
(13.5 MiB) Downloaded 159 times
BogdansB
 
Posts: 94
Joined: Tue Oct 25, 2011 2:30 pm
Score: 0 Give a positive score

Re: Problem in my game

Postby skydereign » Sun Jan 06, 2013 6:16 pm

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.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: Problem in my game

Postby BogdansB » Sun Jan 06, 2013 7:22 pm

thank you ! :) :mrgreen: :mrgreen: :mrgreen: :mrgreen:
BogdansB
 
Posts: 94
Joined: Tue Oct 25, 2011 2:30 pm
Score: 0 Give a positive score


Return to Game Development

Who is online

Users browsing this forum: No registered users and 1 guest