Copy Property values?

This has proberly a very easy answer to it but…
How can I Copy Property values from other Objects or Scenes in-game? Let’s say I want a GameOver scene that shows my score and the score property was calculated in Object1 in scene Level1?? How do I do that?

I would put the score in a global variabel. In Blender you put your global variables in a module called GameLogic.
When you start the game, run a pytonscript were you create your variables like this:


import GameLogic
GameLogic.Score = 0

Then in your game when the score changes you run another script where you update your global score variabel.

Add a pythoncontroller connected to your player (or whatever object that has the score).


import GameLogic
Cont = GameLogic.getCurrentController()
PlayerOwner  = Cont.getOwner()

GameLogic.Score = PlayerOwner.Score

This variabel can be reached from what ever scene you’re in.

Thanx Peter!! :slight_smile:
But it should be done without Python I think… too bad you can’t

well, if you have your end game screen as a overlayscene I think you could use the message actuator to send the score from your gamescene to the overlayscene. I think… :-?

Yes I have but How can I send propertys and their values with the MessageActuator???

Well… i don’t know if this kan be done but…

Can we use an empty with the score property that is linked to all scenes?

When playing, a text object will obtain the value of this empty, and any score changes will be applied to the empty, and in the highscore list, the list can obtain the value of the empty…

Again, not sure it can be done… but in theory it seems logical… or maybe not?

I’ve tried to send values with an scene-linked empty but somehow the property of this empty is not linked :frowning: so it doesn’t work

Ahoi,
Adilim

The best is to use messages to alter both values at once if not using python, and to use global variables (GameLogic.MyProp = 5) if using python.

Global variables are VERY easy to save.