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.

[XP]-Creating a Shadow bitmap shaped like a character/event

I was curious how this is done, because I wanted to finish a vehicle script I started awhile back.

The basics of what I need to know...

# How to create a bitmap in the shape of a character

The advanced of what I need...

# How to stretch/skew the image
# How to turn the graphic into all shadow color

Basically, what I'm trying to do is make an independant 'shadow' that'll change size/offset or whatever it needs to change based on the vehicle's 'height from ground', and get smaller the 'higher' the vehicle flies.

This will also be used for when you take off/land the 'flying' vehicle, in place of seperate anim charactersets too. I guess this would all be an 'optional' system, seeing as charsets DO work fine, but it would be something cool to kick it off with!
 
It all depends on how you plan to do this. I personally suggest looking at Rataime's Shadow System.

Now what you are going to need to do is create a sub-sprite in the Sprite_Character class. Like so:
Code:
class Sprite_Character
  alias_method :seph_shadows_sprchr_init, :initialize
  alias_method :seph_shadows_sprchr_dispose, :dispose
  alias_method :seph_shadows_sprchr_update, :update
  def initialize(*a)
    seph_shadows_sprchr_init
    @shadow_sprite = Sprite.new(self.viewport)
    @shadow_sprite.z = self.z - 1
  end
  # ...
end

From here, in the new update method, you are going to have to read the pixels visible in your sprite character from the bitmap. Then, draw pixels on your @shadow_sprite.bitmap. It's not the hardest task, but if you plan to add an anything like complex angels, it won't be the easiest tasks. I suggest doing some online research or looking at Rataime's.
 
Kain Nobel":2pqrs8fa said:
I was curious how this is done, because I wanted to finish a vehicle script I started awhile back.

The basics of what I need to know...

# How to create a bitmap in the shape of a character

The advanced of what I need...

# How to stretch/skew the image
# How to turn the graphic into all shadow color

Basically, what I'm trying to do is make an independant 'shadow' that'll change size/offset or whatever it needs to change based on the vehicle's 'height from ground', and get smaller the 'higher' the vehicle flies.

This will also be used for when you take off/land the 'flying' vehicle, in place of seperate anim charactersets too. I guess this would all be an 'optional' system, seeing as charsets DO work fine, but it would be something cool to kick it off with!

From  what I could tell, this could essentially use a clone of the picture, with some slight mods. First, you want to have the picture display at a specific x and y based on the location of whatever it is the shadow of. (really the first thing is to make sure that the picture is the charater's sprite) Then, you set its color to black, with some transparency. Then, you can use the picture clone's commands toiio skew the image, so that it is always at a certain angle, or, if you want to risk lag, the angle changes based on something else, like the time of day. (or if you REALLY want to risk lag, it could also change based on specific light-emitting events, as well)

EDIT: someone else got in before me, but I still hold my point.
 

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