hidden object game

For questions about using Classic.

Post » Mon Jul 04, 2011 12:57 pm

I decieded to make a hidden object game at first. I think it will not be that hard and it will be good start.
I have a first problem. I made a private variable for items and if I click on item, then I want to add to score 10 points. But if I click last item score jumps to 0. I am adding a cap file, any ideas what can I have wrong?
B
4
S
2
G
1
Posts: 143
Reputation: 1,211

Post » Mon Jul 04, 2011 1:06 pm

You are adding 10 to objects private variable, when you press on all three score will be equal 0, because there's no objects on layout with score variable.

Make new global variable "global score" and after pressing on object add 10 to that global variable - not private.
ImageImageImageImage
B
140
S
58
G
36
Posts: 2,547
Reputation: 31,170

Post » Mon Jul 04, 2011 1:40 pm

thanks, please how can I make variable global?

and another thing appears strange to me now. when I copy layout, it copy only layout, but without events. is it possible to copy whole layout with all events?
B
4
S
2
G
1
Posts: 143
Reputation: 1,211

Post » Mon Jul 04, 2011 1:48 pm

[quote=]thanks, please how can I make variable global?[/quote]

In Project bar - where you have list of layouts, event sheets, objects... there's a "Global Variable" - right click on that and select "Add global variable"

[quote=]and another thing appears strange to me now. when I copy layout, it copy only layout, but without events. is it possible to copy whole layout with all events? [/quote]

Don't know :D
It's a good habbit to make seperate event sheetsand then just include one you need to your layout event sheet.
ImageImageImageImage
B
140
S
58
G
36
Posts: 2,547
Reputation: 31,170

Post » Mon Jul 04, 2011 2:55 pm

shinkan: thank you so much, it really works now :)
only thing which I miss now is that when I finish layout (level) I want to add score to some global score on main menu. but it seems again as a work for an array, which i still dont understand...
here is almost finished cap for hidden object game:


when I will be able to make all what I need to have in game, then I will start to make finally some graphics :)
B
4
S
2
G
1
Posts: 143
Reputation: 1,211

Post » Tue Jul 05, 2011 2:17 pm

Can some help me, please?
Im still stuck at the same problem :(
when I go from one level to another I have a global variable and adding score to "global score". But when I exit game and then start again and click in main menu on score, it shows value- "0" . How can I save this information, so when I start game again it shows "score"...

I know- array, hashtable, ini ... - I tried to use them many times, many hours and I cant figure out how to use this ...
B
4
S
2
G
1
Posts: 143
Reputation: 1,211

Post » Tue Jul 05, 2011 2:55 pm

Start with adding array object to your game.
Then set so every now and then an event trigers (when moving betwen levels or at exiting the game)
array -> set value at X
array -> save AppPath & "[insert_file_name_here]"

Do the same at the start of the game but just the load:

array load AppPath & "[insert_file_name_here]"

do make you understand arrays (which sounds scary) lemme compare it to Excel sheet. So you have rows and colums. The only diffrence is that array can be rows only, or rows and columns only, or rows and columns + additional 3rd dimension. like X, Y and Z axis.
And you store your information inside. You just have to remember what is where. Under what coordinats

for example. if i want to save a value of the score you can use just 1 dimensional array with X axis only. And so you would:
Set array value (X1, Y1) -> 10
and then at "save point" you do
Array save -> AppPath & "Array name"

This will save your array file in the main exe folder. The file name will be whatever you typed in "Array name". Ofcourse you can also add some extension name to it like "ArrayName.rar". And why it would benefit you read here
http://www.scirra.com/tutorials/39/how-to-secure-your-game-assets
B
16
S
5
G
4
Posts: 211
Reputation: 3,767

Post » Tue Jul 05, 2011 3:05 pm

fixed

Your post didn't show for me...

Here's the fixed file useing INI object


And one more thing. System actions save and load don't work properly and better don't use them.shinkan2011-07-05 15:59:40
ImageImageImageImage
B
140
S
58
G
36
Posts: 2,547
Reputation: 31,170

Post » Tue Jul 05, 2011 5:09 pm

I dont know what is wrong with me, but I cant still get it working :(

shinkan: when I load your fixed file, it still does not work to me and I dont know why :(

the_funny_guy: I tried to make exactly how you told me and I dont know why it does not work, here is cap:(

I know internal save/load system is not the best, but I need to use it until I finally learn how to use array or ini

The thing I want to achieve here is that at the end of the level (now there are 2 levels in this cap) the score will add to "global score" and whenever I start application I want to have in menu under "score" final count of score...
B
4
S
2
G
1
Posts: 143
Reputation: 1,211

Post » Tue Jul 05, 2011 5:15 pm

What do you mean it's not working?
I just opened it -> clicked score -> shows me score = 0 -> Run the game -> get 30 points and press X to close.
Run again -> clicked od score in menu -> shows me score = 30.


ImageImageImageImage
B
140
S
58
G
36
Posts: 2,547
Reputation: 31,170

Next

Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 0 guests