Darkness/Lantern effect and Bounce-Pads

Ask and answer questions about making games and related topics. Unrelated topics go in that other forum.

Moderators: marionline, SDHawk

User avatar
Froginator
Slime Knight
Posts: 188
Joined: Thu Apr 24, 2014 10:13 pm
Location: Germany
Contact:

Darkness/Lantern effect and Bounce-Pads

Post by Froginator »

Hello there. As I'm working on the next cave for my game "Quodia" I thought it would be kinda cool to have it be all dark with just a circle of light around the characters and some glowing mushrooms to be "layered" over it so it looks like they glow just enough to be light themselves.
I have a vague idea on how to to it with slices but I'd like to have a solid script for it.. If it even works that is.

My second idea is to build little bounce pads in the form of mushrooms in the cave. it would work kinda like this i guess:
https://www.youtube.com/watch?v=aucqv6Bxk3k
Just without the switches, meaning that it's only the arrows.
I thought about making a cutscene-type sript with suspend player and stuff..
User avatar
kylekrack
Liquid Metal Slime
Posts: 1240
Joined: Mon Jun 16, 2014 8:58 am
Location: USA
Contact:

Post by kylekrack »

The lighting I'm not entirely sure about. How exactly do you want the mushrooms to show?

The bounce pads should be easy, though. You can use the "set hero z()" function to make the player look like they're moving up and dow . [s]Give me a minute, I'll find the wiki page on it.[/s]

http://rpg.hamsterrepublic.com/ohrrpgce ... jumping%3F

The animation you'll need to do with set hero frame and direction functions.
Last edited by kylekrack on Mon Jun 06, 2016 9:11 pm, edited 3 times in total.
My pronouns are they/them
Ps. I love my wife
User avatar
Taco Bot
Meat, Cheese, and Silicon
Posts: 484
Joined: Fri Jul 18, 2014 12:15 am
Location: Santa Cruz
Contact:

Post by Taco Bot »

You could probably scrounge some of the code from Crypt of Baconthulu: it has a roguelike revealy light system, and that's kiiinnnddda what you're going for.
Sent from my iPhone
User avatar
Taco Bot
Meat, Cheese, and Silicon
Posts: 484
Joined: Fri Jul 18, 2014 12:15 am
Location: Santa Cruz
Contact:

Post by Taco Bot »

Also, this might be somewhat helpful: http://rpg.hamsterrepublic.com/ohrrpgce ... he_hero%3F
Last edited by Taco Bot on Mon Jun 06, 2016 10:16 pm, edited 1 time in total.
Sent from my iPhone
User avatar
Taco Bot
Meat, Cheese, and Silicon
Posts: 484
Joined: Fri Jul 18, 2014 12:15 am
Location: Santa Cruz
Contact:

Post by Taco Bot »

(Heehee, sorry to triple post)

Also, you could probably (no warranty provided) draw the light script above all other layers except a single map layer, on which you could place the mushroom tiles.
Sent from my iPhone
TMC
Metal King Slime
Posts: 4308
Joined: Sun Apr 10, 2011 9:19 am

Post by TMC »

Having the mushrooms appear above the darkness is very difficult because:
-you want darkness to be above all normal map layers, and above NPCs
-you want the mushrooms to be above the darkness
-you want the NPCs and heroes to be above the mushrooms (and heroes and NPCs are attached to the same walkabout layer or a sublayer of it)
-you probably want the heroes to appear beneath overhead map layers

I don't see any way to achieve all of these contradictory requirements without some pretty complicated use of slices if you use the "circle of light" slice approach. However it could be doable with a Baconthulhu-style fog of war approach where the map is revealed permanently as you walk around.

Plus if you parent the darkness slices to a map layer then you need to compensate for the movement of the camera, which means having to use the next camera pixel x/y scripts.
Last edited by TMC on Tue Jun 07, 2016 4:03 am, edited 1 time in total.
User avatar
Taco Bot
Meat, Cheese, and Silicon
Posts: 484
Joined: Fri Jul 18, 2014 12:15 am
Location: Santa Cruz
Contact:

