📧 Message Board Archive

Possible?
Is it possible to...



1 : ...check from which direction a sprite is hit (for example by a bow), and then let it move. So if the sprite is hit from the right side, it should move to the right but if it's hit from above, it should move down (you get the idea).



2 : ...(easily) let a sprite (let's name it A), if it's touched by sprite B, change in sprite C.



Simeon
Re: Possible?
: Is it possible to...

: 1 : ...check from which direction a sprite is hit (for example by a bow), and then let it move. So if the sprite is hit from the right side, it should move to the right but if it's hit from above, it should move down (you get the idea).

: 2 : ...(easily) let a sprite (let's name it A), if it's touched by sprite B, change in sprite C.

: Simeon



1) Yeah, pretty simple.  Rather than using Dink's direction (as Sharp suggested), use the arrow's.  So if the arrow is frame one, you know it was hit from the lower-left, and just add 20 or so to sp_x and subtract 20 from sp_y in the hit sprite (so it moves to the upper-right a tad).



2) Uh... probably, but could you explain your idea more?  I'm not quite sure what you're trying to do.
Re: Possible?
Is it possible to...

2 : ...(easily) let a sprite (let's name it A), if it's touched by sprite B, change in sprite C.



2) Uh... probably, but could you explain your idea more? I'm not quite sure what you're trying to do.



Well, let's say you have a watergraphic(A) and a rockgraphic(B) (or something else you can push in water). Then you push B to A, then the water changes into C, a graphic where you see the rockgraphic (or something else you pushed in the water) in the water. The script should be attached to the watergraphic.



So it should be something in the script : when I'm touched by B, I'll change in C and B goes away. Sounds dull huh, but that's the idea. ;)



Simeon
Re: Possible?
: Is it possible to...

: 2 : ...(easily) let a sprite (let's name it A), if it's touched by sprite B, change in sprite C.

: 2) Uh... probably, but could you explain your idea more? I'm not quite sure what you're trying to do.

: Well, let's say you have a watergraphic(A) and a rockgraphic(B) (or something else you can push in water). Then you push B to A, then the water changes into C, a graphic where you see the rockgraphic (or something else you pushed in the water) in the water. The script should be attached to the watergraphic.

: So it should be something in the script : when I'm touched by B, I'll change in C and B goes away. Sounds dull huh, but that's the idea. ;)

: Simeon



Why not just have the variable if A touches B kill A and create C?  Seems like the most simple way...

Re: Possible?
: : Is it possible to...

: : 2 : ...(easily) let a sprite (let's name it A), if it's touched by sprite B, change in sprite C.

: : 2) Uh... probably, but could you explain your idea more? I'm not quite sure what you're trying to do.

: : Well, let's say you have a watergraphic(A) and a rockgraphic(B) (or something else you can push in water). Then you push B to A, then the water changes into C, a graphic where you see the rockgraphic (or something else you pushed in the water) in the water. The script should be attached to the watergraphic.

: : So it should be something in the script : when I'm touched by B, I'll change in C and B goes away. Sounds dull huh, but that's the idea. ;)

: : Simeon

: Why not just have the variable if A touches B kill A and create C? Seems like the most simple way...



I think the problem lies in how to tell if one sprite touches another.  There are a couple ways.  One you can check the distance between A and B (using sp_x and sp_y), or you could do something like how you blow up rocks in Dink.  Make a script called dam-rock.c and base it on dam-bomn.c.
Re: Possible?
: : : Is it possible to...

: : : 2 : ...(easily) let a sprite (let's name it A), if it's touched by sprite B, change in sprite C.

: : : 2) Uh... probably, but could you explain your idea more? I'm not quite sure what you're trying to do.

: : : Well, let's say you have a watergraphic(A) and a rockgraphic(B) (or something else you can push in water). Then you push B to A, then the water changes into C, a graphic where you see the rockgraphic (or something else you pushed in the water) in the water. The script should be attached to the watergraphic.

: : : So it should be something in the script : when I'm touched by B, I'll change in C and B goes away. Sounds dull huh, but that's the idea. ;)

