game logic between scenes

Hi, I’m a n00b.

I’m trying to create a simple game in which you have to collect some coins. The thing is that it should show the score. What I do is add 2D meshes in another scene, so when the game is executed one scene overlays the other. But when I connect sensors between the main scene and the score scene nothing changes…

any ideas?

You can’t connect logic bricks of objects that are in different scenes.

To count scores,

  • you can send messages. Messages are received by all message sensors in active scenes.
  • you can access the counting object via Python and change its properties.
  • you can store the count in an persistant dataspace (e.g. GameLogic.globalDict) and let the counters access this object too.

yeah! the messages made the trick. thank you!

Ive got a question… how do you copy an game property value from an object in another scene… i used property actuator, copy… no luck huhuhu… needed it badly…
the setting is like this:
scene 1:
ob: lvldoor
-property: sensorscore
scene 2:
ob: empty.003
-property: totalScore

the scene two overlays when character is near at the lvldoor obj, and a pop-up question is shown(scene 2)

the easy way would be using the global dict


import bge
dict = bge.logic.globalDict
dict["score"] = object1[property1]


import bge
 dict = bge.logic.globalDict
object2[property2] = dict["score"]

if you want to do it with properties you can access them by pointing to the object


object2[property2] = object1[property1]

i think it should be better to open new threads to answer new questions…

thank you for the reply… sorry about that but no one answered me when i post a new thread… =)

object2[property2] = object1[property1]

so how would i use this?
#is this right?
empty.003[‘totalScore’] = lvldoor[‘sensorscore’]

sorry i am new to blender…
what is the use of dict[“score”] <- is score here a property name or an object name?

I will only have to access the empty.003 [property] and put it in lvldoor [property]…

i think it should work
globalDict is just a python dictionnary you can use to store values that you can share between objects and scenes (even if you restart the scene)

globalDict is just a python dictionnary you can use to store values that you can share between objects and scenes (even if you restart the scene) I see… thanks for the information… so that means i don’t have to use the globalDict in this case?

I guess you don’t

So if im not gonna use globalDict… what am i gonna use to access the objects? should i put them in variables?
#haha i messed this one up… not quite right
import bge
var1 = empty.003[‘totalScore’]
var2 = lvldoor[‘sensorscore’]
var1 = var2