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

[转载] Problem manipulating viewport for big enemy battler sprite

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

    连续签到: 2 天

    [LV.7]常住居民III

    4446

    主题

    864

    回帖

    2万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

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

    灌水之王

    发表于 7 天前 | 显示全部楼层 |阅读模式
                            I was debating whether to post about this error in the "general" support section or here, but since I'm already trying to work with the scripts directly, here seems more ideal.                
    Click to expand...


    I was trying to manipulate some data to change the battle presentation of the windows, not too fancy, just to make it look a bit different. So, something like the following:





    But, when trying to change it this way, I found a problem with how the viewport seems to work.

    I created a copy of class Spriteset_Battle so I could change the viewport of the battleback

                    Ruby:        
    class Spriteset_Battle   # Default comments etc...   def initialize     # Make viewports     @viewport1 = Viewport.new(0, 0, 440, 480) # The original was 640, 320 iirc #some code...   end          def update     # Update actor sprite contents (corresponds with actor switching)     # some code...     @battleback_sprite.src_rect.set(0, 0, 440, 480) #same change


    This is what I changed so it would fit the new resolution for the battleback. However, when I tried to change the viewport relevant to the enemy (creating its own viewport even) with a bigger sprite, it showed it self as a cropped sprite.




    This does make sense honestly, but now i'm kinda confused. What would be the best way to change this so it accommodates larges sprites? For some reason, on the Troops editor, I can only move the sprite beyond the TOP of the editor, not below, which is kinda silly honestly and its what its making this a headache...


    The important part that makes this changes is as follows:
                    Ruby:        
    class Spriteset_Battle   #--------------------------------------------------------------------------   # * Public Instance Variables   #--------------------------------------------------------------------------   attr_reader   :viewport1                # enemy viewport   attr_reader   :viewport2                # actor viewport   #--------------------------------------------------------------------------   # * Object Initialization   #--------------------------------------------------------------------------   def initialize     # Make viewports     @viewport1 = Viewport.new(0, 0, 440, 480)     @viewport2 = Viewport.new(0, 0, 640, 480)     @viewport3 = Viewport.new(0, 0, 640, 480)     @viewport4 = Viewport.new(0, 0, 640, 480)     @viewport5 = Viewport.new(0, 120, 600, 480) # putting a "offset" on y parameter, so it moves the view to centralize its display based on what the editor shows     @viewport2.z = 101     @viewport3.z = 200     @viewport4.z = 5000     # Make battleback sprite     @battleback_sprite = Sprite.new(@viewport1)     # Make enemy sprites     @enemy_sprites = []     for enemy in $game_troop.enemies.reverse       @enemy_sprites.push(Sprite_Battler.new(@viewport5, enemy))


    I thought about changing the Battler class itself, but i'm still trying to understand how some functions work, specially the ones that doesnt seem to be editable, and I was afraid to break other stuff that is already working.

    If there's any additional advice to make it easier to understand the code and specially to know where each methods are (since the search is per file, not for all scripts) I would appreciate a lot as well. Thanks!


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

    本帖子中包含更多资源

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

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

    使用道具 举报

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

    本版积分规则

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

    幸运抽奖

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

    立即查看

    聊天机器人
    Loading...

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

    GMT+8, 2026-7-14 14:22 , Processed in 0.116188 second(s), 56 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

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