Posted By
|
Message
|
Lonesome Drifter
Registered 28/05/2012 18:24:24
Points 14
|
23rd June, 2012 at 23/06/2012 19:26:36 -
I just tried looking through this site to find some helpful tutorials but most of them are all from expired sites. Kind of a downer.
I'm looking for a tutorial on the basics of using flags and variables, how to put Flash movies into my game for cutscenes, and a weather/Fog effect tutorial.
Any help would be appreciated.
n/a
|
lembi2001
Registered 01/04/2005
Points 608
|
23rd June, 2012 at 23/06/2012 20:11:43 -
How much experience with Click products do you have??
I'm assuming it isn't much as you have asked about using flags and variables. The best thing to do initially would be to follow the choco break tutorial (i think it ships with both MMF2 and TGF2)
n/a
|
Lonesome Drifter
Registered 28/05/2012 18:24:24
Points 14
|
23rd June, 2012 at 23/06/2012 23:54:50 -
How much experience do I have with MMF2 you ask? Not as much as many of the people on this site. But I still want to learn as much as I can. The thing is I just started using MMF2 after a long hiatus.
And yes, I did do the Choco Break tutorial first when I reinstalled the program. It does not introduce me to using Flags, so I don't quite understand how they work.
n/a
|
nivram
Registered 20/07/2006
Points 171
|
24th June, 2012 at 24/06/2012 01:04:05 -
I have an open source example on my website named "Light Switch Flag Example". It may help.
Marv
458 MMF2 & CTF 2.5 examples and games
http://www.castles-of-britain.com/mmf2examples.htm
|
AndyUK Mascot Maniac
Registered 01/08/2002
Points 14586
|
24th June, 2012 at 24/06/2012 01:36:05 -
Flag are incredibly simple!
It's just a value that can be set to either off or on. Or you can toggle them.
Then you can test what the flag is set to to make something happen in game.
Variables are similar but they can range from -9999999999999999 to 99999999999999 or something arbitrary. But you can also add and subtract from variables. Unlike counters they're internal.
Edited by AndyUK
.
|
s-m-r Slow-Motion Riot
Registered 04/06/2006
Points 1078
|
25th June, 2012 at 25/06/2012 13:15:54 -
I second AndyUK's comment about flags and how 'incredibly simple' they are. He pointed out the fundamental difference between the two: Alterable Values are numbers along a spectrum, while Flags are switches with two states: "on" or "off." The funny thing is that Alterable Values are labeled with letters, while Flags are labeled with numbers.
I'm not at my MMF computer right now, but...Try this experiment, which uses both Flags and Alterable Values. Set up a single active object (I'll call it "Object" in the events listed below), and some events as follows:
ALWAYS
Add 1 to Alterable Value A of Object
---
IF Flag 0 of Object is OFF
AND IF Alterable Value A of Object =/> 100
THEN Set Flag 0 of Object to ON
AND THEN Set Alterable Value A of Object to 0
---
IF Flag 0 of Object is ON
AND IF Alterable Value A of Object =/> 100
THEN Set Flag 0 of Object to OFF
AND THEN Set Alterable Value A of Object to 0
---
IF Flag 0 of Object is OFF
THEN Make Object Reappear
---
IF Flag 0 of Object is ON
Then Make Object Invisible
If it works correctly, you should see the Object flicker between Visible and Invisible at regular intervals.
Technically, you shouldn't have to use both Flags and Alterable Values to do this, but this is a start. It's easy to realize that Alterable Values are simply sets of numbers for Objects. Flags are switches that can be turned On or Off. They can also work together to do some incredibly complex things.
Here's another experiment...
One of the most useful things I learned about Alterable Values would be the Random function. For example, say I don't want to give the same numerical value to the same thing every time it hits: a sword hit will do different damage each time it connects. So I will set up the event like this.
There are two objects: a Sword and an Enemy. The enemy has an initial value set in Alterable Value A that's 10 or more. Use the mouse to move the sword around.
ALWAYS
THEN Set sword X coordinate to MouseX
AND THEN Set sword y coordinate to MouseY
---
IF Sword collides with Enemy
AND IF Enemy Flag 0 is Off
THEN Subtract random(10)+1 from Alterable Value A of Enemy
AND THEN Set Enemy Flag 0 to ON
---
If Sword is overlapping Enemy (negated)
THEN Set Enemy Flag 0 to OFF
---
IF Alterable Value A of Enemy =/< 0
THEN Destroy Enemy
A few things happen here:
- the sword will cause damage to an enemy only once, because as soon as the sword hits an enemy, that enemy's Flag 0 is turned on. Damage can only occur if the enemy's Flag 0 is off, which happens only if the sword is not overlapping an enemy.
- the damage caused by a sword will be randomly determined every time it hits. When you indicate the value of how much you reduce the enemy's "hits to kill" (their Alterable Value A), all you have to do is type the word "random" followed by the range of damage in parentheses, and then add +1 after it. Why the "+1"? Because Alterable Values start at 0, not at 1. This is called "Base 0" and is important to remember. In this example, the sword will cause 1 to 10 points of damage; if we didn't have the "+1" afterward, then the sword would cause 0 to 9 points of damage...Even if it hit, the sword could possibly not harm the enemy.
- the enemy is ready to hit again as soon as the sword is no longer touching it.
Another cool thing you can do is set up a Counter that will ALWAYS display the Alterable Value A of the Enemy, so you can keep track of the amount of damage you cause to the Enemy with each hit. Try it out!
...This is all from memory, but it should all work. And it's a quick-and-dirty example, not a full tutorial on the subject. It's just a little something to start my brain moving this early in the morning...
n/a
|
Chris Burrows
Registered 14/09/2002
Points 2396
|
25th June, 2012 at 25/06/2012 14:25:45 -
Personally, I hate flags and I will never use them. For one reason alone: you cannot rename them. Which is stupid because you can for both global values/strings and alterable values/strings.
I will always use a string instead. For example, for something like gender, you could use flag number 2416, with off for "Male" and on for "Female", but that is going to get very confusing. If you use a string, rename it "Gender" and set it to either "Male" or "Female", then your code will be infinitely easier to keep track of. The only thing flags have going for them is the toggle function, but this can easily be coded for strings. There is no reason to EVER use flags.
That reminds me haha, if you can toggle object flags, why can't you toggle object visibility?
n/a
|
Lonesome Drifter
Registered 28/05/2012 18:24:24
Points 14
|
26th June, 2012 at 26/06/2012 04:41:05 -
Thank you all for your help. One question though, I wonder if there is a way to incorporate a Flash animation into a frame for cutscene purposes. Someone on this site had a tutorial on it, but the download link has expired.
n/a
|
|
|