help my fighting game ..

guys , i have a problem with my fighting game , i use game engine blender 2.59 .

i have 3 objects , it use BGE realtime font and it work fine

  1. time (battle time 60s)
  2. health player 1
  3. health player 2

the problem is , how to make this thing ?
when time = 0 ,
if health player 1 > health player 2 , set scene ‘player 1 win’
if health player 1 < health player 2 , set scene ‘player 2 win’
if health player 1 = health player 2 , set scene ‘draw’

nb : sorry if my english bad :o

Yup, that’s exactly what you are trying to do.
What is health?
How about making health an integer property?
Then you can use the property logic bricks for sensing, and the scene actuators.

What is TIME?
Is it a number that keeps increasing at a constant rate?
How about a timer property?

i confused to connect the logic brick ,
where i set up the logic brick , in time or health object , or the both of it ,

the health object , it have property integer ,
and time have integer property too , and it decrease every second ,

should i attach .blend file ?

It seems you already know what to do. I’m not sure if you’d rather use python or logic bricks…

But, I think the most conservative way of accomplishing this would be to use Messages. Like, send a message to a text object in the Game Results scene - notifying that object, as well as others, that (this happened). You could make the text object to change its text, depending on who won. This would save space and memory.

here the blend file ,
http://www.mediafire.com/?gaumcffr6gc1lnc (8MB)

i confused to connect the logic brick and send a message , so the time know the lowest health , can u fix it (if u not busy)
so i can learn it ,

nb : sorry for the bad thing in that game (like the model :o) , i’m still new in this thing , but im interesting in that and want to learn more and more

o y , and this the realtime font i used

here the simple .blend file i made ,
please help configure the logic brick this thing


when time = 0 ,
if health player 1 &gt; health player 2 , set scene 'player 1 win'
if health player 1 &lt; health player 2 , set scene 'player 2 win'
if health player 1 = health player 2 , set scene 'draw'

Attachments

health.blend (446 KB)

To transfer a property to another scene try this method:

  • send a message
  • switch scene

in new scene

  • read the message

Check the example

  • to see health - enable Display Debug Properties

Attachments

MessageForSaving.blend (415 KB)

this same with my problem :slight_smile:

om moster, how to include S2A library in my project ???

append the text block S2A.py. <shift+F1>

ok monster :slight_smile:

thank`s :slight_smile: it’'s work

ok monter , i try , thanks for the tutorial and the source ,
hope it can work fine soon .

mr. monster , i check .blend file u gave ,
but i not find space sensor keyboard , where u put it ?

and how to show player.health in the corner ?

oh i get it , i found the space sensor ,
but why u used empty ? why not in the cube ?
and why the space sensor connect to message , why not go to next scene ?

edit :
hahha , i found how to show the player.health in the corner ,
but it will not show when export to exe , i need to make realtime font ,

monster , what the different , if the sensor i not set it to true and false ,
why u make the message sensor true ?