first create a script called 'text_to_string' and paste this:
[codebox]_loop = true
_filename = argument0
_contents = ""
_file = file_text_open_read(_filename)
for(_i = 0;_loop = true; _i+=1)
{
if!(file_text_eof(_file))
{
_contents = string(_contents) + file_text_read_string(_file) + string("#")
file_text_readln(_file)
}else
{
_loop = false
}
}
file_text_close(_file)
return _contents[/codebox]
then when ever you want to load a file into a string use this code:
[string] = text_to_string([filename])
**you have to replace the '[***]' with either a variable or filename
- Game Maker Community
- → Viewing Profile: Posts: peterc
peterc
Member Since 08 Sep 2007Offline Last Active Aug 14 2010 06:40 AM
Community Stats
- Group New Member
- Active Posts 40
- Profile Views 553
- Member Title GMC Member
- Age Age Unknown
- Birthday Birthday Unknown
-
Gender
Not Telling
-
Interests
C/C++ game programming
0
none
Posts I've Made
In Topic: Saving Text Files As Strings?
17 January 2010 - 05:56 AM
In Topic: ' The Legacy Of The Dragonlord ' New Problem
29 October 2009 - 10:46 AM
your attention to detail from inspirational games is astounding. 'Fantacy'?
In Topic: Pause
12 October 2009 - 05:53 AM
like this:
CREATE:
[codebox]shooting=false
shoot_delay=10 //i think 40 is 1 second
alarm[0]=shoot_delay[/codebox]
ALARM[0]:
[codebox]shooting=false[/codebox]
STEP:
[codebox]if(keyboard_check_pressed(vk_space)&&(shooting=false)
{
shooting=true
alarm[0]=shoot_delay
//put the shooting code here
}[/codebox]
CREATE:
[codebox]shooting=false
shoot_delay=10 //i think 40 is 1 second
alarm[0]=shoot_delay[/codebox]
ALARM[0]:
[codebox]shooting=false[/codebox]
STEP:
[codebox]if(keyboard_check_pressed(vk_space)&&(shooting=false)
{
shooting=true
alarm[0]=shoot_delay
//put the shooting code here
}[/codebox]
In Topic: How Do You Attach Specific Rules To A Room?
12 October 2009 - 05:39 AM
each room has it's own code, you can access this from the room editor and click the code button
In Topic: Mario Style - Pick Up An Objekt
10 October 2009 - 04:48 AM
do this:
- on your mario object make a variable in create event called 'has_shell=false'
- now on the draw event put this code in:
[codebox]//draw the mario sprite
draw_sprite(sprite_index,image_index,x,y)
//draw the shell if it is ment to be there
if(has_shell=true)
{
draw_sprite(sprite_shell,0,x+4,y)
if(keyboard_check_pressed(vk_space))
{
shell=instance_create(x,y,object_shell)
has_shell=false
}
}[/codebox]
note: you'll need to make an object called object_shell which shoots off in a direction aswell as a sprite called sprite_shell with the picture of the shell
- on your mario object make a variable in create event called 'has_shell=false'
- now on the draw event put this code in:
[codebox]//draw the mario sprite
draw_sprite(sprite_index,image_index,x,y)
//draw the shell if it is ment to be there
if(has_shell=true)
{
draw_sprite(sprite_shell,0,x+4,y)
if(keyboard_check_pressed(vk_space))
{
shell=instance_create(x,y,object_shell)
has_shell=false
}
}[/codebox]
note: you'll need to make an object called object_shell which shoots off in a direction aswell as a sprite called sprite_shell with the picture of the shell
- Game Maker Community
- → Viewing Profile: Posts: peterc
- Privacy Policy
- GMC Rules and Forum Rules ·



Find content