设为首页收藏本站同能贴吧 切换语言 繁体中文
开启辅助访问 切换到窄版
扫描二维码关注官方公众号
返回列表
+ 发新帖
查看: 75|回复: 0

[制作教程] Make a SOKOBAN puzzle

[复制链接]
累计送礼:
0 个
累计收礼:
1 个
  • TA的每日心情
    开心
    前天 04:10
  • 签到天数: 209 天

    连续签到: 2 天

    [LV.7]常住居民III

    4461

    主题

    864

    回帖

    2万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

    VIP
    7
    卡币
    22929
    OK点
    16
    推广点
    0
    同能卷
    50
    积分
    28284

    灌水之王

    发表于 前天 12:52 | 显示全部楼层 |阅读模式
    A SOKOBAN puzzle is one where you have to push objects, one step at a time, onto specific locations, and the puzzle is complete when all objects are where they're meant to be. The challenge is to keep yourself free to move, while not moving any objects into a wall or corner where you can't get it out again.


    Koi asked for help to create one of these, and as I'm listing the individual steps, figured it might be of interest to others.


    This is a sokoban puzzle (image comes from Koi's support thread)

    Spoiler





    Step 1 - Draw your map


    Mark in the walkable areas and borders, and place the destination tiles to indicate the destination for the objects (these must be passable tiles)

    Spoiler





    Step 2 - Make destination tiles 'special'


    You can do this using terrain tags or regions.


    To use terrain tags, just go to your Tileset tab, find your 'special' tile, and change its terrain id to something that's not in use elsewhere.


    To use region ids, go to the region layer and paint with a single region id over the special tiles.

    SpoilerTerrain Tags:





    Region IDs:








    Step 3 - Add your movable objects


    There are a few ways you can set this up.


    For something that rolls, you will want Walking Animation checked, but for something that does not have animations or directions, you'll want Walking Animation UNchecked and Direction Fix checked. Leave all the other options UNchecked.


    Decide on your trigger - you can either leave it as Action Button, and make the player press space to move it, or just set it to Player Touch, which means just the player moving into it will force it to move.


    The event commands are JUST to move the object away from the player (you may or may not want to add a sound effect) - we're not going to do any position checks or puzzle validation here. Make sure you check the Skip if Cannot Move box. It's up to you whether you want to add a Wait for Completion or not.


    Make one, verify that it works, and then copy and paste it so all the objects are on their starting positions.

    Spoiler





    By now, you should be able to set your player position, and walk around pushing the objects in front of you. They should get caught in the corners or on the walls.


    Step 4 - Check for puzzle complete


    We'll use one "controller" event to monitor what's happening on the map and poll the object locations to see when the puzzle is complete.


    It will run as a parallel process, checking every few frames to see where everything is. By default, a parallel process event will run all the commands listed, then will go back to the top and repeat the process, until we do something to tell it to stop.


    When the puzzle is complete, it'll display a message and stop any further checks.


    At this point, you will want to reward your player for completing the puzzle, and maybe stop them from pushing the objects around any more.


    Step 4a - Get first event's X and Y coordinates, and find the terrain tag or region id at that location on the map

    Spoiler





    Step 4b - Compare with the 'special' terrain tag or region id


    If it's not the 'special' terrain tag or region id, this object is not on its final tile and the puzzle is not solved. We don't need to check any more events, so just skip to the end, ready for the next iteration.

    Spoiler





    Step 4c - Repeat the test for all other movable object events


    Copy and paste those lines so there's one group for each event. Then change the event ID in each group, so at the end you're doing the check for each of your movable object events

    Spoiler





    Step 4d - Success!!!


    All objects are on the correct type of tile. Do whatever needs to be done to let the player know they've succeeded, and end the puzzle.

    Spoiler





    Step 4e - Failure


    Just wait a few frames to avoid lag, then by default the event will start running from the top again.

    Spoiler





    Add your player's starting location in the correct spot, and play away.


    本贴来自国际rpgmaker官方论坛作者:Shaz处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/make-a-sokoban-puzzle.16667/

    本帖子中包含更多资源

    您需要 登录 才可以下载或查看,没有账号?立即注册

    x
    天天去同能,天天有童年!
    回复 送礼论坛版权

    使用道具 举报

    文明发言,和谐互动
    文明发言,和谐互动
    高级模式
    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    简体中文
    繁體中文
    English(英语)
    日本語(日语)
    Deutsch(德语)
    Русский язык(俄语)
    بالعربية(阿拉伯语)
    Türkçe(土耳其语)
    Português(葡萄牙语)
    ภาษาไทย(泰国语)
    한어(朝鲜语/韩语)
    Français(法语)
    关闭

    幸运抽奖

    社区每日抽奖来袭,快来试试你是欧皇还是非酋~

    立即查看

    聊天机器人
    Loading...

    QQ|Archiver|手机版|小黑屋|同能RPG制作大师 ( 沪ICP备12027754号-3 )

    GMT+8, 2026-7-14 16:53 , Processed in 0.130097 second(s), 52 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

    快速回复 返回顶部 返回列表