'S' update as of 4/12/11

New releases and general discussions.

Post » Mon Feb 01, 2010 4:27 am

This doesn't work either. While it doesn't write to all positions at once, this time it won't write to any position outside 0. :|

Even if I hardcode in a slot number. I ever cut down everything to a single number array in an attempt to write to a particular index. It was a failure. This really seems like something is broken.
B
12
S
4
G
4
Posts: 238
Reputation: 2,426

Post » Mon Feb 01, 2010 9:13 am

my bad brother
I didn't even realize you were able to change slot numbers with q, so I had it always overwrite on the first slot...this works:

[url:2o9ywtep]http://dl.dropbox.com/u/1013446/saveexample2.cap[/url:2o9ywtep]

also, when adding stuff to an array you don't specify the index in the array address, I wasn't paying attention when I did that, you specify the index under "where"

Spriter Dev
B
88
S
21
G
12
Posts: 3,240
Reputation: 16,486

Post » Mon Feb 01, 2010 4:26 pm

Are you infringing on my Red Lines And Text On A Screenshot trademark? You'll be hearing from my lawyer.
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Mon Feb 01, 2010 8:50 pm

Hahah, thanks. You are the man, lucid.
B
12
S
4
G
4
Posts: 238
Reputation: 2,426

Post » Fri Jun 04, 2010 8:13 pm

Just a quick question is there a way to save the Layout number/name so that when you load the save file from one layout and sets the players position in different layout like for instance the player saves their game on the 5th layout and exits the game then 3 minutes later they decide to continue where they left off so they load the game and at the title screen on layout 1 they load that very same save file and they are placed on the very same layout same player position aswell. Is this possible to do this? The only possible I got was this but only saves the players position if they are in the same layout section but when you try to load the save file it wont put you on the same layout number only the coordinates:
B
1
G
2
Posts: 3
Reputation: 631

Post » Sat Jun 05, 2010 12:50 am

hi Kinila,
welcome to scirra. let me start by saying the 's' plugin is one of the more difficult things to use in Construct, and if used incorrectly, can cause crashes. Not trying to discourage you from using it, but in general, Construct is more intuitive and user friendly, so to make like easier, make sure Construct can't do it without 's' first, as it will probably be easier to do and more readable. Also, I've never used the built in save features on Construct. There very well may be a much simpler ways to do this, so if no one else replies here, you might try posting it as a general question in the help section.

But, back to your question
if you made a number array called, "layoutnumber", and a string array called "layoutname"
this would work:






you can name the arrays whatever you want,
but if you use layoutnumber wherever would normally use a number or equation, it will replace layoutnumber with the actual numerical value at runtime, and likewise with the layoutname wherever you can input text

so if you were on layout one and
set global('example') to layoutnumber + 4
global('example') would equal 5

or you could
Set Text to "hi, the name of this layout is " + layoutname
to have the name at the end of the sentence

these are System Expressions, and you get a list to choose from if you doubleclick the system icon while setting the parameters in any new action, condition, or expression
Spriter Dev
B
88
S
21
G
12
Posts: 3,240
Reputation: 16,486

Post » Sat Jun 05, 2010 2:02 am

Hi Lucid, the 's' plugin does have some difficulty but I am not affraid to move on from basic to more advance features and like to learn these experiences. All of which you explained made sense to me but when It came down to this:
[quote:2bjj7ar2]
so if you were on layout one and
set global('example') to layoutnumber + 4
global('example') would equal 5[/quote:2bjj7ar2]
wouldn't that set the global from layout 1 to a number equal to layout 5? how would a variable of this load the save file to set the player from layout 1 to where he saved his game?

I am not even sure if I made a example good enough but here is another screenshot with those layoutname/number in the code with a example.


Sorry if I am not getting what you said just started using Construct 2 days ago.

Also the Event Sheets as you see there are about 9 of them. Reason for this is that it makes it easyer to recreate a fresh more organized Layout event sheets that has a linked and similar setup for the player, saveing, moving, death etc and if theres a glitch or bug in those variables it makes it similar fixing the glitch in the game if I edit 1 linked event sheet instead of multiple ones.
But later on for the save feature for the title screen event sheet ill set it so that if player shoots (or clicks) a sprite it loads game file 1 or 2 depending on how this game goes in the future.

