Ok, someone recently attacked engines that use alterable values, because n00bs don't understand them or something.
So heres the low down:
What is an alterable value?
An alterable value is like a counter. That means it is basically a number that you can manipulate at will.
What makes them better than counters is the fact that they are specific to one object. This is VERY useful.
For instance:
Your character is fighting mindless goons. Each goon is called "Active Object 2". You want them to have a certain amount of stamina. What do you do? You could have a counter that goes up when you hit them, and when the counter gets to a certain point they die. But that wont work for each one SEPERATELY. How about instead of telling a counter to go up, tell the object's ALTERABLE VALUE to go up. Now they each have their own INDIVIDUAL stamina, despite all being the same object.
YAY!!! Isn't that fun?!!
And what's more is, each object can have more than one value, on tgf you get three, and on mmf you get heaps!! Don't you just love the alterable values!!!! YIPEEEE!!
And you dont have to use them just for health. You could use them for thousands of things. One example is using them for movement as shown in my platform tutorial (shameless promotion): http://www.create-games.com/download.asp?id=4289 . Check it out. Now your one step away from being a n00b. YEHAW!!!
You have obviously not read my post, i say to use counters in tutorials and not for CPU/AI momvement, by all means use it your own games but not tutorials. Read my post FULLY before you start typing and taking the urine , congratulations on making yourself look reather idiotic **cheers and claps**. No offence
Isnt amazing the main 'attackers' still have not replied to the other thread, either they have not read it, or I am right and you can not move an object to pixel 345.56787 x 234.56784 etc so whats the point of passing such a high precision float to it when its going to round up anyway?. I await a reply...
The main problem with alterable values is people are always renaming them. It's a lot easier to see "Alterable Value A = Gravity" than "Gravity = Gravity....what's gravity!? I never saw a GRAVITY counter!"
"Isnt amazing the main 'attackers' still have not replied to the other thread, either they have not read it, or I am right and you can not move an object to pixel 345.56787 x 234.56784 etc so whats the point of passing such a high precision float to it when its going to round up anyway?. I await a reply..."
I have made a lengthy reply in the other thread, before you made this post in fact.
As for not using alterable values in tutorials, well, perhaps. You're right that tutorials should be as understandable as possible, but sometimes you have to assume some prior knowledge on the part of the reader. People can always find out about things they don't understand from other sources, for example the excellent post at the beginning of this thread.
And considering that using alterable values will be pretty much essential for anything the user is going to do (related to movement), there's no point saying 'Here's how you do it with counters' because you'll get a zillion comments asking you how to do it with multiple objects.
you know this is going to start a forums war sometime
but it really depends on the person's preference whether they want to use the alterable values, or if they want to use counters, meyself, i switch back and forth,
and thats a good point you bring up teapot, most new people can't understand alterable values right away, it makes the job harder for the little people
By the way Hagar, you need to learn what kind of values the trig functions return. If we all use your method, we can move at 10 degrees and still go up in a straight line. Floats introduce accuracy in movement, but accuracy in displaying is stupid and unnecessary.
A sidenote on the counter/alterable value discussion.
A counter takes up extra memory as it is an independant object (obvious. I know!) where as every active object has a number of alterable values included from the beginning.
I would generally use a counter if:
- The result is supposed to be shown on screen.
- I want to keep track of something that is not tied up to a single object or instance of an object.
I would generally use alterable values if:
- The value I want to keep is specific to a single object or instance of an object. Eg. how much health an anemy has, what state the enemy is in (eg. 1=search mode, 2=shoot mode, 3=flee mode etc) to apply the right actions to him etc etc.
If someone should not know what I mean by an instance of an object (newcomers/newbies/n00bs). When you have created an object "Active Object 3" that is an enemy and you place the object in a level (either in the level editor or with the event editor) each "Active Object 3" enemy is an instance or a copy of the actual active object you created.
"Arf your arguments flawed, why not decrease the time per loop and move a pixel at a go, as it cant move to .3 of a pixel"
You could do that, but then you'd have to write extra code to deal with small values, when using my method the engine copes with absolutely any value. Plus what would you do about non-integer values greater than zero? My whole point was that you can't move .3 of a pixel! You're still missing the idea that you don't need to be able put an object between pixels for a decimal value to be useful. Why would I be making this up? It's a testable fact which I've used in my own engines before.