Turn day on and off

Get help using Construct 2

Post » Sun Jul 21, 2013 2:33 am

Hi guys, I'm trying to change from night to day using layers and only one key (shift key). I already did it using shift key for turning day on and ctrl key for turn it off, but I just want to make it happen when I press (shift key) on.

Here the event sheet.

https://www.dropbox.com/s/5r2b8gjv4mvbul4/night_day.jpg
B
13
S
6
G
1
Posts: 19
Reputation: 1,364

Post » Sun Jul 21, 2013 2:53 am

Set a variable like IsNight to either true or false and have the button toggle that value then set day or night based on the current setting.
B
22
S
4
G
1
Posts: 100
Reputation: 2,150

Post » Sun Jul 21, 2013 3:02 am

Hi Klkitchens, when I try to add a variable in the event sheet, it only let me put the variable type in number or text, I don't see the Boolean option so I can turn it true or false.
B
13
S
6
G
1
Posts: 19
Reputation: 1,364

Post » Sun Jul 21, 2013 3:37 am

You can use 0 and not 0 I believe.

http://www.scirra.com/forum/boolean-global-and-local-variables_topic46457.html
B
22
S
4
G
1
Posts: 100
Reputation: 2,150

Post » Sun Jul 21, 2013 3:53 am

Got it, but even using numbers is not working for me, I dont know why. Anyway, there is no way that I can make an event that toggle on and off layers? I can make them invisible but the collisions of the objects are still there, so it seems the layers even if they are invisible, they are still active. Maybe if I play with layouts it might be easy?
B
13
S
6
G
1
Posts: 19
Reputation: 1,364

Post » Sun Jul 21, 2013 4:36 am

What is changing between day and night?
B
22
S
4
G
1
Posts: 100
Reputation: 2,150

Post » Sun Jul 21, 2013 5:02 am

I had a menu I made appear and disappear by putting all the parts in a family called "Menu" and setting the Y location of the family to -Menu.Y
as the toggle.

When the menu had a Y location of 400 on screen, toggling it was setting to -400. Which moved it off screen.
When it was -400, off screen, it was the same toggle which set it negative it's current location of -400, which was 400.

When it was at -400, it was off screen, so nothing could be clicked.


So basically, it hides the whole thing in an unclickable way in one event.


Edit: Made an example Capx:
https://dl.dropboxusercontent.com/u/85412219/forumposts/HideMenu.capxParadox2013-07-21 07:46:17
B
226
S
60
G
33
Posts: 902
Reputation: 39,989

Post » Mon Jul 22, 2013 7:19 pm

Hi Paradox, this example helps me a lot with my situation. I have another problem, now that I set the platforms to move out of the layout, I want my character to stay in the layout but this is not possible since the character is standing with the behavior (platformer) and is on the top of a platform that is solid. So every time the whole layer with the platforms move outside, it also brings the character. I know this is the problem because when I press the key to move the platforms outside while I'm jumping, it did not put the character outside. Sorry for my English, hope you understand what I'm saying.
B
13
S
6
G
1
Posts: 19
Reputation: 1,364

Post » Tue Jul 23, 2013 6:36 am

Nevermind, is now working, here the test already done, thanks a lot Paradox and klkitchens. http://giovannyarce.com/day_and_night for toggle the day and night, press the "ctrl" key and move using keyboard arrows. The blue platforms that are in day can be moved with touch drag and drop. http://giovannyarce.com/day_and_night
B
13
S
6
G
1
Posts: 19
Reputation: 1,364

Post » Tue Jul 23, 2013 10:11 am

If you want specifically to use the Boolean Function, Another option is that you could make a null object called "Day_Night_Toggle" and assign it a Boolean instance Variable that you call when you want in the Event sheet..or just assign the Variable to an existing object in the layer you want to toggle
Null objects are common usage in Games Design.

Null object can be a small invisible or Transparent Sprite created the usual way and has the added benefits of being an entity that you can easily access with other function calls..or implement other EFFECTS to like WEBGL

Often I find Simple Color Overlays are good for Day/Night Transitions..
and also allow lighting FX
mystazsea2013-07-23 10:15:04
When in doubt..or you are lost in a Zombie apocalypse or someone is giving you a hard time..Remember one thing..... Read the Construct 2 Manual..it will save your life.:)
B
35
S
13
G
8
Posts: 318
Reputation: 7,685

Next

Return to How do I....?

Who is online

Users browsing this forum: ksiads, R0J0hound, RozekEnhance and 6 guests