I'm making a 3D version of Tic Tac Toe, (using cubes and spheres rather than Xs and Os.) I've successfully gotten alternating objects to spawn where I want them, while preventing an object from being placed in a "filled" spot. [I figured out a way to count the moves too, but it's rather convoluted and will have to be improved later.]

What I want to do next is make it so players can undo moves in succession. What I've been told is that I need to record moves, or entire board layouts, and go back to an earlier place in the game. That makes sense, but what I don't understand is exactly how to achieve that, and I think my problem is conceptual more than scripting. In other words, I don't understand some things about blender, and if I did I could probably figure out the scripting part.

Primarily, when objects are spawned, how does blender keep track of them? There has to be someplace where blender keeps a list; spawnedCube1, spawnedCube2, etc. And if so, is there some way to access this information and do something like; spawnedCube2(end).

Also, if I wanted to revert to an earlier version of the board/game, I'd still have to erase what's on the screen. Is this done with layers, scenes, or is it just a matter of scripting?

  • $\begingroup$ BGE LOGIC API $\endgroup$ – Strapicarus Oct 19 '17 at 16:38
  • $\begingroup$ Yeah, I've looked there a few times. I'm a complete beginner with both blender and python, or any type of coding or programming. I don't see anything on that page that relates to the problem I'm having, or that answers my question. Could you at least narrow it down to a section for me? $\endgroup$ – quazipseudo Oct 19 '17 at 16:54
  • $\begingroup$ I have no idea how to use globalDict. These are the errors I'm getting: TypeError: 'dict' object is not callable AttributeError: module 'GameLogic' has no attribute 'getGlobalDict' ImportError: No module named 'bge.logic.globalDic'; 'bge.logic' is not a package $\endgroup$ – quazipseudo Oct 19 '17 at 17:17
  • $\begingroup$ Before you mention that you could figure out the scripting part and now you mention that you dont know how to programming?. I dont know how you are trying to do what you trying do. If you put more information, your scripts and an image of your logicEditor to understand what have you done or how you are trying to do. With the error you mention i can tell you that the way that you trying to import is wrong, use 1) import bge then you can use bge.logic.globalDict['keyname'], or 2) from bge import logic -> logic.globalDict['other_key'], and why you are trying to use globalDict $\endgroup$ – Strapicarus Oct 20 '17 at 0:12
  • $\begingroup$ And i post the wrong link again... this is what should post BGE KX_GameObject.endObject $\endgroup$ – Strapicarus Oct 20 '17 at 0:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.