• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

How to use a sequence as object sprite

For my game maker project, I need to learn how to use a sequence as object sprite. So i can make things like: the sprite of the player when is punching is a sequence because inn the moment when the punch swing it has a hitbox.

If someone know how to do this trick, let me know.
 

samspade

Member
Is your hitbox also an object in the sequence?

This is doable, but probably not the most efficient way to handle it. If the hitbox doesn't move at all relative to the player, I would just spawn the hit box object directly. If the hitbox does move relative to the player and you want to use the sequence to animate it, I would only animate the hitbox object using the sequence and set the sequence origin to be the same as the player's sprite's origin, then create and destroy the sequence the same way you would the hitbox, without messing with the player or the player's sprite (which would be animated in the traditional way).



Mathroo has a tutorial on instance overriding which could be useful if you do want to try your original idea though:

 
Is your hitbox also an object in the sequence?

This is doable, but probably not the most efficient way to handle it. If the hitbox doesn't move at all relative to the player, I would just spawn the hit box object directly. If the hitbox does move relative to the player and you want to use the sequence to animate it, I would only animate the hitbox object using the sequence and set the sequence origin to be the same as the player's sprite's origin, then create and destroy the sequence the same way you would the hitbox, without messing with the player or the player's sprite (which would be animated in the traditional way).



Mathroo has a tutorial on instance overriding which could be useful if you do want to try your original idea though:

Ok. I followed the video and copy the code as it write it. It's almost working. Only one problem: while I play the sequence the sprite of the object dosn't hide.
this is the code that I've used:

GML:
var _playerInst = instance_find(oPlayer, 0);
var _sequence = Sequence1;
var _layerName = "Instances";

var _seqElm = layer_sequence_create(_layerName, _playerInst.x, _playerInst.y,_sequence)

var _seqInst = layer_sequence_get_instance(_seqElm)

sequence_instance_override_object(_seqInst, oPlayer, _playerInst);
what can I do?

well ... I'll use Game Maker Studios 2 to find a solution. Reply when you find one.
 
wai
Ok. I followed the video and copy the code as it write it. It's almost working. Only one problem: while I play the sequence the sprite of the object dosn't hide.
this is the code that I've used:

GML:
var _playerInst = instance_find(oPlayer, 0);
var _sequence = Sequence1;
var _layerName = "Instances";

var _seqElm = layer_sequence_create(_layerName, _playerInst.x, _playerInst.y,_sequence)

var _seqInst = layer_sequence_get_instance(_seqElm)

sequence_instance_override_object(_seqInst, oPlayer, _playerInst);
what can I do?

well ... I'll use Game Maker Studios 2 to find a solution. Reply when you find one.
wait... no it's all wrong I need a code combination that use sequences that flips horizontaly when the player is turn to the opposite direction.
 
wait! I've Finaly found the right code here:
Busting Moves! Bring Your Characters to Life with Sequences (yoyogames.com)

My sequences knowledge is almost as requested. I must just know how to move the sequence with the object while it's moving. Open to Suggestions. If you know the answer, reply it.
Good news! I've found the solution and now:
- my sequence will move with the object_player as is moving on a moving platform
- object_player when sequence is playing the object will move as is on a moving platform orslippering on ice. and it will stop if is on a regular terrain
 
Top