The Daily Click ::. Forums ::. Klik Coding Help ::. fog of war
 

Post Reply  Post Oekaki 
 

Posted By Message

Koth



Registered
  21/02/2007
Points
  34
13th July, 2008 at 09:32:51 -

greets
I intend to make a simple rpg but it would require fog of war (darkness over non-explored zones)
I'm sure it has been alrady asked before but I havent found anything like tutorials or such on this forum - do anybody know any example?

thanks

 
-K

Knudde (Shab)

Administrator
Crazy?

Registered
  31/01/2003
Points
  5125

Has Donated, Thank You!Clickzine StaffKlikCast StarVIP MemberGhostbuster!Dos Rules!I donated an open source project
13th July, 2008 at 11:35:40 -

There are a variety of ways to accomplish this. The simplest would be to have many black active objects overlaying your map, which are destroyed when the player is within a certain distance. The only problem is that depending on your map size, this could slow down your game considerably.

Another method would be to have a grid of black active objects that follow the playfield (So the map moves, but the fog doesn't) then simply make them visible or invisible. This would take some of the strain off, but would be a bit harder to code.

 
Craps, I'm an old man!

Klikmaster

Master of all things Klik

Registered
  08/07/2002
Points
  2599

Has Donated, Thank You!You've Been Circy'd!VIP MemberPS3 Owner
13th July, 2008 at 12:48:33 -

Might be worth trying the Overlay object. Fill it with black, stretch it over the play area and draw transparent circles at the player's position whenever the player moves. The same technique used when creating a destructable terrain like in the worms games.

 
n/a

Ski

TDC is my stress ball

Registered
  13/03/2005
Points
  10130

GOTW WINNER CUP 1!GOTW WINNER CUP 2!GOTW WINNER CUP 3!KlikCast HelperVIP MemberWii OwnerStrawberryPicture Me This Round 28 Winner!PS3 OwnerI am an April Fool
Candy Cane
14th July, 2008 at 09:06:49 -

Someone made an example of this a few months back. I think it may have been posted on clickteam...

 
n/a

Koth



Registered
  21/02/2007
Points
  34
14th July, 2008 at 10:22:20 -

ah yeah I found it there at http://www.speedyshare.com/769450337.html

seems indeed it works, now I'm tying a way to make with some gradient semi-transparency too but I haven't been successful so far

Image Edited by the Author.

 
-K

Attan



Registered
  13/03/2007
Points
  136
16th July, 2008 at 17:34:50 -

You could always try to use construct (www.scirra.com) but it seems to be almost forbidden to talk about here...

 
n/a

Koth



Registered
  21/02/2007
Points
  34
17th July, 2008 at 09:45:44 -

hehe I know that but its too buggy and crashes too often

(rikus give me 300+ points now!)

Image Edited by the Author.

 
-K

alastair john jack

BANNED

Registered
  01/10/2004
Points
  294

GOTW WINNER CUP 1!GOTW WINNER CUP 2!GOTW WINNER CUP 3!VIP MemberMushroomI am an April Fool
18th July, 2008 at 14:22:42 -

In construct I think you could have a layer, then put an object on it and give it the 'erase' effect? That way you can see through it.

 
lol

Ski

TDC is my stress ball

Registered
  13/03/2005
Points
  10130

GOTW WINNER CUP 1!GOTW WINNER CUP 2!GOTW WINNER CUP 3!KlikCast HelperVIP MemberWii OwnerStrawberryPicture Me This Round 28 Winner!PS3 OwnerI am an April Fool
Candy Cane
18th July, 2008 at 14:24:13 -

You could, but construct sucks Just use MMF2

 
n/a

-Nick-

Possibly Insane

Registered
  24/11/2002
Points
  2468

VIP Member
18th July, 2008 at 15:47:39 -

I haven't read any of the other answers. But the simple way is to just have an array that fills up with 1s (instead of 0 which is fog) as you explore the map. Then draw black objects on screen when you're near certain parts of it. That way you don't have objects off-screen taking up resources.

 
Project: Roller Coaster is on it's way!
http://www.projectrollercoaster.co.uk/
http://www.craftsncreatures.com
   

Post Reply



 



Advertisement

Worth A Click