The Daily Click ::. Forums ::. Klik Coding Help ::. throwing a Mine in a platformer
 

Post Reply  Post Oekaki 
 

Posted By Message

badoona



Registered
  27/03/2006
Points
  209
6th July, 2007 at 08:04:24 -

I'm having a problem coding a mine in the new 2D platformer I'm making. 'Get Flocked'.

It's the gravity movements that I am finding difficult. I've been working all week on it but it still doesn't work right.

Can somebody point me in the direction of a ball movement example or tutorial - I've looked on this website but not found... it's for TGF!!

I'm made my own platform movements for it by studying Phizzy's old stuff.

For this mine, I am working it like this:

While crouched, press 'Ctrl'.

The vertical Power bar goes moves up and down (between 0 and 100) until 'Ctrl' pressed again. Mine created in the hands of character and and value B is made to be power bar vaule divided by 20 (1-4).

Value A of mine is movement on X axis.

If Value B is more than 0 the mine moves up on Y axis (every 10 split seconds 1 is subracted from value B). If value B is 0 it stays the same Y (creating a hang in the air).

If value B is less than 2 it moves down on the Y axis. until it hits something.

That all might be meaningless if someone points me in the direction of a good .gam example of a bouncing ball or something - please!!!

Thanks


 
n/a

badoona



Registered
  27/03/2006
Points
  209
8th July, 2007 at 08:12:54 -

any help? please?

 
n/a

Hernan



Registered
  04/03/2003
Points
  707

VIP Member
8th July, 2007 at 09:48:35 -

Sorry, but I find your description kinda vague. What part do you exactly have a problem with? How did you code the movement and how is the mine supposed to move?

 
This space is for rent

»xerus



Registered
  28/06/2002
Points
  675

You've Been Circy'd!Game of the Week Winner
8th July, 2007 at 10:33:13 -

So, are values A and B the xSpeed and ySpeed for an object? Basically gravity is just the acceleration acted upon the objects, so you just need something like "Always -> Add (GravityValue) to ySpeed("object")" or something like that.

Positive ySpeeds should be moving down if you go by the axis that the MMF frame gives you. You seem to be making things a lot more complicated than they have to be.

 
n/a

AndyUK

Mascot Maniac

Registered
  01/08/2002
Points
  14586

Game of the Week WinnerSecond GOTW AwardHas Donated, Thank You!VIP Member
8th July, 2007 at 10:38:13 -

Well ive worked out part of it

you can press down and ctrl to start the 'strength counter' moving from 0 to 100 and back again.
then pressing ctrl again will throw a mine using the strength counter for X movement (the Y is fixed right now)

but you can only throw to the right for now because im a bit n00b at get it to work for negative values
mines bounce of walls but it's all very... rubbish really. Hope it helps a little.

http://www.geocities.com/alspics2001/minethrow.zip

 
.

badoona



Registered
  27/03/2006
Points
  209
10th July, 2007 at 05:36:10 -

Thanks guys, espesh Andy UK. I'll let you know how I get on when I try it out.



 
n/a

badoona



Registered
  27/03/2006
Points
  209
11th July, 2007 at 05:04:10 -

Cheers Andy that is awesome, it's amazing to see it work so well after trying for so long to make it work. Xerus seems to have been right with me making things harder than they need to be.

But it only works for throwing the mine to the right, as Andy said. How do you get it to move in the left/negitive side? Do you ad -1 to the already negitive value?

Cheers.

 
n/a

badoona



Registered
  27/03/2006
Points
  209
13th July, 2007 at 01:26:39 -

thanks for all your help, it's now working great, I worked out how to get it throwing left (much easier than i thought).

I had complicated this part of the programming and my thanks to you.

 
n/a
   

Post Reply



 



Advertisement

Worth A Click