Hi, i'd like help to make this in a game:
Imagine a platformer (like Wario) where the player goes through the level, picking up coins and such, mabye missing a few, and then leaves the level. Afterwards he has to RETURN to the level, and the coins that he took when he went through it first should be gone (because he has already taken them). But it's really hard to make that!! How would you guys be able to do this?
I have the ENTIRE C&C: Tiberian Dawn soundtrack. Extracted from the original game, in all it's succulent beauty. Oh baby, it's true. PM me for details on how to get it if you want.
DaVince This fool just HAD to have a custom rating
Registered 04/09/2004
Points 7998
26th January, 2005 at 06:59:23 -
I don't know. I wanted to do the same, but I gave up.
My best bet is to save the coin position & number after the level is exited, via the array object & then load them back up with the array object, but the first time you enter the level, the array save file is the levels coins all in place. Then you just save over it as you leave the level.
Basic your making a level editor that saves & loads automaticly & the level design is based on what coins you collect.
This is something i never really thought of, though hope this helps.
Actually this is your lucky day. I did this exact same thing once before, but with enemies as well.
You can use an INI, an array, or some other such thing.
I personally used an INI when I did it, because for once it was the best choice in my opinion.
You basically need to think 'what kinds of objects do I need to save?'
In your case it's just one type of object - 'coins'.
So in our INI file we'll have a group called [obj - coins]
Now, at the start of the game, spread a value of 1 in 'Alterable Value A' of the coins.
This will give each coin a unique ID number in its value A.
Next, add an item in the INI (inside the 'obj - coins' group) and call it 'total'. Set the value to the total number of coins in the level.
When a coin is 'destroyed', set another item inside the group. Call it 'id: #' where # is the ID number of the object you destroyed. Set the value of this item to '1'.
So if we have a level with 30 coins, and you pick up coin numbers 5, 9, 22 and 11, you should have an ini file like this:
Once the level starts, and the ID numbers have been assigned to all the coins, you want to use a fastloop to scan through these. It will loop once for each coin (in this case it will do so 30 times, because there are 30 coins). On each loop it looks for an item called 'id: #' - where # is the index of the loop. So loop number 1 looks for 'id: 1'... loop number 2 looks for 'id: 2' and so on right up to 'id: 30'.
If the value of one of these is '1', then it knows that coin has been destroyed before, so it destroys that coin again.
Fun! I hope I explained that okay.
191 / 9999 * 7 + 191 * 7
DaVince This fool just HAD to have a custom rating
If you're trying to build the levels straight in MMF using the frame editor (the most common way of making levels in TGF and MMF) then INI is probably nicer to use.
But to be honest you'll make a far better game by building a level editor. You can make immensely powerful games that way - they literally dwarf anything made the traditional way.
For games using a level engine like that, an INI is usually used to control the positions of almost every object and tile in the game, so it's immensely easy to just save state and recall it at any time. That's not just saving the coins that have been destroyed, but the decal tiles created, the sounds that were playing. EVERYTHING.
To put that in perspective, it's loading every bullet hole, every footprint, everything you could possibly want it to remember.
It takes longer, but it is sooo sweet. And you can do so much more. You can make stuff like physics relative to the tile you walk on (so ice is slippery, grass makes you move slower, water causes you to swim, a shoreline causes you to paddle, mud gets you stuck, toxic slime causes you damage), and even sounds (footsteps change depending on the surface you walk on, water ripples when you wade in it). And all the tiles are STILL just background objects!
You can even update tiles on the fly, so water randomly shimmers and glistens.
lmao, you get a bit carried away. thanks for all the help boys!
I have the ENTIRE C&C: Tiberian Dawn soundtrack. Extracted from the original game, in all it's succulent beauty. Oh baby, it's true. PM me for details on how to get it if you want.
God technique, Dines. That's exactly what I would have done. However I have never tried it, it's just the method I had in my head for the time. Since I'm never sure if the 'spread value' option will depend on the position of the object or is just random.
I'll explain what I mean. Say you did spread value to give each object it's number, what if the next time you returned to the frame, it gave the object a different number? Is there a specific order in which it distributes the values among items relating to their position in the playfield?
If this was the case, it would just destroy random ones. Guaranteed it'd destroy the amount you've collected, but not necessarily the same ones, so I'd go with the method of saving it's x and y co-ordinate and destroying the one which is at that position(if the object moves than just use 2 of its values to store it's x and y co-ordinates at the start of the frame and go with that instead).