Jump to content


Frank1442

Member Since 07 Aug 2011
Offline Last Active Aug 14 2012 06:18 PM

Posts I've Made

In Topic: Platform Enemy AI

04 March 2012 - 02:58 AM

Ahaha. Ah. Well.
You've forgotten to mention what exactly you want your AI to do?


Well, for example the game will be like a 2D platform game so I want it to be like walking left, stoping for a while then go right and walk left again then stop and etc.... and If you get close to it he will start following you like trying to catch you

In Topic: Missing function random_range in Mac game maker

04 December 2011 - 09:33 PM

First of all, you should turn the option that displays errors back on. Don't chicken out of problems caused by your coding. Let GM inform you to the best of its ability, and you should take an active role in fixing them.

random_range() returns a real value, while show_message() expects a string. Passing a real value into a function that expects a string argument is not valid. To make this valid, you need to use string() to turn the result into a string:

age = random_range(0, 20);
show_message(string(age));

GameGeisha


Thanks and sorry for the nuisance

In Topic: Missing function random_range in Mac game maker

04 December 2011 - 09:23 PM

No, that's not how it's done. The script should contain just the return statement. The assignment statement does not belong in there.

return argument0+random(argument1-argument0);

Then you can call it as though it was a built-in function:
random_percentage = random_range(0, 100);

Defining scripts and calling them in this fashion is a basic technique that should stick.

GameGeisha


Ok thanks but one last question I did everything you told me but when I put this code
age = random_range (0, 20);

show_message(age);      

It shows nothing in the dialog box when I start the game, it shows nothing is blank.....

In Topic: Missing function random_range in Mac game maker

04 December 2011 - 09:02 PM

random_range() is new to GM8.1, but GM4Mac doesn't have it yet. You can create one yourself, though:

return argument0+random(argument1-argument0);
If you name this script random_range, you get the exact same functionality.

GameGeisha


Now I have another problem, after I wrote this: random_range = return argument0+random(argument1-argument0);    and then started the game an error came which said this:

COMPILATION ERROR in Script: random_range
Error in code at line 1:
   random_range = return argument0+random(argument1-argument0);

at position 14: Variable name expected.

In Topic: Missing function random_range in Mac game maker

04 December 2011 - 08:34 PM

random_range() is new to GM8.1, but GM4Mac doesn't have it yet. You can create one yourself, though:

return argument0+random(argument1-argument0);
If you name this script random_range, you get the exact same functionality.

GameGeisha


Thank you so much!