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.

Few question's and help with CMS..

Eshe

Member

Well im trying to make my own CMS to kind of get the hang of Rmxp..but I keep running into problem's..but I finally got most of it to work now I wanna add a bitmap to it but I cant erase the bitmap afterward's..

Code:
class Profile<Sprite_Picture
  
  def initialize(profile)
    @img = Sprite.new
    @img.bitmap = RPG::Cache.picture(profile)
    @img.x=75
    @img.y=275
  end
end

I call the method in a Event like this..
Code:
@profile=Profile.new("Eshe")

1.How do I pause the whole game for a few seconds inside of a script..
2.im pretty sure the error is in my code but how do I set the Width and
Height of a bitmap..
3.How do I dispose of the Bitmap..
 
First, you got it all wrong.

Take a look at your code :

Code:
class Profile < Sprite_Picture
  
  def initialize(profile)
    @img = Sprite.new
    @img.bitmap = RPG::Cache.picture(profile)
    @img.x=75
    @img.y=275
  end
end

you're creating a class ('Profile') which is already a sprite in itself, because it inherits from Sprite_Picture (but then that class isn't a good choice).

Here's how you should do it :

Code:
class Sprite_Profile < Sprite # I like to name class with Sprite_ or Window_ etc.. so I know what they're used for
  def initialize(pic_name)
    super() # very important, this command calls the initialize method of the Superclass (in this case, Sprite)
    self.bitmap = RPG::Cache.picture(pic_name)
    self.x = 75
    self.y = 275
  end
end

then,
Code:
@profile = Sprite_Profile.new("Eshe")

@profile.dispose # to dispose the sprite and its bitmap...

Q1 : why do you want to pause the game?
Q2 : you don't set the width and height of a bitmap you load, it's automatic.
Q3 : look above.
 

Eshe

Member

ahhhh ok Thanks..

Well I wanna pause the game because this code runs with another one to make The Custom Message Window but since I couldn't pause or freeze the game I had to do it through event..Im trying to avoid using anything other than the script for the Message Window..And I kinda want to know for future refrence..lol :D
 

khmp

Sponsor

To get the effect of pausing you can create Spriteset_Map object behind your menu. Possibly create a simple pause picture in paint and lower its opacity when you draw it so it overlays the Spriteset_Map.

As usual good luck with whatever you end up doing!:thumb:
 

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