Make a block solid

Hello, I am making a 8 bit mario style game where you have to go through different levels, I am wanting it so when they are on the ground, or a platform, they don't just fall right through it and they can walk on it(drag it around). Another thing I want is to have a jump button, which I need help with. Thank you all!

I would start by reading Chapters 5 and 17 of the free book at

then consult with Scott Ferguson's graphics examples at

(follow his posts to his defunct library).

There are basically two ways to constrain moving a character,

  • checking its surroundings' background colors in a fast Clock Timer, or
  • checking its x and y values against a table of solid regions (xlow,xhigh, ylow,yhigh)

To add gravity, check if downward movement is constrained or not, then increase y velocity if unconstrained.

1 Like

@ABG, I found out how to make it walk on platforms and ground but could you show the code to make it jump this is what I have right now but it doesn't work just right.

To make a sprite jump under clock control, you need to associate a Y_Speed global variable with that sprite.

When you start a jump, set the Y_Speed to a negative number like -15.

Every clock timer cycle, you add the Y_Speed value to the Sprite's Y value.
You also need to affect the Y_Speed with gravity, so you add something to slow upward motion and speed downward motion, like a constant global variable gravity = 3.

After enough clock timer cycles, the Sprite will have stopped its upwards motion and started to plummet. There is no need for a true/false flag for upwards motion since the sign(+/-) of Y_Speed controls its upwards/downwards motion.

1 Like

@ABG, Mine didn't work, did I do something wrong?

Make a Blocks List of your platforms etc, including the ground (all defined as sprites).
You can then use the 'Sprite Collided With' event Block, and check to see if "other" is in the list of platforms - if it is, do nothing.

1 Like


You were supposed to add the speed to the Sprite Y

1 Like

@ABG, Still doesn't work, it just keeps going upwards until it reaches the top. These are my blocks:

set global V = -15
set ball.y = canvas.height

when clock.timer
set V = V + gravity
set ball.y = ball.y + V


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