Jump to content


Photo

[solved] "dashing Shadow" Effects...


  • Please log in to reply
9 replies to this topic

#1 shinyrockets

shinyrockets

    GMC Member

  • New Member
  • 13 posts

Posted 12 April 2010 - 07:38 PM

My game is a platforming engine using a character who uses pixelated (x,y) movement when moving (while walking or jumping), but hspeed when dashing. I am using GM8(Lite). I'm currently under the process of creating a Megaman Zero-styled "dashing shadow" effect, as I have named it, and need help.

To put it bluntly, I am stumped.

When the character is dashing, or jumping after dashing, a trail of two/three dash shadows are created behind the character. These dash shadows have these particular behaviors:

+When created, one dash shadow would be created after the next (in timely offsets) until three exist.
+Dash shadows have identical sprites to the main character, however -- the farther shadow, the more time it takes for the image indexes to match.
+Dash shadows follow the main character and match his movement until the character changes to a particular stance (ex: while standing or wall sliding)
+When the character changes to that stance, the trail of shadows move to his exact position and disappear when changing to that stance as well.

EDIT: Another thing is that dash shadows are colorized and blended to one color. Therefore, I'm not interested in transparency fading.

Similar effect behaviors, to my knowledge are used with dashing smokes in Megaman Zero or Megaman X. A trail of four smokes are created, but when a character is not dashing or wall sliding, these smokes unite at a certain position and disappear afterward.

To those unfamiliar with the Megaman games, please refer to a gameplay example of either game (Megaman Zero recommended) on youtube. There are also examples found in the Game Maker site, if one can find a good Megaman Zero/ZX-style demo. Dashing is a very fundamental mechanic implemented and used/abused in these games, so I will refrain from providing a specific link unless if requested with good reason.

Thanks for your time. All help is appreciated. :)

----

UPDATE (4/14/10) The issue has been solved. Two separate implementations have been created as a result of this thread, and that is Khelder's and mine's. So if one wants to create these dashing shadows without the use of a draw_sprite method, read on...

Note: To view Khelder's method, scroll down and read the replies. Otherwise, you can also use mine, which involves creating a lot more instances, but less advanced logic. Alternatively, you can also use elements of both methods and see what works out for you.

For movement, basically what you do is have the character continuously create "markers" as he is dashing. When the player starts dashing, a shadow is also created, and after a specific amount of time, it starts moving towards those markers. When the shadow touches these markers, they are destroyed, kind of like Pac-Man on automatic. When the player reaches a certain stance and is in collision with the floor or the wall (depending on your stance, ex: standing or wall sliding), the shadow is destroyed.

To use multiple shadows, simply create them when the player starts dashing, only make their starting times different.

For colorizing them in GM8, do it by hand. At the creation of the shadow, set it to !visible and create another object to replace the sprite with a colorized sprite that you have edited on your own. Another alternative is to set their image_alpha values to a non-negative number less than 1 - this shadow effect is notably used in SNK's fighting games, as I have recently found out through playing Neo Geo Battle Colosseum.

Great thanks to the repliers of this thread for helping. All answers are just as helpful as mine.

Edited by shinyrockets, 14 April 2010 - 06:56 PM.

  • 0

#2 Falco

Falco

    GMC Member

  • New Member
  • 357 posts

Posted 12 April 2010 - 08:16 PM

You could draw the player sprite at the player's position every so often, and have each image fade out slowly.
  • 0

#3 shinyrockets

shinyrockets

    GMC Member

  • New Member
  • 13 posts

Posted 12 April 2010 - 08:18 PM

You could draw the player sprite at the player's position every so often, and have each image fade out slowly.


EDIT: I've tried that already, and I'm looking for something more specific -- in other words, the colorized shadows. I do plan on making separate sprites for each as a workaround from Pro. Thanks for replying - I made a proper edit for the topic.

Edited by shinyrockets, 12 April 2010 - 08:20 PM.

  • 0

#4 Falco

Falco

    GMC Member

  • New Member
  • 357 posts

Posted 12 April 2010 - 08:31 PM

draw_sprite_ext(sprite,image,x,y,1,1,0,color,alpha );

