The Daily Click ::. Forums ::. Klik Coding Help ::. How to grab (tgf)
 

Post Reply  Post Oekaki 
 

Posted By Message

tetsuya_shino



Registered
  12/08/2004
Points
  491
19th June, 2010 at 10:00:35 -

Okay, I know this is a really basic question.. but here goes. I drew up an animation of my hero grabing a person from behind (-almost metal gear solid style). I'm going to have it if you press a button and you are overlapping the an enemy, that enemy object's logic is stopped and made invisible. Then the hero's object will switch to an animation where he is grabbing that enemy. If he presses the grab button, but he isn't overlapping an enemy, he plays a 'grab miss' animation. Easy stuff, right?

The problem is how do I make it so when he tries to grab and he is overlapping two or more enemies, he only grabs one of them? I seem to remember the answer having something to do with 'pick object at random'... Also, the enemies aren't clones, they all have different file names. Thanks.

 
n/a

nim



Registered
  17/05/2002
Points
  7233
19th June, 2010 at 12:07:55 -

If the enemies are completely different active objects, you could make the coding easier by adding them to a group (I forget how to do this in TGF but it'll be in the object properties on the level editor), then using the event below:

Event 1
Conditions | Actions
["Player" is overlapping "Group.Enemy"] | [(Play grabbing animation)]
[AND Pick one of "Group.Enemy"] |


Edited by nim

 
//

tetsuya_shino



Registered
  12/08/2004
Points
  491
19th June, 2010 at 12:49:22 -

Ah! Ima wakatte masu. domo domo

 
n/a

nim



Registered
  17/05/2002
Points
  7233
19th June, 2010 at 14:00:09 -



Watching the game now?

 
//

tetsuya_shino



Registered
  12/08/2004
Points
  491
20th June, 2010 at 00:17:20 -

If you mean a sports game, nah. I think I must be the only guy that's not into sports. >_>

In fact, I've been watching more 'Inai Inai Ba!' with my daughter then anything else. lol

 
n/a

nim



Registered
  17/05/2002
Points
  7233
20th June, 2010 at 04:32:58 -

Yeah I meant the soccer/football game. I'm not into it much myself but I had the TV on in the background while doing other stuff. Haha, I know Inai Inai Ba! Sounds fun

 
//
   

Post Reply



 



Advertisement

Worth A Click