Hello Guest, please login or register.
Did you miss your activation email?
Login with username, password and session length.

Pages: [1]   Go Down

Author Topic: Rebound / Immunity after taking Damage.  (Read 1265 times)

0 Members and 1 Guest are viewing this topic.

Dark-Hylian

Silence
Rebound / Immunity after taking Damage.
« on: January 23, 2010, 08:36:31 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 370
If objLink runs into objEnemy, objLink gets hurt, bounces back, and cannot be hurt again for a set amount of time.
How to go about doing this? The bounce back needs to be set by Direction, 90, 180, 270 or 360/0. Also, (I am not very "experianced" with GM8's timer/timeline system) how would you set it so that
when you collide with objEnemy,
Hurt=true, therefore starting a timer, during which objLink cannot be "hurt"
then when the timer's up, turn Hurt to false?

I tried using a timeline, but it didn't do anything. Link would take 1/4 heart in damage, and become invincible.

Any suggestions?
Logged
  • Dawning Hour
Re: Rebound / Immunity after taking Damage.
« Reply #1 on: January 23, 2010, 08:54:15 pm »
  • *
  • Reputation: +9/-0
  • Offline Offline
  • Gender: Male
  • Posts: 3725
I would use a numerical variable 'Invincible' and give it the value of the number of frames Link can't be hurt.

In the step event

Code: [Select]
if(invincible) invincible -= 1;

When invincible is 0, then it also evaluates as false. 1 and higher evaluates as true.
« Last Edit: January 23, 2010, 09:01:55 pm by Niek »
Logged
Re: Rebound / Immunity after taking Damage.
« Reply #2 on: January 23, 2010, 11:52:54 pm »
  • *
  • Reputation: +1/-0
  • Offline Offline
  • Gender: Male
  • Posts: 446
If you need to find the direction that Link should be bouncing in, use

point_direction(x1,y1,x2,y2)

where x1,y1 is the x and y of the enemy and x2,y2 is the x and y of Link. This will give you the direction from the enemy to Link, in degrees, which is also the direction Link should be bouncing in.

Hope this helps.
Logged
Pages: [1]   Go Up

 


Contact Us | Legal | Advertise Here
2013 © ZFGC, All Rights Reserved



Page created in 0.468 seconds with 41 queries.