This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2008-07-07 10:47:20

Freestylin_Monkey
Scratcher
Registered: 2008-03-24
Posts: 100+

i have a qestion about Al?

I want to make a game based on the samarai warriors, and i am using al for enemies and allies, i think i already have the scripts for enemies and allies but the al movement is the struggle, I want them to move on their own and show there place on a small map, how do i do it?


I am Lord of Lords, I am King of Kings, I AM MASTERS OF ALL MASTERS!!!
-But I am a servant of my mother

Offline

 

#2 2008-07-07 11:21:51

Bluestribute
Scratcher
Registered: 2008-01-24
Posts: 1000+

Re: i have a qestion about Al?

Hmm… I know you can have it so if they are a certain distance away you can see them, as for the map… make the markers move like the AI's. I'm no expert at doing that kinda stuff though


http://img247.imageshack.us/img247/1204/bluestributett4.jpg
That's my PSN ID. I know tons of COD4 glitches. Add me as your friend. Oh, and get a headset

Offline

 

#3 2008-07-07 11:28:56

registeel
Scratcher
Registered: 2008-04-27
Posts: 500+

Re: i have a qestion about Al?

a bit like zombiepox?

Offline

 

#4 2008-07-07 12:05:14

newareagle
Scratcher
Registered: 2008-06-10
Posts: 100+

Re: i have a qestion about Al?

Ok, start off with your samurai on the board, then have a little dot or something on the map. Lets say they both start on the center of the map, and center of screen. If the map is in the lower right corner of the screen, and is 50 pixels long, while the screen is... lets say 250, you need to make the little red dot move 1/5th the speed as the samurai in X. Find the same ratio for y, and then start your little dot in the senter of the map. Ill try writing it out and seeing how it works. Example:
Samurai:
When Clicked:
Go to 0,0
Forever:
Set SamuraiX to Xposition/5
Set SamuraiY to Yposition/4
Repeat 10
Change X by 10
Repeat 10
Change Y by 10

Now for the map indicator.
When clicked
forever
set x to SamuraiX+150
sey y to SamuraiY-100

(All of these number were just examples, use certain numbers for where your map is, and where your samurai is.


My Guitar Hero Game.
8/9 Projects on the Front Page at Once!

Offline

 

#5 2008-07-07 13:17:22

bigB
Scratcher
Registered: 2007-06-09
Posts: 100+

Re: i have a qestion about Al?

An AI for a fighting opponent will be interesting but difficult.  If you made it permanently attacking but it only does damage when it touches you that would keep things simpler.
goodluck


http://scratch.mit.edu/projects/bigB/260981 Draw to Text
http://scratch.mit.edu/projects/bigB/181829 3D Stunt Flyer

Offline

 

#6 2008-07-10 13:36:33

Freestylin_Monkey
Scratcher
Registered: 2008-03-24
Posts: 100+

Re: i have a qestion about Al?

newareagle wrote:

Ok, start off with your samurai on the board, then have a little dot or something on the map. Lets say they both start on the center of the map, and center of screen. If the map is in the lower right corner of the screen, and is 50 pixels long, while the screen is... lets say 250, you need to make the little red dot move 1/5th the speed as the samurai in X. Find the same ratio for y, and then start your little dot in the senter of the map. Ill try writing it out and seeing how it works. Example:
Samurai:
When Clicked:
Go to 0,0
Forever:
Set SamuraiX to Xposition/5
Set SamuraiY to Yposition/4
Repeat 10
Change X by 10
Repeat 10
Change Y by 10

Now for the map indicator.
When clicked
forever
set x to SamuraiX+150
sey y to SamuraiY-100

(All of these number were just examples, use certain numbers for where your map is, and where your samurai is.

I see how this would work if you use the arrow keys, but how will this work when the character is following the mouse cursor? (like wandering knight) how can the dot move exactly like the character yey not follow the cursor

http://scratch.mit.edu/projects/Freestylin_Monkey/204983

Last edited by Freestylin_Monkey (2008-07-10 13:38:31)


I am Lord of Lords, I am King of Kings, I AM MASTERS OF ALL MASTERS!!!
-But I am a servant of my mother

Offline

 

Board footer