Try my new Mobile Game Development Course 75% OFF!
Easy Image Trail or After Image
This script is designed to make adding graphical effects like image trails (also known as after images) as easy as possible to implement into your game.
This asset contains 1 script. Yes you read that right 1 self contained script. In order to add that awesome after image your after all you have to do is call the following script in your draw event.
This script expects 4 arguments.
Colour (default c_white)
Script is commented thoroughly with example.
Max length is exactly how it sounds. How many sprites should comprise the length of your trail? higher number means longer after image and smaller numbers mean a shorter after image.
Spacing is also as it sounds. How much space is between each image in the image trail. So if you provide the number 2 then it will wait 2 steps before updating the next image position. If you set this to 0 then all the images will be bunched closer together. Higher means farther apart lower means closer together. I recommend a minimum of 2.
Fade length is how long it takes for a after image to fade out.
Colour is pretty self explanatory. If you use the default c_white then the after image will be of the same sprite of lower alpha values. If you decide to use something like c_aqua or make_colour_rgb then the sprite will be coloured in the after image.
Change log 08/18/2018
Resolved memory leak issue. Added cleanup script to event cleanup. When the player would change rooms the ds_lists would be left in memory. To resolve this I added a simple clean up to delete the ds_lists on the clean up event.
Added a new project that uses arrays.
This asset's design was intended to be one usable script without any outside help. For example you would NOT need to init any variables in the create event. However after fixing the memory leak this was impossible with ds_lists. By having to add a script to the given object's clean up event this means it is not a single script. I reworked the asset to use arrays. GMS automatically cleans up arrays on its own when the game ends or when the room changes or even if the instance itself is destroyed.
Enjoy the update and good luck on all your Game Development Endeavors.
*Added more comments
*changed the script to include a new argument for how long it takes a after image to fade out this gives the user more control
*Fixed an issue with spacing. Spacing was also causing the alpha to update at the same spacing as adding a new image this resulted in images lingering longer than the should. To fix this I added the new argument fade_length this way you can control the alpha fade outside of spacing. The images can create at whatever spacing you like and each image will have its alpha update each step.
Note having the ability to set fade length means you need to be careful with the number of after images. If the fade_Length is to short it will not display all of the images. A good setting is scr_after_image(5, 4, 0.05, c_white).
Removed a few old comments. Wasn't meant to be left in the code.
Version 2.1.0. Published August 18, 2018
You can only review assets you've bought.
Very easy to use with static images.
Very simple and nice effect, super easy to use, since you have to call one script and it just works.
The thing is, that it looks nice on sprites that do not change their orientation. If you would like to create "speed" effect and your character runs left, the afterimage of the sprite will be turned left as it should be, but when character starts moving the other direction, then the afterimage of the object is still facing left. I was unable to change it in any way.
Thanks for the review. I am glad you found this asset useful. As for making it copy the direction the image is facing that depends on how you are making the sprite change direction. If it is a dedicated sprite then it should work automatically. If your changing the facing direction via image_xscale then you will need to go into the script and on line 49 alter the draw_sprite_ext function. The fifth argument is the xscale and the next argument is the yscale. By default this is set to 1. Simply alter the arguments to image_xscale and image_yscale and the scale will now match your sprite. Since this is a self contained script you could make a copy of it and make the copy scr_after_image_scale() that way you have both for whatever you may need.
Easy and effective
Was looking for a quick and easy after image script to save some time for my battle system. This was perfect!
This review was left for a previous version of this asset.