GameMakerHelpBlog

Saturday, January 6, 2007

Speed and outside room *funny stuff*

Hi this is a funny script i made for a bit of fun as well as a script for games

Ok in the obj_person create event put either vspeed+=1 or hspeed+=1

outside room event
[CODE]


{
if (x < 0 && hspeed < 0) x = room_width + sprite_xoffset;
if (x > room_width && hspeed > 0) x = -sprite_width + sprite_xoffset;
if (y < 0 && vspeed < 0) y = room_height + sprite_yoffset;
if (y > room_height && vspeed > 0) y = -sprite_height + sprite_yoffset;
}
[/CODE]

This will cause him to go so fast it ain't funny but it is funny!

Labels:

Friday, January 5, 2007

visible.... Funny stuff

I decided to post an easy funny thing to do with an object to make it blink and disappear and reappear it is cool....

[CODE]
//Create event
visible=1
alarm[0]=20
[/CODE]

[CODE]
//alarm0 event
visible=0
alarm[1]=5
[/CODE]

[CODE]
//alarm1 event
visible=1
alarm[0]=5
[/CODE]

it will disappear and reappear and i think it is cool for making games with health in it

Labels:

CD Player Turtorial

This will explain the functions of CD Music in Game Maker

This functionality is only available in the registered version of Game Maker.
cd_init() Must be called before using the other functions. Should also be called when a CD is changed (or simply from time to time).
cd_present() Returns whether a CD is present in the default CD drive.
cd_number() Returns the number of tracks on the CD.
cd_playing() Returns whether the CD is playing.
cd_paused() Returns whether the CD is paused or stopped.
cd_track() Returns the number of the current track (1=the first).
cd_length() Returns the length of the total CD in milliseconds.
cd_track_length(n) Returns the length of track n of the CD in milliseconds.
cd_position() Returns the current position on the CD in milliseconds.
cd_track_position() Returns the current position in the track being played in milliseconds.
cd_play(first,last) Tells the CD to play tracks first until last. If you want to play the full CD give 1 and 1000 as arguments.
cd_stop() Stops playing.
cd_pause() Pauses the playing.
cd_resume() Resumes the playing.
cd_set_position(pos) Sets the position on the CD in milliseconds.
cd_set_track_position(pos) Sets the position in the current track in milliseconds.
cd_open_door() Opens the door of the CD player
.cd_close_door() Closes the door of the CD player.

Or if you are like me and are silly you just do

[CODE]
//in CD Create event
cd_open_door()
alarm[0]=20
[/CODE]

[CODE]
//in alarm0 event
cd_close_door()
alarm[1]=20
[/CODE]

[CODE]
//in alarm1 event
cd_open_door()
alarm[0]=20
[/CODE]

This will make it open and close again and again it is really funny :D

Labels:

Thursday, January 4, 2007

Text files turtorials

Using Text Files??? Well here is a simple turtorial to show its functions

1. Turtorial about text files

In GameMaker i haven't figured out a way to create a textfile so if anyone knows please PM me at the GMC or UGMC or MSN me at millzyman1@hotmail.com

In a text file there are certain things you can do......
rename a text file
Change it extention
copy it.... (great for backups :))

But the most important function you MUST do in a text file functions is file_text_close(fileid or filename) for instances
[CODE]
//example
file_text_open_write("example.txt")
file_text_write_string("example.txt","hello world")
file_text_close("example.txt")
[/CODE]

2. Using File ids

File ids are very simple to use... (or the way i think how you use it) i make a fileid by using a variable, in most codes you find f=text file function

Example
[CODE]
f=file_text_open_write("example.txt")
file_text_write_string(f,"hello world")
file_text_close(f)
[/CODE]

3. Using Write string or real functions

If using strings and reals you can use two easy functions
file_text_write_string
and
file_text_write_real

Both have the same arguments (fname//filename,str//string or real)

Also if you want to skip a line then to do so you use file_text_ln(filename)

4. Reading functions

When collecting the data from a text file you would normally do
[CODE]
f=file_text_open_read("example.txt")
d=file_text_read_string(f)
if d=str
then
file_text_close(f)
room_goto_next()
[/CODE]

Also you may want to skip a line.... the function is text_open_readln(fname)

5. Renaming,Extention changing and copying

File_Copy(filename,newfilename)

when using file copy you have to have the orginial filename and the new filename
I suggest using Save and Load scripts....

File_Rename(Oldname,Newname)
simple... just put in the old filename then you can change it to a new one

filename_change_ext(filename,newextention)
really good for converters.... or just changing files to a new extention


Thats all from me hopefully i will see you using text files in the near to distance future

Labels:

Limited Movement *Certain amount of energy*

Hi

Here is a code for a certain amount of walking movement
[CODE]
//create event
Power=0
[/CODE]
^^That initates the var Power Maker sure it is a Capitial P else you will find yourself with an error due to power(x,n) being a function
[CODE]
//walking events
if Power>0
then
//walking movement here e.g x+=3
Power-=1
if Power<0
then
exit;
[/CODE]

Labels: