Hi all!
I'm new to Pulp and new to the forum, but excited to be here!
I've found @SquidGodDev 's video tutorial to be an awesome starting point.
One thing I think I got working, but I'm curious if folks would recommend a better way, is how to time "spikes" such that if the player needs to move across a field of alternating spikes, that it's possible to do so without damage.
For example:
I used this kind of event loop as suggested in @SquidGodDev 's video:
on loop do
fElapsed = event.frame
fElapsed /= spikeInterval
fElapsedFloor = floor fElapsed
if fElapsed==fElapsedFloor then
emit "spikeUpdate"
end
However, when I naively lay out spikes next to each other like that, it seems impossible for the player to get across without hitting a spike or two, because there's no point in time the player can be standing on SpikesDown and move to the next set of SpikesDown – because the spikes they're standing on come up at the exact same time the next row of spikes goes down.
So I figured I needed to insert some kind of delay of having the spikes come back up, so that there's a slight gap when all the spikes are down.
I did so by modifying the SpikesDown update as follows:
on spikeUpdate do
wait 0.2 then
call "spikesGoUp"
end
end
on spikesGoUp do
swap "Spikes"
if event.x==event.px then
if event.y==event.py then
damage = spikeDamage
tell event.player to
call "damagePlayer"
end
end
end
end
This gives a 0.2 second delay when the player can jump between rows while everything is down. It's still tricky, but seems like it works.
I'm new to all this so curious if anyone would have an alternate suggestion of how to do this.
Thanks all!
Josh
PS... here's my current go at all this:
Penguin Pulp.json.zip (4.9 KB)
(is this the right way to share on here? export the JSON, and zip it up?)