The Daily Click ::. Forums ::. Klik Coding Help ::. Small problem with TGF game
 

Post Reply  Post Oekaki 
 

Posted By Message

B.E



Registered
  13/05/2008
Points
  7
3rd March, 2009 at 01:03:03 -

Making a simple game together with my little nephew just for fun, but I've encounterd a problem.

The game is mouse-controlled, and you control a guy who has to pick up flying pages from comic-books while in a storm. He has to avoid hard objects also flying around, like lamp-poles. He can pick up apples for points, and each time he gets 100 points he can run five times. He can also pick up pipes and use these to take swings at the flying objects.

Left button - Walk
Right button - Run (if you have run-points)
Middle button - Swipe pipe (if you have one or more)

Now here's the problem I have:
The character should only lose one pipe every time he hits a flying object, but if he hits more then one object at the same time the counter substracts an equal amount of pipes. Example, the character hits two different objects with one swing - he loses two pipes - but I want him to only lose one regardless of how many objects he hits with the same swing.

http://www.megaupload.com/?d=9BCYFRHX

Please try the level I've posted (which of course is far from finished because I got stuck so early on with this) and reply if you know how to fix this.

 
Ralph Wiggum: "Hi Lisa, hi Super Nintendo Chalmers"

AndyUK

Mascot Maniac

Registered
  01/08/2002
Points
  14456

Game of the Week WinnerSecond GOTW AwardHas Donated, Thank You!VIP Member
3rd March, 2009 at 01:28:33 -

well it looks like you can simply tell the game that the player has already been hit once during a swing, then at the end of the swing tell it 'ok the player can be hit again'

you just need to change some value, maybe a flag or an alterable value then

not been hit = set flag off
gets hit and flag is off = subtract 1 pipe and set flag on
end of swing animation = set flag off

 
.

B.E



Registered
  13/05/2008
Points
  7
3rd March, 2009 at 01:42:17 -

Okey, I'm not sure on how I tell the program that something has "not been hit". I know of "Negate" but it doesn't seem to do the trick.. Would you be so kind as to incorperate the solution you have into the level I posted? I'll be very grateful and promise to credit you if I ever release the finished game

 
Ralph Wiggum: "Hi Lisa, hi Super Nintendo Chalmers"

B.E



Registered
  13/05/2008
Points
  7
4th March, 2009 at 17:43:22 -

Anyone else who can take a look at this and fix it for me?

 
Ralph Wiggum: "Hi Lisa, hi Super Nintendo Chalmers"

AndyUK

Mascot Maniac

Registered
  01/08/2002
Points
  14456

Game of the Week WinnerSecond GOTW AwardHas Donated, Thank You!VIP Member
4th March, 2009 at 18:50:50 -

there is no actual function called 'not been hit' it would actually just be

'objectname' not overlapping 'player' = set flag off

I was just writing a weird kind of Pseudo code.

 
.

B.E



Registered
  13/05/2008
Points
  7
4th March, 2009 at 19:42:48 -

Okay, I tried what you said but still can't get the program to only substract 1 pipe regardless of how many objects hit the character. I give up.. Could you make an example file where this works? Or simpler, just use the file I posted. I really want to get this to work but I'm just too green regarding TGF.

 
Ralph Wiggum: "Hi Lisa, hi Super Nintendo Chalmers"
   

Post Reply



 



Advertisement

Worth A Click