Game maker help needed

how do you have it so when you have an object, and you can change it to a different sprite, but when it is that different sprite can you get it to do something different to when it was the original sprite? does that make any sense?

explain clearer? you mean like running animations?

We have a sticky at the top of the board for questions like this.

Edit: Anyway, to answer the question, since it’d be cruel to have you ask over there when the answer is this simple… You have to use one or two of the most basic logical ideas of programming. “If statements” and possibly “variables”.

Just set up something like this: (just change the code to actual code, or use the drag 'n drop icons if you prefer)

if (something is done to change the sprite) {
change sprite to new sprite;
variable “changedsprite” set to true;

Then add this little bit wherever you want something different to happen:

if (the variable “changedsprite” is set to true) {
Do whatever has changed here…;
else {
Do what originally happened here;

This way it checks if the sprite has been changed in order to determine what it does at certain points, and it can tell whether the sprite has changed or not. Just a small reminder, though, that you can’t check for a variable that doesn’t exist yet. If you use only the code I gave you above, you’ll probably get an error message when you run the game. To fix this, either remove “changedsprite” completely and just check if the variable “sprite_index” (keeps the number of the sprite being used) is set to the new sprite; or just add a “Create” event to the object and set the variable “changedsprite” to 0 or false in it.