Discord
Login
Community
DARK THEME

How do i make 1 way blocks with quick engine?

Im making a 2d platformer and wanted to add those blocks from mario where you can jump through them, but the top is solid. Is there any way to make this? My game is still incredibly bare bones right now and i was hoping this would add some variety to it.

Here is the link to the game: https://microstudio.dev/i/Kirby/restless/

Thanks in advance!

Collisions are hard .

Collisions in one direction are even harder .

Quick Engine does not have collision detection only on one side of the block , so you have to do it yourself .

  1. Create a graphic - block with one-way collision .

  2. Add graphics with one-way collision to the map .

  3. In the game level initialization section add creation of a list with blocks with one-way collision . It will be something like

onc = map.extractSprites("block_one_way_collision")
  1. In the game level update section you add collision detection
for block in onc
  if Quick.spriteCollision(block,player) then
    print("collision !")
    // here must be all the code responsible for detecting whether the collision occurs from the right side and possibly blocking the player's movement .
  end
end

Thank you so much! Now i just have to figure out how to detect whether collidion occurs from the right or left :)

Post a reply

Progress

Status

Preview
Cancel
Post
Validate your e-mail address to participate in the community