The Daily Click ::. Forums ::. Klik Coding Help ::. Can someone PLEASE explain how to test multiple instances of the same object on a case by case approach
 

Post Reply  Post Oekaki 
 

Posted By Message

SevenT2 - [GameStormers]



Registered
  24/07/2002
Points
  882

Wii OwnerVIP Member
18th February, 2010 at 13:34:09 -

This is literally the one thing holding back all of my projects, i can do it in C++ and C# but cannot for the life of me work it out in MMF2!

I want to have say. 30 enemies, walking around, stopping randomly. That bit's easy. Then i want to compare their position relative to the main character, if its close, attack, else, keep walking.

When i do the correct code for this and have one enemy, it works perfectly, when i have more than one enemy they are just attacking all the time.

So frustrating. Can someone clue me in to managing instances of the same object separately?


Thanks so much in advance!

 
--------------------------
Current Projects:
+
+ S#32
+ Ricky Runfast!
+ The GameStormers (YouTube Channel)
+ Final Fart! (Board Game)


The GameStormers:
[ http://www.thegamestormers.com ]

OMC

What a goofball

Registered
  21/05/2007
Points
  3516

KlikCast Musician! Guy with a HatSomewhat CrazyARGH SignLikes TDCHas Donated, Thank You!Retired Admin
18th February, 2010 at 13:40:22 -

What's the perspective on this game? Is it side-scrolling or overhead? If it's sidescrolling, a simple comparison of the object's X position (Greater than Player's X - 100 but less than Player's X + 100) should put the specific enemy as the focus object.

Overhead means distance formula, so not quite as simple.

 

  		
  		

SevenT2 - [GameStormers]



Registered
  24/07/2002
Points
  882

Wii OwnerVIP Member
18th February, 2010 at 13:42:14 -

*bows* Thank you, ruler of cows.

I'm currently only comparing the Y value in that manner, i should PROBABLY add the X value to my equation. Its a sidescroller yes, i'll try and let you know

 
--------------------------
Current Projects:
+
+ S#32
+ Ricky Runfast!
+ The GameStormers (YouTube Channel)
+ Final Fart! (Board Game)


The GameStormers:
[ http://www.thegamestormers.com ]

SevenT2 - [GameStormers]



Registered
  24/07/2002
Points
  882

Wii OwnerVIP Member
18th February, 2010 at 14:01:28 -

See, that works.. But only one ONE of the many characters???? :S

 
--------------------------
Current Projects:
+
+ S#32
+ Ricky Runfast!
+ The GameStormers (YouTube Channel)
+ Final Fart! (Board Game)


The GameStormers:
[ http://www.thegamestormers.com ]

Sketchy

Cornwall UK

Registered
  06/11/2004
Points
  1970

VIP MemberWeekly Picture Me This Round 43 Winner!Weekly Picture Me This Round 47 WinnerPicture Me This Round 49 Winner!
18th February, 2010 at 14:14:00 -

You have to use alterable values.

+ Always
-> Enemy: set "Distance" to Abs(X("Enemy") - X("Player"))

+ "Distance" of "Enemy" < AttackRange("Enemy")
-> Enemy: change animation to Attack
-> Enemy: shoot bullet...

Note: "Distance" and "AttackRange" are just two renamed alterable values.
You should read this article: http://www.create-games.com/article.asp?id=1975
And also the others listed at the bottom under "Further Reading".

 
n/a

SevenT2 - [GameStormers]



Registered
  24/07/2002
Points
  882

Wii OwnerVIP Member
18th February, 2010 at 14:20:36 -

Ah, this article looks very informative! Cheers, i'll give it a through read-through

 
--------------------------
Current Projects:
+
+ S#32
+ Ricky Runfast!
+ The GameStormers (YouTube Channel)
+ Final Fart! (Board Game)


The GameStormers:
[ http://www.thegamestormers.com ]
   

Post Reply



 



Advertisement

Worth A Click