• 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!

I'm a beginner at programming, so how do I make enemies react to certain sprites (player attack spr)

D

Dravidion

Guest
I'm a beginner at programming, so how do I make enemies react to certain sprites? (player attack sprites) Enemies react to the regular non-attacking character obj/sprite but I only want them to react to the attack sprites.
Please help me by telling me the necessary and explaining what each piece means. Or telling me through drag and drop works. Thank you!
 

NicoDT

Member
Hello, and welcome.
First of all, as you are new to game maker, I'd recommend you to check all of Shaun's tutorials: https://www.youtube.com/user/999Greyfox
You will learn a lot (that's where I started from), and will help you come to different solutions you may have.

Now, going back to your question. I would advise you not to check against your player sprite, but create an attack object that will check collision with the enemy and damage it. Here's a tutorial that will explain what you need to know.


Let me know if you have any problem after checking it.
Good luck.
 

Xer0botXer0

Senpai
Code:
Var react_type = obj_player.image_index;
Switch  (react_type)
{
    case 0:
    {
    //ex: players sword is out.. attack
    }
    case 1:
    {

    }
}


Here's a primitive method to achieve what you're taking about


It's probably going to cause you a problem if your player character is animated. Therefore the version of this that supports animation is a bit more complicated so you'd rather use a Boolean instead.
 
S

SayBaconOneMoreTime

Guest
Hello, and welcome.
First of all, as you are new to game maker, I'd recommend you to check all of Shaun's tutorials: https://www.youtube.com/user/999Greyfox
You will learn a lot (that's where I started from), and will help you come to different solutions you may have.

Now, going back to your question. I would advise you not to check against your player sprite, but create an attack object that will check collision with the enemy and damage it. Here's a tutorial that will explain what you need to know.


Let me know if you have any problem after checking it.
Good luck.
This man. This man knows. Trust me. Watch all of Shaun's stuff (I'm assuming you are on GMS2, which means some of the info in the older tutorials will be outdated, but mostly not) and you will be sooooo much better off than just going in blind and asking for help here- this is a very nice forum, but it can't teach you how to program from start to finish. Some other people I would recommend are Heartbeast- if you are interested in making an RPG, then his tutorial series on that will help a lot- and Pixelated Pope, who actually frequents these forums as well and generally seems like a very nice guy. Very knowledgeable too, my game's camera system is an amalgam of his resolution and scaling videos and Shaun's dynamic cam system videos. I'm sure there are other great content creators for the engine out there too, but my main go-to's, especially for beginners, are those three. I still watch their videos from time to time if I get stuck, although this wasn't my first gig programming stuff, so it came fairly easy this go around.

EDIT: Also, to the person whose comment I quoted- Greenlight project looking very nice indeed sir. Fourth quarter of 2017 still looking feasible?
 

NicoDT

Member
EDIT: Also, to the person whose comment I quoted- Greenlight project looking very nice indeed sir. Fourth quarter of 2017 still looking feasible?
Thank you so much. Yes, I believe so. The game is playable right now, I need to add quests, add music and sfx, and add a couple of scenes. By the way, I was greenlit today :D
 
S

SayBaconOneMoreTime

Guest
Thank you so much. Yes, I believe so. The game is playable right now, I need to add quests, add music and sfx, and add a couple of scenes. By the way, I was greenlit today :D
Grats! I was wondering why I couldn't find the vote button or whatever. Good luck dude!
 
Top