Post by Taco Bot »

If you strategically make the mushrooms somewhere where the player can't get to them though, wouldn't that make the script astronomically simpler?
Sent from my iPhone
TMC
Metal King Slime
Posts: 4308
Joined: Sun Apr 10, 2011 9:19 am

Post by TMC »

Yes, if heroes and NPCs can't walk in front of them then that's pretty simple! I guess actually even in the case that you can, you can use two map layers and a script to draw or erase mushrooms on the topmost above-darkness layer as you get close.
Last edited by TMC on Tue Jun 07, 2016 7:14 am, edited 1 time in total.
User avatar
Froginator
Slime Knight
Posts: 188
Joined: Thu Apr 24, 2014 10:13 pm
Location: Germany
Contact:

Post by Froginator »

Okay so I made the Light circle thing and it works perfectly.
I set the map on "Wrap" so I could use this script:

Code: Select all

global variable (1, flashlight circle)
plotscript, setup flashlight, begin
  flashlight circle := load backdrop sprite (5)
end
The only thing I'd need for this one now is that I want to remove the darkness after I get outta the cave, since it stays.
I put the script as the "autorun" script of the cave map.
I thought about just having an NPC at the cave entrance (a different map) which I put on "step on" and make him activate a script to reset the darkness. Maybe there's a better way, but I mainly need a way to reset the darkness. Thanks in advance :)
User avatar
Bob the Hamster
Lord of the Slimes
Posts: 7658
Joined: Tue Oct 16, 2007 2:34 pm
Location: Hamster Republic (Ontario Enclave)
Contact:

Post by Bob the Hamster »

The darkness script starts from the map autorun, right?

At the beginning of the script, add a line like this:

Code: Select all

if(check tag(tag:disable darkness)) then(exit script)
User avatar
Froginator
Slime Knight
Posts: 188
Joined: Thu Apr 24, 2014 10:13 pm
Location: Germany
Contact:

Post by Froginator »

Also tried the mushroom jumping stuff now.
I used this script:

Code: Select all

variable (i, jump)
suspend player
set hero direction (me, right)
jump := -5
for (i, 0, 10) do (
  put hero (me, hero pixel X (me) + 4, hero pixel Y (me) + jump)
  jump += 1
  wait
)
resume player
But after I used it once it won't work again, unless I leave the map and re-enter it..
User avatar
Froginator
Slime Knight
Posts: 188
Joined: Thu Apr 24, 2014 10:13 pm
Location: Germany
Contact:

Post by Froginator »

@Bob the Hamster I guess you mean that I should make a NPC activate the tag?
Because for some reason that doesn't work..
User avatar
Bob the Hamster
Lord of the Slimes
Posts: 7658
Joined: Tue Oct 16, 2007 2:34 pm
Location: Hamster Republic (Ontario Enclave)
Contact:

Post by Bob the Hamster »

Froginator wrote:@Bob the Hamster I guess you mean that I should make a NPC activate the tag?
Because for some reason that doesn't work..
Well, that tag does need to be turned on somewhere, yes.

I re-read your original question, and yeah, you are on the right track. a step-on NPC would be a good way to set the tag.
User avatar
Froginator
Slime Knight
Posts: 188
Joined: Thu Apr 24, 2014 10:13 pm
Location: Germany
Contact:

Post by Froginator »

No idea why but It doesn't work..?
Also when I use the jumpy mushrooms every NPC (including the mushrooms themselves) on the map becomes unuseable..
User avatar
Bob the Hamster
Lord of the Slimes
Posts: 7658
Joined: Tue Oct 16, 2007 2:34 pm
Location: Hamster Republic (Ontario Enclave)
Contact:

Post by Bob the Hamster »

Maybe I misunderstand what you mean when you say "reset the darkness"

I assumed you meant that after you have completed the map, you don't want toe darkness to show up the next time you come back to the map. Is that what you are trying to do?

As for the jumpy mushroom problem, can you post the script?
Post Reply