My platformer game is laggy

I'm currently making a platformer for school, and it's really laggy, and in full screen mode, it hardly functions as intended. I've seen a few other posts addressing a similar issue, and I've learned that on Snap, the "touching" blocks are kind of slow.

So, I tried to reduce the amount of said blocks in the project, and it did help significantly... but it is still incredibly laggy. Why is this happening despite the removal of (most of) the "touching" blocks?

The TOUCHING-a-color block is slow. TOUCHING-a-sprite isn't.

Could we also have a link. (Also read Brian’s reply it’s the solution)

Yes, of course.||%20A%20platformer

Ah, I see, but then, why is it still laggy despite there being none of the "touching-a-color" blocks?

Sorry, I am way behind on my life (was away all weekend for a wedding) so I don't have time to debug your program. One of these other people will figure it out for you...

At the moment I can’t cause I don’t have my laptop at the moment. Sorry. Someone else?

There are WHEN blocks--that could be causing part of the lag.

That's okay!

first thing i'm noticing here is it looks like there are two of the player sprite? either that's a mistake you need to fix, or i need some explanation on why two sprites look almost the same

also this is too many hat blocks, whenever i make a project i never use hat blocks for inputs, i use a loop, something like:

when flag clicked
    if key pressed:
         (do stuff)
    if key pressed:
         (do stuff)

etc. this also lets you do more complex things and control the order things happen, for example instead of copying code for the left arrow and d, you can do if <<key pressed> or <key pressed>>

Thank you! This helped reduce lag significantly. Now, I just have to figure out why it doesn't function the way I want it to in full screen mode.

it probably wasn't actually lag, the when key pressed hat blocks don't run the script constantly, they run like how keys are input when typing in a textbox, once, then repeating a bunch of times (not particularly fast)

the repeat speed and delay depend on the system so it doesn't make sense to use them for a platformer

also what's with this block?

Logic bad.
It would sense if the alphabetical keys are not all pressed instead of not pressed at all

should be not any or all not not not all or any not

this is the point you need to start using punctuation
i'm guessing you mean:

should be: not<any...> OR all<not>... ,
shouldn't be: not<all,,,> OR any<not>...

but really it should just be not<key [any key v] pressed?> and shouldn't even be a custom block at that point because it's just two blocks

compressed together they look like a huge logic predicate which is a bit weird and malformed

oh yeah i was thinking of all of (map not <key (x) pressed> over (possible keys))

Looks like an old custom block I made in an attempt to get something to happen once the shift key was pressed! Although, it didn't work (as expected, since there was no option for the shift key in the "key pressed" predicate to begin with). I guess I forgot to delete the block, lol.

key (join shift ) pressed?

script variables shift
set shift to "shift"
report key (shift) pressed?

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.