Author Topic: Which objects and sides of objects are solid?  (Read 741 times)

lostgame

  • Newbie
  • *
  • Posts: 7
  • Karma: +1/-1
    • View Profile
Which objects and sides of objects are solid?
« on: January 17, 2019, 04:02:16 am »
I’m playing around with the Sonic demo for fun, and added some tiles and successfully got them on the map. The issue is, I’d like some tiles to be solid on the sides. How do I do indicate solidity in the Sonic Demo / joMapEditor?

mindslight

  • Administrator
  • Full Member
  • *****
  • Posts: 184
  • Karma: +18/-3
    • View Profile
    • Jo Engine
Re: Which objects and sides of objects are solid?
« Reply #1 on: January 17, 2019, 12:41:40 pm »
Hi!

In JoMapEditor, you can set a custom value for each tile (see the attachement).

For the sonic demo, I used two values 0 or 1 (for solid blocks)

Code: [Select]
static inline bool      has_horizontal_collision(void)
{
    int         next_pixel;

    next_pixel = jo_physics_is_going_on_the_right(&physics) ? player.x + 4 :
                 jo_physics_is_going_on_the_left(&physics) ? player.x - 4 :
                 player.x;
    int attr = jo_map_hitbox_detection_custom_boundaries(WORLD_MAP_ID, map_pos_x + next_pixel + SONIC_WIDTH_2, map_pos_y + player.y, 4, 20);
    if (attr == JO_MAP_NO_COLLISION)
        return false;
    if (attr != MAP_TILE_BLOCK_ATTR)
        return false;
    return true;
}
« Last Edit: January 17, 2019, 12:44:00 pm by mindslight »

lostgame

  • Newbie
  • *
  • Posts: 7
  • Karma: +1/-1
    • View Profile
Re: Which objects and sides of objects are solid?
« Reply #2 on: January 17, 2019, 03:30:46 pm »
This is what I thought, however a value of 1 has no effect horizontally and Sonic can still land on objects with a 0 vertically.

The objects are larger than yours (64x64 tiles?)

 

Sitemap 1 2 3 4 5 6 7 8 9 10