? Enemy ai (Page 1) ● SmileBASIC Source Forums

Sign In

Register
*Usernames are case-sensitive
Forgot my password
This website has been moved, please see this post

Enemy ai

  • #1 ✎ 149 Komodo Pokemon Is Awesome! I love Pokemon! Express Yourself Drawing I like to draw! Hobbies Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength so i'm in progress of making a top down rpg and I need some help on enemy ai so if you guys can give me some ideas that whould be great thanks. Posted
  • #2 ✎ 337 Minxrod Third Year My account is over 3 years old Website Expert Programmer Programming no longer gives me any trouble. Come to me for help, if you like! Programming Strength QSP Contest 2 Contest Participant I participated in the second SmileBASIC Source QSP Contest! Random moving enemies or 'smart' ones? If it's random then one (bad) way to do it could be R=RND(4) IF R AND 1 THEN INC X 'movement code like X=X+1 IF R AND 2 THEN DEC X IF R AND 3 THEN INC Y IF R AND 4 THEN DEC Y or something of that sort. Smart enemies are harder. Posted Edited by Minxrod
  • #3 ✎ 149 Komodo Pokemon Is Awesome! I love Pokemon! Express Yourself Drawing I like to draw! Hobbies Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength smart enemys that attack with a sword when close enough. Posted
  • #4 ✎ 270 NeatNit First Week Joined in the very first week of SmileBASIC Source Website Expert Programmer Programming no longer gives me any trouble. Come to me for help, if you like! Programming Strength Night Person I like the quiet night and sleep late. Express Yourself Enemies in the NES era traditionally had very basic AI, take for example The Legend of Zelda. Every single enemy had either very linear AI (e.g. move towards player at constant speed) or random AI (e.g. move randomly and change direction every x frames), or some combination of the two (e.g. appear in a random spot and fire towards the player, then disappear). These things are quite easy to program to be honest, and depending on your game, are likely to be very fun to play against. If you strive for more advanced AI, there is no one right way to do it. You seem to know what you want the enemy to do (get close to play, attack with sword), it's not so hard to code. Code it, see how it behaves, then think about ways to improve it - or maybe you'll think that it's fine the way it turns out! Posted
  • #5 ✎ 149 Komodo Pokemon Is Awesome! I love Pokemon! Express Yourself Drawing I like to draw! Hobbies Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength ok i think i got a basic idea of what to do ,but how do you change the speed the enemy is going because i run into a problem of it going way to fast making it difficult to beat. Posted
  • #6 ✎ 477 SquareFingers You change the speed by changing how far the enemy travels in a fixed amount of time. Posted
  • #7 ✎ 30 AGAaron What you'll want is for the enemy to home in on the player at a certain range, yes? You will need to have either a sight collide box or a presence like collide box on the player. When whichever connects, have it home in on the player. The method for something like that, which does it most well is the "A* path finding algorithm". Something I hope someone else will elaborate on because I currently have no clue how to implement one yet, ha. Trying to understand it myself. Posted
  • #8 ✎ 149 Komodo Pokemon Is Awesome! I love Pokemon! Express Yourself Drawing I like to draw! Hobbies Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength so i need to make a collision box around the character using somthing like sphitsp and every time the enemy hits it he attacks with the sword hmm i think i like that idea(you know three weeks ago i whould have had no idea how to do that but now i do) i think i will also for harder enemys make a projectile like a knife or arrow fly at the charecter if they are on the same x mark or y mark if you know what i mean but first i will give the player a shield so it's not to difficult. I have a plan now thanks guys for your ideas you are a huge help. Posted
  • #9 ✎ 89 Krondelo Yeah, I haven't done it myself but I believe you could use a transparent sprite box around the character, and use that for detection range. Posted
  • #10 ✎ 149 Komodo Pokemon Is Awesome! I love Pokemon! Express Yourself Drawing I like to draw! Hobbies Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength my enemy ai is almost ready to be put in my game! i just have to fix some things. thanks guys for your ideas i realy appreciate it. good luck with your programming. Posted Edited by Komodo
  • #11 ✎ 207 Guzzler First Week Joined in the very first week of SmileBASIC Source Website Drawing I like to draw! Hobbies Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength You could make an enemy that moves randomly until you get within it's range. For example: IF PLAYERX>ENEMYX-50 THEN ENEMYX=ENEMYX+1 This but with all the rest of the directions. Add something like Minxrod's thing for random. Posted
  • #12 ✎ 30 AGAaron Guzzler's idea is better than mine if you want something simple, many older games with which SmileBASIC has based itself all have some pretty simple enemies. The one he is suggesting here would home in on the player. Posted