Pk, cool, thanks Gazza!!!
I had an idea this morning regarding this:
Sprite strips! That's the answer. Put your graphics into sprite strips for similarly sized sprites and then just set the relevant frame for specific objects. That way if the graphics change you only need to reload the single image of the sprite strip... I know this will give Chris a couple of headaches, but it's a compromise to minimise the amount of work going on.
-D
@Dislekcia
Thanks for all your answers.
Indeed (I was not aware of that object indices were something else than IDs). So if I manage IDs of objects once they are created in an array or with some other scheme I should always be able to get hold of an object or instance, right?This is probably the main cause of your "ids randomly change each frame" misconception.
Yes. Even so I always like the machine to do the grunt work and not me ;-)The event handler that generated onTouchStarted and onTouchStopped would be doing collision detection against flags every frame anyway .
Yes, this sounds very cool (I could even wrap it up in a nice extension that will reduce the work to a few clicks).In that case I'd suggest doing manual collision tests on creation and queueing up tests on collided objects with flags set on them during deletion. That would lower your calculation burden per frame quite substantially... Make sense?
Hmmmm... We would need to think a little bit about this. Creating the individual images is already complex because of the viewpoint, we also use sprite heights to calculate offsets (to generate the city from buildings, for instance), and we use frames in some cases to randomly choose "equivalent" images for more variety or for button states... Even so, we would be able to use it in at least some places - maybe we also need to restructure a little bit...Put your graphics into sprite strips for similarly sized sprites and then just set the relevant frame for specific objects. That way if the graphics change you only need to reload the single image of the sprite strip... I know this will give Chris a couple of headaches, but it's a compromise to minimise the amount of work going on.
That is a good way to work, and will surely reduce our headaches and development time. We don't, so that we can work in safely parallel (without one guy having to do lots of stuff because of unforseen glitches), and art "mistakes" and "problems" can be spotted a lot earlier. In this game it is important because the solution might be either programatic or artistic (because of the procedures that generate the world). Many of the small things that cropped up in Epidemic required both art and programming changes. Maybe experience will allow us to take the approach you suggest - we might even adopt it regardless.I know this can be a big headache. It's the main reason that I don't tend to colour sprites outside GM: I'll leave them white and colour them at the object level. Also I'm a big fan of minimalist graphics up until final release.
Thanks again for the answers; you have been a great help.
ht
Last edited by herman.tulleken; 30-08-2007 at 06:49 PM.
Fonts in GM
Is there a tutorial somewhere on using fonts in GM? How do I ensure that the fonts I want to use in GM will be available for other players who might not have the font loaded? Can I load a sprite strip with a more elaborate font into the font section?
If you use an installer to install the game, you could install the font with the game. InnoSetup is an attractive and powerful free solution - better than many commercial installers.
For more elaborate fonts, IMHO, it might be better to make a new font instead any bitmap scheme (I am not sure whether there is a bitmap scheme for GM). Although it is a lot more work, it means you don't have to worry about bad kerning and line spacing, and you will have a font ready for manuals, web sites and other stuff.
I don't know of any good, free font editing tools, though... Fontographer, I hear, is a good commercial one, but quite expensive.
Hope it helps.
ht
GM automatically bitmaps fonts that you give it, that's why you have to create a font and specify which sections of it you'll be using. It does that to ensure font portability across machines.
I'm not sure if you can load your own custom bitmapped fonts without first creating an actual font from the images, but I'll look into it.
-D
So what you're saying is, is that I could use a custom font on my machine and people use the compiled EXE will see what I see, but if people play with the GM file they might not get it. I can live with that
Ok, so Im about to shoot something!!! AHHHHHHH!!! This be my problem! I want to randomly generate a list of stats for a character, so in my characters create event I have something like this:
Create:
char_type = random(4)
if (char_type = 0)
{
Speed = 20
Strength = 50
Blah blah blah!!!
}
if (char_type = 1)
{
Speed = 50
Strength = 20
Blah blah blah!!!
}
and so on! When I try get it to draw Speed for example, its says variable does not exist :( Please help!!!
Is Speed declared outside the if statements? If not there is your problem.
Because the ifs create their own scopes and all variables not declared outside it get deleted after end bracket of the if.
Else the problem might be that you should use this.Speed if that is a member of the object.(I am not so sure about this, because I don't know gamemaker all that well)
Here is my own question, Is GM based on JavaScript?
No, my variables are not declared outside the if statements but when I do declare them (Speed = 0 what ever blah blah blah) when I draw it, it always get drawn as 0!?!
If you're talking about the application itself, GM was built with Delphi.
If you're talking about the code, GML is syntactically open.
Nope. GM's scope is object-dependant. That means that creating a variable inside braces creates that variable on the current object that code is executing on. The only time a variable's scope is limited in the way you describe is when you declare it using the var keyword, that is mainly used in scripts to prevent variables inadvertently overwriting each other in things like recursion.
As Nandrew has said: GM is written in Delphi and GML is a lexically scoped scripting system built strictly for GM. GML can parse C-style, Pascal-style and sometimes even BASIC-style code, in the same structure.
-D
Your problem is that random() returns a float. So it can be anything between 0 and 4, including things like 0.782324 and 2.80909, etc. The chances char_type actually being exactly 0, 1 or the like are vanishingly tiny... Although it would happen at least once given enough attempts.
The solution is to round the value returned by random() to an integer using either round() or floor(). The former rounds a real number the same way you were taught at school, the latter simply drops anything after the floating point: round(0.7) is 1; floor(0.7) is 0. Floor() is the better choice, because it reduces possibilities equally. Round() has a bias against the numbers at the end of the range. Floor() will never give you the highest number possible...
Or you could simply use the choose() command... value = choose(0, 1, 2, 3, 4); Works with any values.
-D
Hm, ok, so I used the choose(0, 1,), but when I tell it to draw one of my variables, its still blank, it doesn't bring up an error though so it must be there!!!
Here's a link,
http://gamedev.openhazel.co.za/filec...andom_Stas.zip
maybe you can see whats wrong!?!
Ok, two problems! First, is there anyway to set the verticle speed of an object to the verticle speed of a room? Then also, how can I destroy an object in the GML from another object? When I say instance_destroy() I cant put anything in the brackets else it brings up an error! Is there any code that I can put in that destroys an object at a certain position! So for example, my current note is done like this:
Step:
current = instance_nearest(x, y, F1)
Now I want to destroy the object that is current!!!