You could also use special x and y values to make them follow at a distance until you stop moving, as well as a subimage variable that doesn't exactly match the player's subimage.

I'd recommend against using multiple objects when this could do the same thing if you use dynamic variables.

Edited by Falco, 12 April 2010 - 08:33 PM.

  • 0

#5 shinyrockets

shinyrockets

    GMC Member

  • New Member
  • 13 posts

Posted 12 April 2010 - 08:35 PM

draw_sprite_ext(sprite,image,x,y,1,1,0,color,
alpha );


:chikin

As much as I'd like to use this, I only have GM8 Lite, so I can't. I'm looking for a workaround, really, if that's even possible. I'm going to try to other way though. Thanks.

Edited by shinyrockets, 12 April 2010 - 08:37 PM.

  • 0

#6 Falco

Falco

    GMC Member

  • New Member
  • 357 posts

Posted 12 April 2010 - 08:50 PM

Ohh, I didn't realize that the extended function was pro only, sorry.

You may be able to use draw_set_alpha and draw_set_color, but I don't think they would be as effective as using objects, at this point. :chikin
  • 0

#7 shinyrockets

shinyrockets

    GMC Member

  • New Member
  • 13 posts

Posted 13 April 2010 - 02:20 AM

Ohh, I didn't realize that the extended function was pro only, sorry.

You may be able to use draw_set_alpha and draw_set_color, but I don't think they would be as effective as using objects, at this point. :P


hahaa. it's fine. =]

the main concern I have is their movement. I tried it just now and didn't understand what you meant by "dynamic variables." o.0

Edited by shinyrockets, 13 April 2010 - 02:29 AM.

  • 0

#8 Khelder

Khelder

    GMC Member

  • New Member
  • 2018 posts

Posted 13 April 2010 - 12:39 PM

The reason the objects seperate, then come together, is because they accelerate/decellerate at different times.

Create:
speed = 0;
direction = point_direction(x,y,/*object to follow*/.x,/*object to follow*/.y);
Step:
if point_distance((x,y,/*object to follow*/.x,/*object to follow*/.y) > 12 && speed == 0 {
	speed = 6;
} else if point_distance((x,y,/*object to follow*/.x,/*object to follow*/.y) < 12 && speed == 6 {
	speed = 2;
}
if !instance_exists(/*object to follow*/) { //For the second/third shadows.  Delete for 1st
if /*player is not dashing*/ && point_distance(x,y,/*last shadow*/.x,/*last shadow*/.y) <3 { //First Shadow.  Delete for 2nd/3rd
	instance_destroy();
}
direction = point_direction(x,y,/*object to follow*/.x,/*object to follow*/.y);

This should work, once you change the comments for each object, and delete the correct if. It assumes that you're using seperate objects for each "shadow", and your dash speed is 6, so change the 3s, 6s and 12s to corrispond to your dash speed
  • 0

#9 shinyrockets

shinyrockets

    GMC Member

  • New Member
  • 13 posts

Posted 13 April 2010 - 04:36 PM

Khelder: Thankssomuch for your insight! I didn't realize that acceleration/deceleration applies to the dash shadows. I was playing MMZ just recently and their speeds look surprisingly constant. I'm going to try it soon and reply later to report the success/failure.

I was about to use another way which uses two objects for every shadow. Though, I'm weary since it involves the creation of multiple instances to set a "path" for the moving shadow. With the point_direction code, though, I could probably save a lot of work in doing so, thus not having to create a path to begin with.

The other thing I was worried about as well were the sprite index offsets. I think I just came up with a solution for that by using timers, though.

Edited by shinyrockets, 13 April 2010 - 04:47 PM.

  • 0

#10 Khelder

Khelder

    GMC Member

  • New Member
  • 2018 posts

Posted 13 April 2010 - 07:44 PM

Store the sprite indexes in an array in the player object? Shift the items in the array along one (deleting from the end, for a max of 30 or so) each step, and have the shadows get their sprite index from that (Shadow 1 = 10th item, 2 = 20th, 3 = last, or something like that. Tweak to fit your engine)

The acceleration/decelleration affects the shadows because it affects the player - and they're just images of where the player was n seconds ago

Edited by Khelder, 13 April 2010 - 07:45 PM.

  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users