Jo Engine Forum

Sega Saturn Development => Jo Map Editor => Topic started by: lostgame on January 17, 2019, 04:02:16 am

Title: Which objects and sides of objects are solid?
Post by: lostgame 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?
Title: Re: Which objects and sides of objects are solid?
Post by: mindslight 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;
}
Title: Re: Which objects and sides of objects are solid?
Post by: lostgame 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?)