Can't do multiple fills?

Hello. Recently, I have been trying to make my first game in Pulp: A simple and silly litlle adventure game. I've coded a way for the player to die, and have been trying to do a death animation where the screen goes black in small sections (Like curtains closing after a play), but something keeps going wrong.

Here's how the code looks atm:

on CurtainCall do
  fill "white" at 0,0,16,480
	wait 1 then
	  fill "white" at 32,0,16,480
	   wait 1 then
	     fill "white" at 64,0,16,480
           etc...
	   end
	end
end

When I run the code, it seems to only fill in the first coordinates white, and then it stops.
I have tried to change the coordinates to no avail, so I assume it's not a case of them being wrong. If someone could help me figure this out, I would be incredibly thankful. (Also forgive me if the solution is simple, I have never coded before and I am, as my Username suggests, a DumDum).

I suspect (low confidence) that the issue is reentrance here.

The draw function is called on every frame, at 20fps, so you end up adding 20 "wait 1" every second...

Perhaps you'd be better off setting flags in a function that only runs once - in that function you could set multiple flags to indicate how far into the animation your other code should run. Then have curtainCall run inside the draw function only when the appropriate flag is set - and it would draw the state described by that flag or flags.

(Sorry it I'm not particularly clear here, I'll revisit in the morning - I'm just home from a friend's funeral and visited the forum as I can't sleep but I'm not exactly clear headed)

Hello, thank you for the reply. That seems to have solved it. Altough now i'm having difficulties with figuring out where the pixel coordinates are haha. Wish there was a built in function for finding pixel coords. but eh. Either way, thank you so much, and I'm sorry for your loss, hope you the best!

glad it helped! and thanks for the well wishes - i'm doing better today after some much needed rest.

calculating the pixel coords was confusing to me at first too. i didn't initially realize that pulp doubled the size of the pixels - so instead of the native 400x240 we have an effective logical resolution of 200x120. that's 8 logical pixels per logical tile (not the 16 physical pixels you might be trying to use like I did?)

EDIT: for clarification, it's 8 pixels per axis. e.g. the X axis is 400 physical pixels, 200 logical pixels in Pulp, or 25 tiles. the Y axis is 240 physical pixels, 120 logical pixels, or 15 tiles. so there are actually 16x16 physical pixels in a tile (=256) and 8x8 logical pixels in the same tile (=64).

also as a word of caution: using fill with negative width/height changes behavior. i'm still trying to figure out whether it is a bug or a feature... i'll make sure to update my post once i know that answer: Persistent Fill with negative W,H?

1 Like