It's Getting Dark...

Posted by gtvg on Aug. 11, 2007, 7:06 p.m.

I have implemented another cool feature into my game. It now gets dark and night. I have made it to where when it gets dark torches are lit inside cities. If you are not near a light when it gets dark, several of your stats are lower and, obviously, you can't see as well. I am trying to decide whether or not you can have a lantern or a spell to make light when you are own your own in the woods.

However, there is a problem now. I have one object, placed in room one, that creates all the persistent objects. So when you go from room one to another and then back, all of the objects are created again. Now, you have two guys,two everythings. Is there a way to have something only created once, or make rooms persistent???

Screenshots:

This is set at about down, which is near an outpost, which have torches.

http://greaterthanvideogames.com/twok_s_1.PNG

During the day, the torches are extinguished.

http://greaterthanvideogames.com/twok_s_2.PNG

A straw roof building

http://greaterthanvideogames.com/twok_s_3.PNG

When you first enter, the roof quickly fades away.

http://greaterthanvideogames.com/twok_s_4.PNG

No roof!

http://greaterthanvideogames.com/twok_s_5.PNG

Don't get stuck in the dark by yourself.

http://greaterthanvideogames.com/twok_s_6.PNG

Please leave any suggestions you have

-3492 hits

-GTVG

Comments

Cesque 17 years, 4 months ago

Quote:
However, there is a problem now. I have one object, placed in room one, that creates all the persistent objects. So when you go from room one to another and then back, all of the objects are created again. Now, you have two guys,two everythings. Is there a way to have something only created once, or make rooms persistent???

I don't really get what you mean… two guys? I guess something runs your program twice. You may use some variable to check whether objects have already been created within that room, or use the code space in every room for its startup settings.

Also, the game is looking good :)

twisterghost 17 years, 4 months ago

Click the little "Persistant" box in the room editor.

flashback 17 years, 4 months ago

Khan is never in the dark.

jsorgeagames 17 years, 4 months ago

This should fix it. let's say the guy's object name is obj_Guy. Not in the Create Event, in the Room Start event, type this:

if instance_count(obj_Guy)>1

{

obj_Guy.instance_destroy()

instance_create(x,y,obj_Guy)

}

gtvg 17 years, 4 months ago

For some reason instance_count doesn't work :( It turns a different color when I type it though.

Unknown function or script: instance_count

gtvg 17 years, 4 months ago

Thxs tg persistent works.