ZFGC

Resources => Coding => Topic started by: Mr. Star Fox on August 01, 2009, 09:23:53 pm

Title: ENGINE for getting hurt
Post by: Mr. Star Fox on August 01, 2009, 09:23:53 pm
 :huh: So I am working on a Zelda project called LoZ:Shadowed Prince and i need a code or an engine so if the player runs into an enemy he gets knocked back some without missing a collision and please make it GBC style and make hime motion back instead of jumping to a postion
Title: Re: ENGINE for getting hurt
Post by: Mr. Star Fox on August 01, 2009, 10:10:43 pm
Ok I really need I to proceed my game making just link getting knocked back when he touches an enemy please   :'(
(http://www.zfgc.com/forum/Themes/midnight/images/warnwarn.gif) Do not double post give it a day at least, but double posting for the simple reason to bump your topic is not acceptable so soon.   
Title: Re: ENGINE for getting hurt
Post by: MG-Zero on August 02, 2009, 03:26:52 pm
I guess what you could do is set a variable to true when he collides with an enemy.  On the step event, if this variable is true, then disable player control and move the player backwards on the appropriate axis.  Use a counter to keep track of how many steps this will take, and on the last step needed, set the variable back to false.
Title: Re: ENGINE for getting hurt
Post by: Mr. Star Fox on August 02, 2009, 08:39:39 pm
I guess what you could do is set a variable to true when he collides with an enemy.  On the step event, if this variable is true, then disable player control and move the player backwards on the appropriate axis.  Use a counter to keep track of how many steps this will take, and on the last step needed, set the variable back to false.

The new varible idea is not all that great I need like just one, I used this one witch is great but he misses collision with solids and walls

Used in the collide with objLink event: with (other){
{motion_set(point_direction(x,y,other.x,other.y)-180,4)}}
Title: Re: ENGINE for getting hurt
Post by: kremling on October 27, 2009, 03:43:35 am
Code: [Select]
//This could work maybe...
//This should go in the collision event

if place_meeting( x+1, y, obj_enemy)
   {     x-=(Semi-Big Number)   }
if place_meeting( x-1, y, obj_enemy)
   {     x+=(Semi-Big Number)   }
if place_meeting( x, y+1, obj_enemy)
   {     y-=(Semi-Big Number)   }
if place_meeting( x, y-1, obj_enemy)
   {     y+=(Semi-Big Number)   }


Code: [Select]

//Might have got the (signs messed up a bit, but this might work)
//This should go in the collision event

if self.x > other.x+16
{ x-=(Big Number)
if self.x < other.x-16
{ x+=(Big Number)
if self.y > other.y+16
{ y-=(Big Number)
if self.x > other.y-16
{ y+=(Big Number)



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