Game Development Community

Scene keeps clearing

by Jacob Clark · in Torque X 2D · 12/19/2007 (8:13 am) · 12 replies

Im putting all 52 cards in a deck in templates off the screen and naming their scripting names different for each so as to hook up with my backend, but everytime i shut down txb and reload it, the scene erases. All of these cards are 1 frame animations on layer 0 from a master jpg which holds all 52 cards

#1
12/19/2007 (9:33 am)
Let's try to narrow down the problem between the things not being saved out properly, or not being loaded properly. If you save the scene and look at the levelData.xml file that you save, does it look like the cards are getting saved?
#2
12/19/2007 (9:57 am)
Yes i think so but now its working...

i tried this 3 times for all 52 cards, it takes a long time and this is very fustrating

now if i jsut add one it seems to stick, i dont know why but ill try to do all 52 again


EDIT ok after trying it once again, it doesnt work, i think what it is is the "_" in the script name, because just letters seem to stick not the _


but the 2_1 is being saved the the xml file so yes




CONCLUSION
DO NOT USE "_" IN SCRIPTING NAMES!!!! Im going to use 1.1 and 2.1
#3
12/19/2007 (11:03 am)
Sorry for the double post

so now i have done all 52 cards using the 1.2 naming style. and what i did was get all of those 52 cards and put them on the scene but now it is still not correct after restarting txb this is what i get

http://realworldwebonline.com/screen.jpg


man this is really messing with my head, i dont understand why it could be doing this
#4
12/19/2007 (11:59 am)
Can you explain in a little more depth what problem you're seeing? It's not obvious to me from the screenshot.
#5
12/19/2007 (1:30 pm)
Ok so bascially i have 52 cards and i line them up out of the cameras site according to suit

clubs
diamonds
hearts
spades


i put all these cards in lines in order going A23456789.... and so on

so i have four rows now with 13 cards in each row
alright so i got all of thier properties set up then i exit out of txb, later i go back in to txb (changing nothing in the code, this was just a test) and BAM all the sudden im just left with what you see in that screenshot

is there anyway i can get your instant messenger name or something? it might be faster, if so please email it to nascarjake@tx.rr.com
#6
12/19/2007 (1:55 pm)
So cards 3 through Jack in each suit are disappearing? Are they in the level_data XML file?
#7
12/20/2007 (11:34 am)
No they are not but why would it save the A-2 and J-K but not the others

hold on can i just make one animation object like i have now but instead of just one frame have 52 frames that dont cycle and then choose which frame i need when the time comes? is that a smarter idea? how would i do that? would i need a component?
#8
12/20/2007 (12:13 pm)
I'm not sure why some objects would be eliminated and not others.

Yes, you can definitely have multiple frames and select them (this is how the Airplane tutorial does it). If you're using the beta release, you could also used celled static sprites.

Since you're trying to add new functionality to your objects, a new component seems like it might be a good idea. It's hard to tell you exactly what to do, since there are lots of things that could work, but we need to find a solution that makes sense to you.
#9
12/20/2007 (12:52 pm)
Celled static sprites? i looked all around for that and i couldnt find them. You mean a feature sort of like TGB right? I dont know... i didnt see that

any way great so which airplane tutorial has that?

basically i have my backend that calcuates the player and dealers cards for a blackjack game, adds them up and also stores each number and suit of the card that way i can find the card on the front end and move it to a white square on my "felt" as you can see in the screenshot. Basically i just want to move the cards around according to the backend if that makes any sense, sorry it sounds so weird, its hard to explain
#10
12/20/2007 (12:58 pm)
Celled static sprites? i looked all around for that and i couldnt find them. You mean a feature sort of like TGB right? I dont know... i didnt see that

any way great so which airplane tutorial has that?

basically i have my backend that calcuates the player and dealers cards for a blackjack game, adds them up and also stores each number and suit of the card that way i can find the card on the front end and move it to a white square on my "felt" as you can see in the screenshot. Basically i just want to move the cards around according to the backend if that makes any sense, sorry it sounds so weird, its hard to explain
#11
12/20/2007 (1:07 pm)
You can get the Airplane tutorial either here or as part of the docs that are installed with the new beta.

I understand what you're saying in terms of what you want to happen at a high level, but I'm not sure where you're running into trouble translating that into implementation. Creating a cardComponent that controls which card face (or back, if you want to also display the card backs before they're flipped) you see on the screen definitely seems like a reasonable thing to do.

(Yes, celled sprites like in TGB. The celled sprites are part of the new beta. The new features in the new beta aren't well documented, so if you're having trouble that might not be the best place to go)
#12
12/20/2007 (1:33 pm)
Yeah ill just stick with this version for torque x for now

ok so ill check out that plane tutorial

and as for that component that is exactly what i want to accomplish flipping that backs over and stuff so yeah thats what ill do but see i tried that once and i wanted to get all those varibles from Game.cs to the compoent but i couldnt figure out how to make them global or anything like that


oh and also i was looking in the help file and i wanted to bind the A and B button on both the gamepad and the keyboard so i used this

InputMap map = new InputMap();
int keyboardId = InputManager.Instance.FindDevice("keyboard");
map.ProcessBind(keyboardId, (int)Microsoft.Xna.Framework.Input.Keys.Z, ZoomIn);
map.ProcessBind(keyboardId, (int)Microsoft.Xna.Framework.Input.Keys.X, ZoomOut);

int gamepadId = InputManager.Instance.FindDevice("gamepad0");
map.ProcessBind(gamepadId, (int)XGamePadDevice.GamePadObjects.GamePadObjects.X,ZoomIn);
map.ProcessBind(gamepadId, (int)XGamePadDevice.GamePadObjects.GamePadObjects.Y,ZoomOut);

// now push the map
InputManager.Instance.PushInputMap(map);

it says processbind doesnt exist as a method, but that was straight out of the help