The Daily Click ::. Forums ::. Klik Coding Help ::. Spread Value?
 

Post Reply  Post Oekaki 
 

Posted By Message

Windybeard Games



Registered
  14/04/2005
Points
  219

You've Been Circy'd!VIP MemberCandy Cane
9th November, 2007 at 22:08:41 -

I have created a grid based enemy movement. it selects a random number between 0-7 and selects a direction accordingly, then it runs the grid movement code i have written (which isnt the problem, it works fine). I have collision detectors generate at the start of frame around each enemy in the correct places but they dont work.
If i have just one enemy on screen the collision detection works fine. as soon as i put more than one in it forgets all about them and the enemies walk over everything. Im assuming this is due to my use of a qualifier to determine the enemy.
Do i have to do some sort of spread value code for the collision detectors to work? and if so how do i do that cause i have no idea how to use it.
If i could use qualifiers in object behaviors i wouldnt be having this problem but thats just a fevered dream of mad man.


If you dont know what im talking about i will add some code but its quite lengthy and extremly confusing to anyone but me.

Thx

Image Edited by the Author.

 
n/a

viva/volt

Awesome Sauce

Registered
  26/08/2006
Points
  1694

Game of the Week WinnerSilverNova MemberKlikCast StarVIP Member
9th November, 2007 at 22:36:45 -

You need to spread values on all enemies and on each detector, then you say for example:

Detector Collides with Bg
+ ID = ID of enemy

Do stuff

You may need a fastloop to select them properly though...

 
Image
http://bfollington.tumblr.com

Knudde (Shab)

Administrator
Crazy?

Registered
  31/01/2003
Points
  5125

Has Donated, Thank You!Clickzine StaffKlikCast StarVIP MemberGhostbuster!Dos Rules!I donated an open source project
9th November, 2007 at 23:24:55 -

In a project I did long ago, the thing that moved was invisible. While the enemies were in "move state" (Like A = 1 or somethings) they would be placed on top of this object. The detectors were placed using this dummy object (So I only had 4 detectors for any amount of enemies on the field). All the Enemy behavior code was then contained in this one object, which made the process much simplier. I believe that I also coded the player movement in this same object so I could just flag units as enemy/friendly and use that one object to move all the characters, but I could be wrong. But now I'm rambling.

 
Craps, I'm an old man!

viva/volt

Awesome Sauce

Registered
  26/08/2006
Points
  1694

Game of the Week WinnerSilverNova MemberKlikCast StarVIP Member
10th November, 2007 at 04:05:44 -

That's quite clever Shab

 
Image
http://bfollington.tumblr.com

Klikmaster

Master of all things Klik

Registered
  08/07/2002
Points
  2599

Has Donated, Thank You!You've Been Circy'd!VIP MemberPS3 Owner
10th November, 2007 at 04:39:24 -

Haha that's Shab-code alright

 
n/a

Windybeard Games



Registered
  14/04/2005
Points
  219

You've Been Circy'd!VIP MemberCandy Cane
10th November, 2007 at 08:04:40 -

thx for the help guys, ill prob be back on this thread soon as i have never done this before. cant be too hard though.
if its as easy as Benta is saying then i shouldn't have a problem.

 
n/a

Windybeard Games



Registered
  14/04/2005
Points
  219

You've Been Circy'd!VIP MemberCandy Cane
10th November, 2007 at 08:25:00 -

i just did the old spread value and it worked a treat, Mr.Benta you are the hero of my day, i thank thee

 
n/a

Knudde (Shab)

Administrator
Crazy?

Registered
  31/01/2003
Points
  5125

Has Donated, Thank You!Clickzine StaffKlikCast StarVIP MemberGhostbuster!Dos Rules!I donated an open source project
10th November, 2007 at 11:12:39 -

Yeah well, using TGF for 5 years has it's effects, like odd coding practices. The other reason I did was so that I could have 3 more throwaway values; cause 3 values just isn't quite enough for a tactical game (When dealing with attack/defense/etc).

 
Craps, I'm an old man!

