Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Showing pictures at specific places depending on # of heroes in party.

This shouldn't be too hard to do, but I haven't been able to do it by myself...
I want to show one or more pictures (stored in the pictures folder) depending on how many people you have in your party. This is for the battle, to have image backgrounds under the character info.
if I have only 1 char, I need 1 pic to show in (240, 320)
if I have 2 chars I need 2 pics shown at (160, 320) and (320, 320)
if I have 3 chars I need 3 pics to be shown at (80,320) (240, 320) and (400, 320)
if I have 4 chars I need 4 pics to be shown at (0, 320) (160, 320) (320, 320) and (480, 320)
I hope it isn't too complicated, I tried to search for a similar topic but couldn't find any.
Thanks in advance :)
 
The easiest way is to have Conditional Branch > Tab 4 > Script, in which you have $game_party.actors.size == x (x is the number of actors you check for). Otherwise, you could always script the whole thing with a "case" statement, but the you would need to use $game_screen.pictures[].show(8 parameters go here)
 
could you be a little more specific please? I want to do the whole thing inside the window_battlestatus script, I guess I could make 4 separate cases with "if" statements, each one depending on the party size and showing the pic(s) at that coordenates?
EDIT: nevermind got it to work, this is the code I used:
Code:
#Depending on how many people in party, amount and coordinates of pic(s) change)
      if $game_party.actors.size == 1
     @sprite = Sprite.new
     @sprite.bitmap = RPG::Cache.picture("square.png")
     @sprite.x = 240
     @sprite.y = 320
      elsif $game_party.actors.size == 2
     @sprite = Sprite.new
     @sprite.bitmap = RPG::Cache.picture("square.png")
     @sprite.x = 160
     @sprite.y = 320
     @sprite2 = Sprite.new
     @sprite2.bitmap = RPG::Cache.picture("square.png")
     @sprite2.x = 320
     @sprite2.y = 320
      elsif $game_party.actors.size == 3
     @sprite = Sprite.new
     @sprite.bitmap = RPG::Cache.picture("square.png")
     @sprite.x = 80
     @sprite.y = 320
     @sprite2 = Sprite.new
     @sprite2.bitmap = RPG::Cache.picture("square.png")
     @sprite2.x = 240
     @sprite2.y = 320
     @sprite3 = Sprite.new
     @sprite3.bitmap = RPG::Cache.picture("square.png")
     @sprite3.x = 400
     @sprite3.y = 320
      elsif $game_party.actors.size == 4
     @sprite = Sprite.new
     @sprite.bitmap = RPG::Cache.picture("square.png")
     @sprite.x = 0
     @sprite.y = 320
     @sprite2 = Sprite.new
     @sprite2.bitmap = RPG::Cache.picture("square.png")
     @sprite2.x = 160
     @sprite2.y = 320
     @sprite3 = Sprite.new
     @sprite3.bitmap = RPG::Cache.picture("square.png")
     @sprite3.x = 320
     @sprite3.y = 320
     @sprite4 = Sprite.new
     @sprite4.bitmap = RPG::Cache.picture("square.png")
     @sprite4.x = 480
     @sprite4.y = 320
     end
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top