The Daily Click ::. Forums ::. Klik Coding Help ::. Top view shooter How to make a bouncing granade
 

Post Reply  Post Oekaki 
 

Posted By Message

Willy C



Registered
  14/02/2004
Points
  1524

Game of the Week WinnerKlikCast StarPicture Me This -Round8- Winner!VIP MemberWii OwnerIt's-a me, Mario!Hero of TimeThe Cake is a LiePS3 OwnerI am an April Fool
Batman!Teddy Bear
25th May, 2004 at 16:07:38 -

In a top view shooter, how do you make a granade that bounces on the walls, and maybe have to hold space repeatedly to throw longer?

 
http://www.robocaptain.com

Arf :: FPP Games



Registered
  15/05/2002
Points
  1364
25th May, 2004 at 17:33:52 -

Bouncing ball movement?

 
n/a

AsparagusTrevor

Mine's a pint of the black stuff

Registered
  20/08/2002
Points
  2364

Game of the Week WinnerHas Donated, Thank You!VIP MemberEvil kliker
25th May, 2004 at 18:47:29 -

Yeah, bouncing ball movement is fine to me. Have some degree of deceleration and it should be cool.

 
Image

ChrisB

Crazy?

Registered
  16/08/2002
Points
  5457
25th May, 2004 at 21:11:11 -

Yup. And for the 'hold space' thing, add a counter to the frame. While Space is pressed AND the counter is less than 70, add 1 to this counter. While Space is NOT pressed (right click the condition and select Negate) AND the counter is GREATER than 0, create the grenade using Create New Object at the player's position, set its direction to the player's direction and set its speed to the value of the counter. Set the counter to 0.

 
n/a

Muz



Registered
  14/02/2002
Points
  6499

VIP MemberI'm on a BoatI am an April FoolHonored Admin Alumnus
26th May, 2004 at 00:53:49 -

Let's say Y dimension = Alterable Value A

Set Alterable Value A to well.. your bouncing system. You know, set it to 0 when it hits the ground, and increase it later, with some deceleration, etc. You could easily make a custom bouncing movement that way.

Now, to get it over an object...
If Alterable Value A ("Grenade") < Alterable Value A ("Object")...
...it'll bounce off "Object". In case you haven't figured it out, you set Alterable Value A ("Object") to the 'height' of the Object.

To make it so you have to hold space longer... then set the initial max first bounce height of Alterable Value A higher, the longer you hold Space.

Ah, I'm tired of typing. That should answer all your questions, but whether you understood it or not, is a different story .

 
Disclaimer: Any sarcasm in my posts will not be mentioned as that would ruin the purpose. It is assumed that the reader is intelligent enough to tell the difference between what is sarcasm and what is not.

Image

Willy C



Registered
  14/02/2004
Points
  1524

Game of the Week WinnerKlikCast StarPicture Me This -Round8- Winner!VIP MemberWii OwnerIt's-a me, Mario!Hero of TimeThe Cake is a LiePS3 OwnerI am an April Fool
Batman!Teddy Bear
26th May, 2004 at 15:37:12 -

How should I do it. When I make a granade a bouncing ball and make my player shoot it, it just shoots it right trough the wall. and I have remebered the colission with backdrop make granade bounce. What should I do to make it bounce off the wall?

 
http://www.robocaptain.com

Muggus

Possibly Insane

Registered
  31/07/2002
Points
  2958
27th May, 2004 at 05:04:35 -

What I usually have is some kind of animation of the grenade bouncing up and down, and use ball movement.

When this animation reaches a point, the lowest point of animation when it would hit the ground, you decrease the speed of grenade...usually in half...and play like a bouncing sound. As with colliding with walls or obstacles where you make the grenade bounce and lose half it's speed.
When the speed of the grenade is equal 0 or whatever. You stop the bouncing animation and make it look like it's animation frame where it's at it's lowest point.

The beauty of the animation is you can have some collisions only work when a certain frame of the bouncing animation is playing.

For example...if frame 4 in the animation editor...which is image 3 in the event editor...is the grenade at it's highest point, you could have an event so that the grenade will only hit another character or obstacle of some sort is the animation image is different than 4.

 
MUGGUS
Come and annoy me more at
www.muggus69.tk
STOUT ANGER!!!

Willy C



Registered
  14/02/2004
Points
  1524

Game of the Week WinnerKlikCast StarPicture Me This -Round8- Winner!VIP MemberWii OwnerIt's-a me, Mario!Hero of TimeThe Cake is a LiePS3 OwnerI am an April Fool
Batman!Teddy Bear
27th May, 2004 at 09:59:25 -

that is what I did. I made the bouncing ball movment, but the problem is that when I do the upon pressing space = shoot granade event, it just passes right through the wall

 
http://www.robocaptain.com

ChrisB

Crazy?

Registered
  16/08/2002
Points
  5457
27th May, 2004 at 10:10:29 -

Don't shoot the grenade, use Create New Object instead

 
n/a

Willy C



Registered
  14/02/2004
Points
  1524

Game of the Week WinnerKlikCast StarPicture Me This -Round8- Winner!VIP MemberWii OwnerIt's-a me, Mario!Hero of TimeThe Cake is a LiePS3 OwnerI am an April Fool
Batman!Teddy Bear
27th May, 2004 at 11:40:45 -

Ive done that as well, only now the granade goes in a random direction not towards my mouse aim.

 
http://www.robocaptain.com

Kramy



Registered
  08/06/2002
Points
  1888
27th May, 2004 at 12:55:50 -

Hmm, been so long since I've used the direction calculator. I think I'm thinking of the right object...

--Create Grendade--

then right under it

Flag 0 of Grenade = off
--rotate towards mouse(using dir calculator for 360 dir bounces)(set the rotate value high enough that it doesn't visibly rotate)
--Set flag 0 on.

 
Kramy

Willy C



Registered
  14/02/2004
Points
  1524

Game of the Week WinnerKlikCast StarPicture Me This -Round8- Winner!VIP MemberWii OwnerIt's-a me, Mario!Hero of TimeThe Cake is a LiePS3 OwnerI am an April Fool
Batman!Teddy Bear
27th May, 2004 at 13:01:18 -

Ok Il try that, but Im starting from scratch with my program. I want it even better

 
http://www.robocaptain.com

Jimmy Brzezicki



Registered
  16/09/2003
Points
  1057
27th May, 2004 at 17:16:09 -

If you want the easy way just creat the ball objecct and set it's direction to the direction of your character (in the expression editor, under direction) IN THE SAME EVENT. Shot objects don't behave exactly according to the usual rules.

 
Why the hell am I on the computer at 1 in the morning? No, don't answer.

Muggus

Possibly Insane

Registered
  31/07/2002
Points
  2958
28th May, 2004 at 02:02:52 -

For the firing event for a grenade that bounces you should have an event like this...

- Player presses fire
Create Grenade relative to Player at Action spot, located towards direction of player
Set direction of Grenade to Dir("Player")
Start movement of Grenade
Set Speed of Grenade to 100...or whatever


You probably don't need those last two events...but just in case.
Note: The order of the actions is important! Make sure the first action executed for this event is the create Grenade action.

 
MUGGUS
Come and annoy me more at
www.muggus69.tk
STOUT ANGER!!!

Muz



Registered
  14/02/2002
Points
  6499

VIP MemberI'm on a BoatI am an April FoolHonored Admin Alumnus
28th May, 2004 at 08:55:04 -

Strange... not to sound arrogant or anything, but this is just one of those things that's just so painfully obvious to me that I just don't feel like explaining it. I mean, I thought someone would fully explain it or you'd be able to figure out how to animate. I guess it's a natural thing, like how some people could draw animations nice and I can't do a 3-frame animation that looks right.

All right... I'll try to explain it as simple as possible. I'm assuming you want one based on realistic physics, and not just a simple remodified bouncing ball movement thing :
Let's say Alterable value A (AVA) = Y position of grenade (or Z position or whatever is "up")

Code your own 'gravity' or 'bouncing' movement for the Y position. You know, something like "Every decisecond, AVA > 8 --> subtract 1 from AVA" and vice versa to make it bounce back up.

Now let's say Alterable Value B (AVB) = height

When AVA("grenade") > AVB("object") --> Bounce
When AVA("grenade") > AVB("object") --> Nothing happens

Now let's say the XY movement is what moves it around. I could explain on how to make your own top-view movement, but an easy way would be to use the bouncing ball movement, with deceleration. So the longer the object moves, the lower the speed. If you want, you can use AVC to track speed, but if you're as lazy as me, just subtract it after a few seconds or after a 'bounce'.

Now for the hold space thing... just set initial speed & maximum AVA higher the longer you hold it. Let's say AVC is your initial speed. You know, conditions with "User holds down Space, AVC < 70 --> Add 1 to AVC" will give you a max initial speed of 70.

As for animating it, just set frame to AVA. The higher the frame number, the closer the grenade is to the screen (the higher the grenade).


There... if you STILL can't figure it out by next time I'm online (probably next month), I'll write an engine for you and bag myself an extra 5 DC points for it .

 
Disclaimer: Any sarcasm in my posts will not be mentioned as that would ruin the purpose. It is assumed that the reader is intelligent enough to tell the difference between what is sarcasm and what is not.

Image
   

Post Reply



 



Advertisement

Worth A Click