Windybeard Games



Registered
  14/04/2005
Points
  219

You've Been Circy'd!VIP MemberCandy Cane
10th November, 2007 at 18:25:53 -

after careful analysis i have found that it doesnt work as well as i thought, all the collision detection now works but the movement has been restricted to only one enemy, the others just turn to face the direction they should move but dont move anywhere,
I think im gonna have to do some object specific codes to remedy my problem.

 
n/a

Knudde (Shab)

Administrator
Crazy?

Registered
  31/01/2003
Points
  5125

Has Donated, Thank You!Clickzine StaffKlikCast StarVIP MemberGhostbuster!Dos Rules!I donated an open source project
10th November, 2007 at 18:28:22 -

Before you go about it like that, check to see if simply running the objects one at a time will fix the problem. Sounds like you AI is trying to run all at once, and that's where it's getting confused.

 
Craps, I'm an old man!

viva/volt

Awesome Sauce

Registered
  26/08/2006
Points
  1694

Game of the Week WinnerSilverNova MemberKlikCast StarVIP Member
10th November, 2007 at 18:46:46 -

Sounds like there may be some fastlooping that needs to be done :\.

Glad I could be of SOME assistance, maybe you could post a mfa (or cca but that means I can't try and help) with just the enemies and their detectors etc? Then everyone can try to help.

 
Image
http://bfollington.tumblr.com

Windybeard Games



Registered
  14/04/2005
Points
  219

You've Been Circy'd!VIP MemberCandy Cane
10th November, 2007 at 19:14:06 -

Yeah im reall stuck now, i have tried everything i can do and its still not working, If i have just one enmy then it works perfectly, so the code is getting confused like shabb said. i will post the mfa in a while, ive gotta pop out but if you could take a look for me i would greatly appreciate it.

what might be earsier is (if its not too much trouble) would be for you to make a quick grid AI for me to see, i know this is cheeky but my code would prolly be unreadable even if i did put it up. i am trying to make it so the code will control all types of enemy with only one movement, (all enemies can move the same in this game, it wont be weird) its a 20x20 grid. If this is possible i will possibly flood my trousers as this is the last peice of code in my game engine, once done its plain sailing.

Oh and lastly, do you know of any good places for me to upload my mfa to?

Thx again.

 
n/a

Peblo

Custom ratings must be 50 characters or less

Registered
  05/07/2002
Points
  185

Game of the Week WinnerVIP MemberI'm on a Boat360 OwnerAttention GetterThe Cake is a LieCardboard BoxHero of TimePS3 OwnerIt's-a me, Mario!
I'm a Storm TrooperSonic SpeedStrawberryI like Aliens!Wii OwnerMushroomGhostbuster!
10th November, 2007 at 19:49:27 -

I can spread your value for free

 
"Isn't it always amazing how we characterize a person's intelligence by how closely their thinking matches ours?"
~Belgarath

Peblo

Custom ratings must be 50 characters or less

Registered
  05/07/2002
Points
  185

Game of the Week WinnerVIP MemberI'm on a Boat360 OwnerAttention GetterThe Cake is a LieCardboard BoxHero of TimePS3 OwnerIt's-a me, Mario!
I'm a Storm TrooperSonic SpeedStrawberryI like Aliens!Wii OwnerMushroomGhostbuster!
10th November, 2007 at 19:53:47 -

From what it sounds like, you're making it harder than it needs to be. Only one set of collision detection objects is necessary. I'll make a mfa if I find mmf again.

 
"Isn't it always amazing how we characterize a person's intelligence by how closely their thinking matches ours?"
~Belgarath

Windybeard Games



Registered
  14/04/2005
Points
  219

You've Been Circy'd!VIP MemberCandy Cane
10th November, 2007 at 20:18:39 -

thank you perblo, i have tried everything.

 
n/a
   

Post Reply



 



Advertisement

Worth A Click