You Can Talk About Hopscotch Here; Topic 30 [OFFICIAL]

Looking good so far!

Also, thanks for noticing the speed bug, didn’t even realise lol

1 Like

Plot Twist: I’m making the template so you don’t have to code so much every time you want to make another platformer like your latest.

What should I add to make the template more complete. I’m basically just adding the stuff that would be in every platformer (so the others would just need to add animations and sprites).

I can also add keyboard AND gamepad controls (cuz I can) if you want…

i.e., _ae_webplayer_action: {"name": "checkControllerButton","args": [0,0,0]} is gamepad button X / A (or jump) (I have the shortcut set as /cm0 (controller mode 0)).

The args in order: controller ID (0 is player 1), mode (0 = value of button pressed, 1 = any button, 2 = all buttons), button ID (0: A, 1: B, 2: X, 3: Y, 4: RB, 5: LB, 6: RT, 7: LT, 8: View, 9: Menu, 10: L3, 11: R3, 12-15: D-pad Up Down Left Right, 16: XBox Button: 17: extra button (Xbox only))

1 Like

Honestly, I like to start over from the beginning every time I make a new platformer. It’s easier for me to find optimisations I would have never found otherwise. It may take much longer than using a template, but in the end it’s worth it.

Move all of the code to its own scene, not the starting scene. You don’t have to and you could make it work, but its honestly much beter that way.


I can add a second scene, then easily re-order then via the project builder…

I understand.

When I want to optimize code, I check to see if any of the code could be simplified…

  • like 1 × project speed, which can be simplified to just “project speed”
  • I also like to do a thing called variable substitution, which is where I take commonly used operations like abs(tile x - next x) and place them in a local variable. This, in turn, reduces the amount of math operators and variable used (especially true if there are a LOT of collision types)
    • This also makes it more CODE EFFICIENT, even if it doesn’t actually help with frame rate.
1 Like

What kind of optimizations do you think is needed in your current platformer setup?

1 Like

I think you can just ask to reopen in the leaders q and a topic

1 Like

Definitely something with enemies. They are currently the greatest source of lag, and I feel like I can optimise them a bit.

1 Like

or just

draw a hopscotch game [like with the numbered boxes] and tape that on instead

boom :boom:


I did some variables substitution for enemies on my end. I went from using like 24 math operators (plus extra for the vertical limit) to only 8 math operators (plus extra for vertical limit). That’s literally 2/3 less math operators, and I have seen that a lot of math operators (or any operators) could cause a bit of lag.

How many enemies causes lag for your project on your end? I can do a stress test for my template.

1 Like

On my device, It takes around 60 frogs before the game start to lag (it’s only a very small slow down) and it takes 140 frogs for the frame rate to reach 30.


It took 165 enemies to drop to 30 FPS on my template (on my device), but that’s only because I have less collision types, and because my iPad is very powerful.

300 enemies drops it to 15 FPS on my iPad…

Also, who is going to clone 140 enemies in one location?


Well you don’t necessarily need 140 enemies to spawn 140 clones. For example, Dino spawns a fireball every few seconds and that fireball spawns particles.

I toned down the particles a bit before release, but before that 1 Dino could easily take up 10 clones total! So you would need 14 dinos to reach that number (since 140/10 = 14) though that’s changed now, so you’ll need more dinos.

Additionally when an enemy goed offscreen, it goes into a state where it can’t move or shoot fire, but it’s still loaded for a bit until it’s ~500 pixels extra offscreen (if I remember correctly lol)

Coins also spawn particles as well but not as many, I think a coin takes up 3-4 clones at most.

140 clones is still ridiculous but it’s definitely possible.


Yeah, ±32 = disable movements, ±512 = offload enemy.


Now I think about it you could probably get a performance boost if you make a separate object for particles, as particles now run through the same code as enemies. Which is laggy


Maybe… but mine doesn’t spawn any particles and it’s still laggy after 165 clones…

Not that it’ll ever reach that number…


Did that enemy get smart all of a sudden? Nope, they’re just colliding with an invisible tile that only the enemies can see. Tap “Toggle Hidden Enemy Collisions” to view them.

Using this, you can make the enemy avoid holes, spikes, etc.

1 Like

Question of the Month

What was your favourite time on the forum?

Mine was this

I just get soo nostalgic thinking about it

The forum felt like a comfort, a relief from the worst few months of my life I cant go into much detail aout that :p

The forum was really different at that time
It felt more like a family


I think a ( ) contains ( ) block would be useful in Hopscotch (and no, it wouldn’t be the exact same as the matches block). This would be similar to JavaScript’s includes function.


check once if (Apple) contains (A) returns true since the A’s match exactly
check once if (Apple) contains (a) returns false since “A” doesn’t match “a” exactly

It would basically be the case sensitive version of the matches block, but without the RegExp capabilities.


Added a new enemy type: Non-Smart (was originally gonna be “Blind”). Unlike the other enemy, they can’t see the hole (nor the special tile) in front of them and will fall right in. (So basically like every platformer with enemies you ever created, lol /lh)

Tap “Spawn Non-Smart Enemy” to spawn one. They are slightly shorter than the other enemy, and lighter in color. They are also slightly slower…

@Spy_Guy_96 this is basically my first step into enemy AI.

1 Like

Also, a small optimization:

Constants like ((width + 64) / 2) and ((height + 64) / 2) are now only defined once (per cloning process) since the enemy’s width and height never changes from its original.

This only works with variable substitution, btw.

I still got 15 FPS at 300, but when I started moving, it somehow jumped up to 20 FPS, lol…