Shop layout

Discussion in 'Learning Javascript' started by Tatsumaro, Jan 29, 2018.

Thread Status:
Not open for further replies.
  1. Tatsumaro

    Tatsumaro Veteran Veteran

    Messages:
    205
    Likes Received:
    40
    First Language:
    Portugues
    Primarily Uses:
    RMMV
    Hi, i have a new challenge.
    Here is the code that determines the vertical spacing off the items for sale in shop_scene? Can it be altered only in BuyWindow?
     
    #1
  2. Poryg

    Poryg Pixie of the Emvee kingdom, Ham of a Hamster Veteran

    Messages:
    3,864
    Likes Received:
    9,719
    Location:
    Czech Republic
    First Language:
    Czech
    Primarily Uses:
    RMMV
    It can. Search for Window_ShopBuy in rpg_windows.js. And of course Scene_Shop in rpg_scenes.
     
    #2
    Tatsumaro likes this.
  3. Tatsumaro

    Tatsumaro Veteran Veteran

    Messages:
    205
    Likes Received:
    40
    First Language:
    Portugues
    Primarily Uses:
    RMMV
    Window_ShopBuy.prototype.drawItem = function(index) {
    var item = this._data[index];
    var rect = this.itemRect(index);
    var priceWidth = 96;
    rect.width -= this.textPadding();
    this.changePaintOpacity(this.isEnabled(item));
    this.drawItemName(item, rect.x+10000, rect.y, rect.width - priceWidth);
    this.drawText(this.price(item), rect.x + rect.width - priceWidth,
    rect.y, priceWidth, 'right');
    this.changePaintOpacity(true);
    };

    sorry but i don't know what im doing... im i even closer whit this "+1000"

    PS: in Scene_Shop i didn't notice any place to alter this value
     
    #3
  4. gstv87

    gstv87 Veteran Veteran

    Messages:
    1,746
    Likes Received:
    766
    First Language:
    Spanish
    Primarily Uses:
    RMVXA
    you're one level too deep.
    find the instruction that calls drawItem, which is called from inside a loop, which updates the origin point at every loop.

    drawItem merely draws wherever the instruction that calls *it* tells it to draw.
     
    #4
    Tatsumaro likes this.
  5. Tatsumaro

    Tatsumaro Veteran Veteran

    Messages:
    205
    Likes Received:
    40
    First Language:
    Portugues
    Primarily Uses:
    RMMV
    Thanks its perfect.
     
    #5
  6. mlogan

    mlogan Global Moderators Global Mod

    Messages:
    13,750
    Likes Received:
    7,600
    Location:
    Texas
    First Language:
    English
    Primarily Uses:
    RMMV

    This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

     
    #6
Thread Status:
Not open for further replies.

Share This Page