Results 1 to 15 of 27
Thread: help with tis problem
-
October 12th, 2004, 09:53 PM #162Registered User
postshelp with tis problem
hi,i am doing a maze game. i am trying to make and enemy which will move randomly and when it touches/hits my hero it will go to another keyframe which says game over. i have tried a few times but my enemy could only move forward, can anyone help me with it??
thx. i got the fla file attached.
<!-- / message --><!-- attachments -->
-
October 12th, 2004, 11:01 PM #262Registered User
postsanyone can help
Originally Posted by keller
-
October 13th, 2004, 02:57 AM #362Registered User
postsReally need ur help
Originally Posted by keller
-
October 13th, 2004, 03:42 AM #4
when i tried ur fla i couldn't get the enemy to move at all, also u seem to be using a tile based engine with art based buildings (did u get these ideas from tonypa or similar). the problem with ur enemy is that he can't tell if he's going to hit something.
With art based there's not really anyway to do this easily, this is because u can't check in advanced if something is going to hitTest == true with something until it happens.
The way to do this is to have four surrounding invisible squares around ur mc, have them called top, left, right and down. Then u have to go
if(_root.ball.top.hitTest(wall._x, wall._y, true){//<-- sorry i can't remember how to do hitTest, because i don't use them
//need to make new direction
number = Math.ceiling(Math.random()*3);
if(number == 1){
//heads down
_root.ball._y += 5;
}
if(number == 2){
_root.ball._x -= 5;
}
if(number == 3){
_root.ball._x += 5;
}
}
do u get what i mean, and u'd have to do something like this for all four sides, it'll get kindof messy.
What i'd recommend is going back to tonypa's tutes and just use the tile-based method, that he's already made and just 'borrow' his.
BTW please put a better title for threads i had know idea what this was about, like 'help with AI for maze' or similar.
And also many ppl don't have MX2004 so either save it in MX format or submit ur problem code and u (should) get quicker responses
-
October 13th, 2004, 09:10 PM #562Registered User
postsOk,thank a lot.i try to use the tile-based method to do.if still can't,i will ask u ok?thanks..
Originally Posted by Dr Warm
-
October 13th, 2004, 09:26 PM #662Registered User
postsAnyone got another method to solve my problem....must tell me ok.
Originally Posted by keller
-
October 13th, 2004, 10:18 PM #762Registered User
postsSorry,i still can't understand the tile-based method,coz if i use tat method i wan change a lot of thing.Do u and ur have another method?
Originally Posted by keller
-
October 14th, 2004, 02:57 AM #8
yeah for the tile based method u will have to change a few of ur things, but once u've changed them, if u want to change other things, it's easier just change a 0 to a 1 in an array etc. that's why i prefer this method
i think if u want to make AI with art based u'll have to devise your own method, because i can't think of any source that i have that will help you. But to start off with u'll need to do what i said before, with the four invisible boxes around the enemy for the hitTests.
-
October 14th, 2004, 08:26 PM #962Registered User
postsok thanks.i ll try my best.but if u or ur got another idea must tell me ok.thank a lot.
Originally Posted by Dr Warm
-
October 15th, 2004, 02:33 AM #10
i looked again at ur fla, but i don't really understand how it works, maybe there's a new function that i've not looked at thats in MX2004, but i don't understand it
.
in ur _root.onEnterFrame function for the character, when u have:
if(Key.onDown(Key.RIGHT)){
CheckXY(something);
}
i can't seem to work out how the checkXY works! could u explain it to me, cos u could probably use this function for the enemy as well
-
October 19th, 2004, 03:56 AM #1162Registered User
postsem...1st i write a function call function CheckXY(x,y){},u can see in my fla file.After that,i write _root.onEnterFrame function,So we no need write
Originally Posted by Dr Warm
if(Key.onDown(Key.RIGHT)){
CheckXY(something);
}
in MC of red.
So if(Key.onDown(Key.RIGHT)){CheckXY(1,0)},the 1 is x-axis,and is positive value,so the object will go right when i press the right arrow key.Can u understand?And When CheckXY(0,1),that mean y-axis is positive.
-
October 19th, 2004, 04:00 AM #12
no i get that bit, i just don't get how it see's what's to the left and right up and down, does it have something to do with u creating the tiles at the start, or is that only for the letters?
-
October 19th, 2004, 09:10 PM #1362Registered User
postsleft,right,up and down is for control my hero...So all i explain to u is only for my hero not the letter,Can get it?The purpose i write the function and the _root EnterFrame function is want use the arrow key to control my hero,so it will move around the maze when i press the up,dwon,left and rigth arrow key.Can get it?
Originally Posted by Dr Warm
-
October 20th, 2004, 02:38 AM #14
No that's not what i mean, i'll take another look at ur fla and see for myself (it's been about a week or two can't quite remember)
-
October 20th, 2004, 08:47 PM #1562Registered User
postsok....but my game will pass to my lecturer after 2week.em....u knw how to use xml?Coz i never learn tis before.
Originally Posted by Dr Warm

Reply With Quote

Bookmarks