It is currently Wed Dec 30, 2009 8:49 pm
All times are UTC


Welcome
Welcome to <strong>PresStart</strong>.
[url=http://presstart.freeforums.org/profile.php?mode=register]Join[/url] PresStart today!


Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Tutorial: Fog of War (Easy,GML Used)
PostPosted: Fri Jul 18, 2008 5:02 am 
Offline
DYNOMITE!
User avatar

Joined: Thu Jul 03, 2008 8:10 am
Posts: 40
Location: USA
This will show you how to make a fog of war ( You can only see things near you. Everything else is dark.).

Start off by making a small black square sprite for our fog. Make it about 32x32 pixels. Next you will need a sprite for you and maybe some other hidden things.

Now make an object for the fog and set its sprite. Make sure it is visible and give it a depth of "-2000". Just make sure it is on top of EVERYTHING. Now create a step event and add in this code:


if distance_to_object(you)<=64
//if object "you" is less than or equal to 64 pixels away
{
self.visible=false
//make this object invisible
}
else
{
self.visible=true
//if it is not less than or equal to 64 pixels away just remain being visible
}

Next for the other objects. Create another object called "you". Give it full movement. Now, create your hidden objects. Now you have the tools. Just create the room. First put your hidden objects in. Then "you". Now, cover the entire room in the object fog. Leave no gaps. Run your game and you will now see that there is no fog around your person. When your person moves the fog clear around him and darkens away from him.

If you want your fog to permanently disappear when you get close to it simply change the code above to this:

if distance_to_object(you)<=64
//if object "you" is less than or equal to 64 pixels away
{
instance_destroy()
//delete self
}

And thats all there is to it! If you have any questions or ideas please post them below.

_________________
I am an Image in the Game Maker Quiz!

Image


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 18, 2008 6:45 pm 
Offline
The PresStart Admin Counsel

Joined: Thu Jan 31, 2008 1:48 am
Posts: 108
Cool! MasterZ wants to make a game and this may come in handy for him. I'll let him know about this!

(By the way, that GM quiz thing is pure evil)

Thanks for the post!

_________________
Where the fun is at!
http://www.presstartpro.com/


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 18, 2008 9:27 pm 
Offline
DYNOMITE!
User avatar

Joined: Thu Jul 03, 2008 8:10 am
Posts: 40
Location: USA
The Game Maker Quiz isn't pure evil. Well, I guess the history part would get you if you were not around since GM 5's time. I started using Game Maker during the end of Game Maker 5's time. A month or two later Game Maker 6 came out. So, I pretty much know all about the history part. Did you get to see the old Game Maker site? The old site is http://gamemaker.nl/ . But all that is on it now is a redirect to yoyogames.

_________________
I am an Image in the Game Maker Quiz!

Image


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jul 19, 2008 12:45 am 
Offline
The PresStart Admin Counsel

Joined: Thu Jan 31, 2008 1:48 am
Posts: 108
I started on 7, and I haven't done alot of scripting so that is what killed me!

_________________
Where the fun is at!
http://www.presstartpro.com/


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

It is currently Wed Dec 30, 2009 8:49 pm
All times are UTC

Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum