GameMakerHelpBlog

Tuesday, April 10, 2007

Adding sprites

Warning for this to work obj must already be placed in room

In some games you need to add sprites, here is a script i think will support that


LoadGameName = "";
LoadGameName = get_open_filename("Saved Games (*.sav)*.sav", "");
if (LoadGameName != "")
{
if (string_copy(LoadGameName, string_length(LoadGameName) - 3, 4) != ".sav")
{
LoadGameName = LoadGameName + ".sav";
}
sprite_replace(sprite0,LoadGameName,1,true,true,true,true,x,y)//only supports
//one sub_image
}

Labels:

Adding sound

Hi

Here is a script to add sound without errors that sound don't exist

first make a sound name it sound0

Then add this code ( you can change the extention if you need to)

[code]obj=music event=any except for step or draw
LoadGameName = "";
LoadGameName = get_open_filename("Saved Games (*.mp3)*.mp3", "");
if (LoadGameName != "")
{
if (string_copy(LoadGameName, string_length(LoadGameName) - 3, 4) != ".mp3")
{
LoadGameName = LoadGameName + ".mp3";
}
s=sound_replace(sound0,LoadGameName,3,true);
sound_play(sound0)
}
[/code]

Labels:

Register System

Hi and this is the first post of the deadly dangers label, this means that this code is thought out of my head and it is up to you to try it, if there is something wrong with it please reply in the comments section of this post or use the send me a comment button at the top right.

Register system - non_encrypted

I have made this non encrypted so the noobs will be not as confused
This requires 2 text files named "user" and "pass"


[code]obj=login event=create
username=""
password=""
//defines vars
[/code]

[code]obj=login event=left pressed (can be changed)
username=get_string("username imput please",'')
f=file_text_open_read("user.txt")
u=file_text_read_string(f)
if u=username
then
{
password=get_string("password imput please",'')
f=file_text_open_read("pass.txt")
u=file_text_read_string(f)
if p=password
then
show_message("everything is correct")
else
show_message("incorrect password")
}
else
show_message("username incorrect")
[/code]

Labels: