A question about some code blocks

homeofdeath212

  • Posts: 101
So how does these blocks exactly work.

The "Point of Collision" Code Block:

I got this to "work" but it seems like it only updates once every few seconds? Or am I using this wrong? If this is really how it works, is there a way to replicate this code block because I really want for the "hit effects" of my game to show in the accurate position and I thought this block would do the job nicely.

The "Part of Image" Code Block:

I got this to work but I still don't fully understand it. What's the X and Y for?
Currently Working On: Galaxiconia (A space shooter/defence game)
https://www.newgrounds.com/dump/item/2af922bd9a873856b9b2274737f80bc5

CmdrWhitey13

  • Posts: 486
The Part of Image block uses x(start) and y(start) with a width and height specified.
So, if you have a 64x64 image and only want the bottom right 32x32 square, you coud say:
part of image at x:32 y:32 w:32 h:32.

http://www.stencyl.com/help/view/collisions-and-groups/

Link above can be used with collisions based on actors.

Hope it helps

homeofdeath212

  • Posts: 101
The Part of Image block uses x(start) and y(start) with a width and height specified.
So, if you have a 64x64 image and only want the bottom right 32x32 square, you coud say:
part of image at x:32 y:32 w:32 h:32.
Oh so that's how it works. I get it. Thanks for the info.

Regarding the "Point Of Collision" code block:
The article you linked doesn't help much as it doesn't explain much about the block itself.
My problem with it that it works but doesn't update instantly, it seems like it only updates once every few seconds. Maybe it's how I set it up
Currently Working On: Galaxiconia (A space shooter/defence game)
https://www.newgrounds.com/dump/item/2af922bd9a873856b9b2274737f80bc5

homeofdeath212

  • Posts: 101
I'm trying to make a "hit effect" that whenever a player bullet hits an enemy and I want the pin-point location of the collision is where the effect would show up. This is the code I've used so far. Am I doing something wrong with this?

Also don't pay too much attention to the print block. I had to use that to debug why are the effects showing up always in the wrong place.

« Last Edit: October 23, 2018, 04:39:09 pm by homeofdeath212 »
Currently Working On: Galaxiconia (A space shooter/defence game)
https://www.newgrounds.com/dump/item/2af922bd9a873856b9b2274737f80bc5

homeofdeath212

  • Posts: 101
Currently Working On: Galaxiconia (A space shooter/defence game)
https://www.newgrounds.com/dump/item/2af922bd9a873856b9b2274737f80bc5

Bombini

  • *
  • Posts: 1134
Hi,
lets see if understood you:
Quote
I'm trying to make a "hit effect" that whenever a player bullet hits an enemy
That is very easy. Just add an effect (for example sepia) on collision and remove this effect after for example o.3 seconds.
Quote
I want the pin-point location of the collision is where the effect would show up
Are you talking about having the effect only on an area of the actor? What would this effect be? Another actor? Like in the attached image the blue effect?

homeofdeath212

  • Posts: 101
Yes exactly like that.
I'm not sure how to do that if I can't accurately get the point of collision.
Currently Working On: Galaxiconia (A space shooter/defence game)
https://www.newgrounds.com/dump/item/2af922bd9a873856b9b2274737f80bc5

Bombini

  • *
  • Posts: 1134
Well, this depends how your game is setup.

You can simply spawn the "hit-actor" (animation of the hit effect you wantand for example blood particles) if you shoot for example with the mouse on the actor (checking if the click is on the actor or not).

I assume you are talking about a projectile which fires without mouse-aiming?
In this case you can also just kill the projectile on impact and spawn a hit-actor (blast, blood , whatever) on collision as well. You can change the animation of the character when hit additionally. You can check if the character was hit in the lower area through checking the y of the projectile and add an animation for the character which just shows an impact on the legs and so on (if projectile bigger then ... animate legs otherwise upper body).

But this is what you kind of have. So maybe i just dont understand it yet. My impression is that you can keep it simpler.
But let me know.