Aim AI: predictive aiming

Post your own tutorials, guides and demos.

Post » Sat Aug 02, 2008 11:55 pm

[quote="Attan":3bv7tjdg]Ok it still don't work, but have a look at this .cap, try to understand my thinking, and tell me if it's stupid.[/quote:3bv7tjdg]
Very easy to dodge.
B
4
S
2
G
4
Posts: 164
Reputation: 2,178

Post » Sun Aug 03, 2008 12:25 am

It's not supposed to work like it does. It's supposed to work like the perfect one. I realized that the code is very ugly, and i even use some objects that don't need to be there and so on. I'll post a new one that is commented and nicer. It still doesn't work like it should, but maybe someone can help me find the problem. Remember, this is just an IDEA! It doesn't work at all as it should.
B
8
S
2
G
5
Posts: 744
Reputation: 3,288

Post » Mon Aug 04, 2008 12:36 pm

@Attan: You need to place the "Aim" in front of the player, not spawn it at their current XY.

I did something similar once where I set it out in front of the player (distance) based on the speed the player was moving.

So if the player moves right at a speed of 200, we can set the Aim about 100 Pixels to the right, from the XY of the player. The enemy will then be shooting ahead of the player, similar to what Ashley has with all the fancy math ;)

This method is fine for 8Dir and under, but 360 degress, I don't know.
B
2
S
2
G
5
Posts: 391
Reputation: 2,432

Post » Sat Aug 09, 2008 12:50 am

Here's an updated example. The last layout uses 0.96.4's LinearAim expression, saving you all the math.
Scirra Founder
B
359
S
214
G
72
Posts: 22,949
Reputation: 178,544

Post » Sat Aug 09, 2008 1:53 am

That's quite useful! :D
B
134
S
65
G
16
Posts: 1,765
Reputation: 19,188

Post » Mon Aug 11, 2008 6:35 pm

Wow, this sounds pretty nice...

This would be great in making different difficulty settings rather than the far too often seen "let's just increase enemy hit points and add more of them"

Reminds me of a Futurama quote during one of the What If... episodes... The Space Invaders scene where he said "Shoot where they are going to be, not where they are..."
B
4
S
1
G
5
Posts: 65
Reputation: 1,932

Post » Mon Aug 11, 2008 6:41 pm

Haha, love Futurama :) Yes that's a good idea - you can use the dumb aim for easy mode, and linear aim for hard mode to make the enemies more intelligent. I'm all in favour of ways to make games harder via gameplay rather than spamming you with more enemies.
Scirra Founder
B
359
S
214
G
72
Posts: 22,949
Reputation: 178,544

Post » Wed Aug 20, 2008 6:12 pm

I for one actually understood the maths although it took awhile
B
2
G
4
Posts: 50
Reputation: 1,150

Post » Sat Oct 08, 2011 10:46 pm

Hm, well, any chance to get a look at that cap again?
B
3
G
2
Posts: 35
Reputation: 770

Post » Sat Oct 08, 2011 11:02 pm

@Dunkelseele

This thread is over 3 years old!

Look HERE for the original thread and caps, although whether they will still function with the much newer version of Construct Classic is anyone's guess.
If your vision so exceeds your ability, then look to something closer.
Moderator
B
120
S
28
G
68
Posts: 4,843
Reputation: 48,287

PreviousNext

Return to Your tutorials & example files

Who is online

Users browsing this forum: No registered users and 1 guest