Kinila
(Naiakoa the Time Lost Gamer)
B
1
G
2
Posts: 3
Reputation: 631

Post » Sat Jun 05, 2010 8:06 am

Hi,

How do you save private variables for sprites that are part of the family?

I'm creating a sprite formation editor that will eventually hold PVs to determine the behaviour of any sprite after loading data from external files at runtime. This will save me masses amount of time.

Im having a hard time trying to save and load PVs with the associated object array. Much like the level editor it will save/load XY positions. Trying to save various PVs into number and string arrays but dont know how to reassign them to indexed sprites. Sprites will have differing variable values and don't want to assign all the objects the same value...unless theres another way Ive completely over looked about how to approach this?

Thanks for any ideas
My Games on google play

ImageImage
B
30
S
6
G
4
Posts: 97
Reputation: 3,008

Post » Wed Jun 09, 2010 3:00 am

Never mind on my other post I just got what I was looking for. What you posted lucid did help with the saving the layout number/name but you left out what one thing that I just figured out. For you to actually load the layout properly without errors is to set the event:

thanks for the saving solution just took me a while to get the loading correct


Edit: ok...it saves and loads layout but only one problem if there is another save point once saved then reenter the game it does load the layout but not the coordinates this might take a while to figure out why....

Edit: ok im an ideot lmao i figured it out again and works lol upon the title screen i added a ContinueGame button and the variable for that is:


Then set 2 new global variables:


then on the seperate event sheat named save function for my game i set the foolowing:


Now for a small explaination of what i did When player plays the game and save shooting the save box it saves their layoutnumber and name X and Y coordinates into a file named save.sav at the same location the game is ran. when the player exits their game totake a break the game stays saved and when they return to the game they click the button at the title screen labled Continue Game immediatly when they click that the save file sets the coordinates in the global varialbes and then loads the layout number of where they left off at. Now since my game has multiple save points the player needs to be positioned where exactly they saved at this is where the global values come from Immediatly when they load layout the game checks the global values if it has numbers in it greater than 0 the player is set to those coordinates and then sets it back to 0 there was a loop in this so the Trigger Once feature fixed that.

If anyone knows a much easyer and bit more organized way to set this up just let me know im up for suggestions :lol:

Kinila
(Naiakoa the Time Lost Gamer)
B
1
G
2
Posts: 3
Reputation: 631

Post » Thu Jun 10, 2010 12:26 am

sorry kinila, forgot to check back to this post, but glad you figured it all out

[quote="4ror":1n872g00]Hi,

How do you save private variables for sprites that are part of the family?

I'm creating a sprite formation editor that will eventually hold PVs to determine the behaviour of any sprite after loading data from external files at runtime. This will save me masses amount of time.

Im having a hard time trying to save and load PVs with the associated object array. Much like the level editor it will save/load XY positions. Trying to save various PVs into number and string arrays but dont know how to reassign them to indexed sprites. Sprites will have differing variable values and don't want to assign all the objects the same value...unless theres another way Ive completely over looked about how to approach this?

Thanks for any ideas[/quote:1n872g00]
[code:1n872g00]for each object in array (pick current)
add your pv to the "end" of your private variable array

upon loading all sprites to new instances
for each string (or number) in your private variable array (let's say this loop is called "myloop")
-----pick {"yourobjectarray",.li("myloop")} as yourFamily
-----set yourFamily's PV to .n({"yourprivatevariablearray",.li("myloop")})[/code:1n872g00]
that should assign each sprite with the original private variable it had, regardless of what type of sprite as long as it was a member of yourFamily

alternatively, once you're fairly comfortable with the 's', depending on what pv features you do and don't need, you may consider not using PVs at all, and just using 's' arrays to begin with. but the above solution would work.

let me know if my pseudocode made no sense, and I'll go into more detail
Spriter Dev
B
88
S
21
G
12
Posts: 3,240
Reputation: 16,486

PreviousNext

Return to Construct Classic Discussion

Who is online

Users browsing this forum: No registered users and 1 guest