: : : Simeon

: : Why not just have the variable if A touches B kill A and create C? Seems like the most simple way...

: I think the problem lies in how to tell if one sprite touches another. There are a couple ways. One you can check the distance between A and B (using sp_x and sp_y), or you could do something like how you blow up rocks in Dink. Make a script called dam-rock.c and base it on dam-bomn.c.



If this rock is only moved ,then why not just check if is within a certin co-ordinate?

eg:

//done/spawned after rock has been moved

if x => 300

{

if x =< 330

 {

  if y => 200

  {

   if y =< 220

   {

    do whatever

   }

  }

 }

}
Re: Possible?
: : : : Is it possible to...

: : : : 2 : ...(easily) let a sprite (let's name it A), if it's touched by sprite B, change in sprite C.

: : : : 2) Uh... probably, but could you explain your idea more? I'm not quite sure what you're trying to do.

: : : : Well, let's say you have a watergraphic(A) and a rockgraphic(B) (or something else you can push in water). Then you push B to A, then the water changes into C, a graphic where you see the rockgraphic (or something else you pushed in the water) in the water. The script should be attached to the watergraphic.

: : : : So it should be something in the script : when I'm touched by B, I'll change in C and B goes away. Sounds dull huh, but that's the idea. ;)

: : : : Simeon

: : : Why not just have the variable if A touches B kill A and create C? Seems like the most simple way...

: : I think the problem lies in how to tell if one sprite touches another. There are a couple ways. One you can check the distance between A and B (using sp_x and sp_y), or you could do something like how you blow up rocks in Dink. Make a script called dam-rock.c and base it on dam-bomn.c.

: If this rock is only moved ,then why not just check if is within a certin co-ordinate?

: eg:

: //done/spawned after rock has been moved

: if x => 300

:  {

:  if x =< 330//this will never be read...

:  {

:   if y => 200//...

:   {

:   if y =< 220//...

:   {

:   do whatever

:   }

:   }

:  }

:  }

Yeah, something like that would work, but not the way Chrispy has it set up :)  

Re: Possible?
: : : : : Is it possible to...

: : : : : 2 : ...(easily) let a sprite (let's name it A), if it's touched by sprite B, change in sprite C.

: : : : : 2) Uh... probably, but could you explain your idea more? I'm not quite sure what you're trying to do.

: : : : : Well, let's say you have a watergraphic(A) and a rockgraphic(B) (or something else you can push in water). Then you push B to A, then the water changes into C, a graphic where you see the rockgraphic (or something else you pushed in the water) in the water. The script should be attached to the watergraphic.

: : : : : So it should be something in the script : when I'm touched by B, I'll change in C and B goes away. Sounds dull huh, but that's the idea. ;)

: : : : : Simeon

: : : : Why not just have the variable if A touches B kill A and create C? Seems like the most simple way...

: : : I think the problem lies in how to tell if one sprite touches another. There are a couple ways. One you can check the distance between A and B (using sp_x and sp_y), or you could do something like how you blow up rocks in Dink. Make a script called dam-rock.c and base it on dam-bomn.c.

: : If this rock is only moved ,then why not just check if is within a certin co-ordinate?

: : eg:

: : //done/spawned after rock has been moved

: : if x => 300

: : {

: : if x =< 330//this will never be read...

: : {

: : if y => 200//...

: : {

: : if y =< 220//...

: : {

: : do whatever

: : }

: : }

: : }

: : }

: Yeah, something like that would work, but not the way Chrispy has it set up :)



That came out a bit.. messed. heh

Re: Possible?
Thanks everyone.



Simeon
Re: Possible?
: Is it possible to...

: 1 : ...check from which direction a sprite is hit (for example by a bow), and then let it move. So if the sprite is hit from the right side, it should move to the right but if it's hit from above, it should move down (you get the idea).



At least if you make dink check his direction after shooting the sprite.. and then assuming that if dink's direction was down, the sprite was hit from above.

Not sure if it'd work that simple though. :)