Antite BBS created by Heretic of the IF Skin Zone.

Fully Featured & Customizable Free Forums
InvisionFree - Free Forum Hosting
Welcome to Frozen Waffle Forums. We hope you enjoy your visit.


You're currently viewing our forum as a guest. This means you are limited to certain areas of the board and there are some features you can't use. If you join our community, you'll be able to access member-only sections, and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free.


Join our community!


If you're already a member please log in to your account to access all of our features:

Name:   Password:


 

 Making a maze game, using scripts
TheGameMaker
Posted: Feb 9 2007, 09:57 PM


TheGameMaker


Group: Admin
Posts: 253
Member No.: 24
Joined: 4-February 07



I'll show you here how to make a maze game using scripts.
You should learn the first popple_waffles tut about the game maker or the own game maker help.

First, create a object called obj_block (make a sprite to it) and check the "solid".

Then, create a object called obj_ball (make a sprite for it). IT SHOULD NEVER BE SOLID!!!

In the step event, put a piece of code. Write this (I will explain):
CODE
if keyboard_check(vk_up) if place_free(x,y-4) y-=4;
if keyboard_check(vk_down) if place_free(x,y+4) y+=4;
if keyboard_check(vk_right) if place_free(x+4,y) x+=4;
if keyboard_check(vk_left) place_free(x-4,y) x-=4;


Allright here?
The X is the horizontal position of the player.
The Y is the vertical position of the player. (all in pixels)

CODE
if keyboard_check(vk_up) if place_free(x,y-4) y-=4;

If the player presses up and a place is free above our player, he will move up.

CODE
if keyboard_check(vk_down) if place_free(x,y+4) y+=4;

If the player presses down and a place is below the player, he will move down.

The same thing happens with the another lines of code.

Then make a room and make your level!!!

I hope you understood this. If not, feel free to reply here.


--------------------
This is a sig.
Top
popple_waffles
Posted: Feb 10 2007, 01:26 AM


1337


Group: Admin
Posts: 1.069
Member No.: 2
Joined: 2-December 06



just adding to it,

when you use a if statement like:

CODE
if x>room_width


you ALWAYS should put {} brackets around the actions that you want to happen like so:

CODE
if x > room_width then
{
x= xprevious
}


unless if you only want to perform the next action stated after the if statement!
Top
TheGameMaker
Posted: Feb 10 2007, 01:29 AM


TheGameMaker


Group: Admin
Posts: 253
Member No.: 24
Joined: 4-February 07



You're right. I will teach later how to avoid from getting out of the room.


--------------------
This is a sig.
Top
popple_waffles
Posted: Feb 10 2007, 03:39 AM


1337


Group: Admin
Posts: 1.069
Member No.: 2
Joined: 2-December 06



letz do it now!!

CODE

if x<0 then x=xprevious
if y<0 then y=yprevious
if x> room_width then x= xprevious
if y> room_height then y= yprevious
Top
TheGameMaker
Posted: Feb 10 2007, 01:34 PM


TheGameMaker


Group: Admin
Posts: 253
Member No.: 24
Joined: 4-February 07



OMG YOUR CODE IS ALMOST THE SAME THING AS THE ONE I USE!!! But I put a 0 in front of the y> and x> evilgrin0010.gif .


--------------------
This is a sig.
Top
popple_waffles
Posted: Mar 2 2007, 09:10 PM


1337


Group: Admin
Posts: 1.069
Member No.: 2
Joined: 2-December 06



yep!

most of our code probobly looks the same! laugh.gif
Top
TheGameMaker
Posted: Apr 24 2007, 04:07 AM


TheGameMaker


Group: Admin
Posts: 253
Member No.: 24
Joined: 4-February 07



QUOTE (popple_waffles @ Mar 2 2007, 09:10 PM)
yep!

most of our code probobly looks the same! laugh.gif

I wanted to mean that your code is wrong wink.gif evilgrin0010.gif


--------------------
This is a sig.
Top
popple_waffles
Posted: Apr 25 2007, 02:49 PM


1337


Group: Admin
Posts: 1.069
Member No.: 2
Joined: 2-December 06



oh happy.gif
Top
TheGameMaker
Posted: Apr 26 2007, 01:34 PM


TheGameMaker


Group: Admin
Posts: 253
Member No.: 24
Joined: 4-February 07



Correcting:

CODE
if x<0 then x=xprevious
if y<0 then y=yprevious
if x>0 room_width then x= xprevious
if y>0 room_height then y= yprevious


you forgot the last two 0!


--------------------
This is a sig.
Top
popple_waffles
Posted: Apr 29 2007, 11:52 PM


1337


Group: Admin
Posts: 1.069
Member No.: 2
Joined: 2-December 06



larger than 0 room_width? huh.gif
Top
TheGameMaker
Posted: Apr 30 2007, 12:56 AM


TheGameMaker


Group: Admin
Posts: 253
Member No.: 24
Joined: 4-February 07



QUOTE (popple_waffles @ Apr 29 2007, 11:52 PM)
larger than 0 room_width? huh.gif

oh... I forgot that a "room_width" and "room_height" was after ">" wacko.gif XD


--------------------
This is a sig.
Top
popple_waffles
Posted: May 7 2007, 10:31 PM


1337


Group: Admin
Posts: 1.069
Member No.: 2
Joined: 2-December 06



did we go over key objects?

for the room start event of the player or control object:
CODE

//this way you can reset the maximum value of objects you have to collect
itemmax=5


well, if you want the player to have to collect a certain number of objects before he can go to the next level then you can do something like this:

for the collision with the collectables:
CODE

items+=1
with (other) {instance_destroy()}

for the collision with the door object
CODE



if player.items=itemmax then {room_goto_next}

//items is the number of collected items
//itemmax is the number of items you need to collect
Top
funky chicken66
Posted: Jun 4 2007, 08:09 PM


Frozen Waffle


Group: Admin
Posts: 961
Member No.: 11
Joined: 6-December 06



ohmy.gif


--------------------
I'm a chicken that is funky!!!
Top
0 User(s) are reading this topic (0 Guests and 0 Anonymous Users)
0 Members:
DealsFor.me - The best sales, coupons, and discounts for you

Topic Options



Affiliates
TGM forumsMario fan forums
Advertise here! To advertise here, pm TheGameMaker.

Hosted for free by InvisionFree* (Terms of Use: Updated 2/10/2010) | Powered by Invision Power Board v1.3 Final © 2003 IPS, Inc.
Page creation time: 0.2329 seconds | Archive