Spawn animated sprites with random clothing, hair, weapons etc...

2
  • 23 favourites

Attached Files

The following files have been attached to this tutorial:

.capx

randomizesprites.capx

Download now 222.89 KB

Stats

3,040 visits, 4,015 views

Tools

Translations

This tutorial hasn't been translated.

License

This tutorial is licensed under CC BY 4.0. Please refer to the license text if you wish to reuse, share or remix the content contained within this tutorial.

Here is a very simple way to randomize the look of the sprites for your games. You can easily change their clothes, hair, weapons etc with this easy trick. This works very well if you have an enemy type that you want to have several different looks but the same base so you don't have to write new events for the properties or AI. It also works well for creating an enemy type with random weapons. Basically you'll be able to create an enemy, lets say a pirate, and each time it's spawned in the game it will have different clothing, weapons etc.

The first thing you need to do is in your image editor (photoshop, gimp, paint.net etc) open your sprite sheet and using the color selection tool isolate the different parts of the sprite one at a time and copy and paste them onto their own layers. In my example I did this with the sprites hair, pants and shirt, but you can do whatever parts you want. Don't forget to copy and paste the transparent area in the sprite sheet as well so your frames will all match up when you put them back together. Once the part is isolated on its own layer then you can duplicate the layer and change the colors to whatever you want. After you have all the changes that you need, save each layer as a separate png file. Make sure you save the actual body with the other parts removed from the layer as well. This will become the base for your sprite. Once you have all the images you'll need it's just a matter of adding them to your project and setting up your event sheet. I've included a capx example of how I set it up. This is the easiest way I could think of. I'm sure there are better ways to do it but this way works well and may perhaps get you thinking about other ways you could do it.

Open the capx and run the Layout 1 preview. Press the spacebar to see the look of the sprite change. Of course in a real game you would just set the randomize event on the creation trigger or on the start of the layout.

I hope you find this useful!

.CAPX

randomizesprites.capx

Download now 222.89 KB
  • 0 Comments

  • Order by
Want to leave a comment? Login or Register an account!