I would like to know your thoughts on how I could optimize a small fan game of mine that i just started developing. Only one level yet:
File:
Small-Kirby.pdx.zip (41.5 KB)
I would like to know your thoughts on how I could optimize a small fan game of mine that i just started developing. Only one level yet:
Do you have any screenshots of your fan game?
When you ask about optimising, could you describe what problems you are trying to solve?
I was wondering if people could look the code and perhaps find a better way. Here is the code for sucking in enemies:
Sucking in:
on swallow1 do
play "swallow1"
swallowed = 1
end
Enemy code:
on interact do
if blowing==1 then
play "white"
emit "swallow1"
swallow1 = 1
end
end
One good rule of thumb is to avoid using emit
if possible. emit
will loop over every tile in the room. That's useful if you don't know what tiles are going to react to the event, but here you know you are calling events on the player and the sprite being interacted with so emit shouldn't be necessary.
To call a player event from somewhere else you need to tell event.player
like this:
tell event.player to
call "eventName"
end
Keep at it and good luck!
Thanks you! I knew about that but wasn't quite sure.
Ok, i have two new levels and optimization for some code.
Small kirby.zip (47.0 KB)
A new level:
Small kirby.zip (50.1 KB)