Right, first post etc...
Basically I'm making a bird's eye view robot wars game and I'm trying to get the opponent to attack the player. So far, I've tried 2 AI-ing tutorials - None of them worked. Advice and ideas would be a big help...
Offline
That was just someone spamming.
um, get it so when the AI touches the other one, MR. AI broadcasts something that makes the other one go farther away.
for instance:
if(AI)touching(Other 1) switch to costume "bla" broadcast "move away" (other sprite) when I recieve(move away) point in (direction - direction * 2) move 30 steps
is that what you are looking for?
Offline
SeanProductions wrote:
<when green flag clicked><say[ Hello! ]for( 2)secs>
Please don't spam SeanProductions. We want to keep the Scratch community spam-free and just posting in blocks is spamming.
Offline
here's some code that may work:
[blocks] When Green Flag Clicked: Forever: Point Towards Player, wait playerspeed/2, repeat 10: move enemyspeed steps, if touching player: switch to costume "killed player", broadcast "player died"
PLAYER:
When I receive "player died", switch to costume 'die', point in direction: direction of enemy * 180: repeat 6: move 5 steps [/blocks]
Last edited by hidas (2010-01-31 08:20:27)
Offline
Slower turning is quite complicated, it takes two sprites or so to make, there is a "missile" project somewhere that followed the mouse and turns slowly like what you want.
Ahh found it: http://scratch.mit.edu/projects/bhz/394380
Hope that helps!
Offline
Magnie wrote:
Slower turning is quite complicated, it takes two sprites or so to make, there is a "missile" project somewhere that followed the mouse and turns slowly like what you want.
Ahh found it: http://scratch.mit.edu/projects/bhz/394380
Hope that helps!![]()
Actually - if you're good enough you can do it with the mouse X and Y and Trig.
Offline
Offline
yeah, you can do it with trig, but we're not all math whizs yet.
Offline
Some_Guy wrote:
How would I make it so then I can get round the side of the AI (aka make the Ai a bit slower at turning)
Create a "Line of sight" that is, a line that stretches out of the enemy
4 eva
go 2 (enemy)
Point in direction if Enemy
__________________________
Set the rotation point to the far left corner of the line
If NOT Touching (Player)
Brodcast "turn"
Have two dishes, sort of like the LOS bar, exept they are on the sides of the robot, and circle it, like 2 halves.
Use this scripting 4 the one on the right
When I recieve "Turn"
If touching (Player)
Brodcast "Turn Right" (Which unbelievably, you will connect 2 a brodcast block on the robot, which makes him turn right. OMG! who woulda guessed!)
Do the same 4 the one on the left, except with a "Turn Left command"
If u don't get it, tell me and I will create a tutorial 4 it.
Offline
trekkie2000 wrote:
Some_Guy wrote:
How would I make it so then I can get round the side of the AI (aka make the Ai a bit slower at turning)
Create a "Line of sight" that is, a line that stretches out of the enemy
4 eva
go 2 (enemy)
Point in direction if Enemy
__________________________
Set the rotation point to the far left corner of the line
If NOT Touching (Player)
Brodcast "turn"
Have two dishes, sort of like the LOS bar, exept they are on the sides of the robot, and circle it, like 2 halves.
Use this scripting 4 the one on the right
When I recieve "Turn"
If touching (Player)
Brodcast "Turn Right" (Which unbelievably, you will connect 2 a brodcast block on the robot, which makes him turn right. OMG! who woulda guessed!)
Do the same 4 the one on the left, except with a "Turn Left command"
If u don't get it, tell me and I will create a tutorial 4 it.
Maybe make it a script and save the picture of the script to show what you mean?
Offline