Page 1 of 2

pinball

PostPosted: Sat Nov 03, 2007 11:37 am
by j2graves
does anybody know how to do flippers in a pinball game?
you know like,
-ball just rolls over flipper unless you press the key
-ball flies at a different angle depending on which part of the flipper it was on when the key is pressed

also, i need to know how to make the ball roll as in when it hits a slanted surface, it shouldn't move very slowly.

Re: pinball

PostPosted: Sat Nov 03, 2007 12:07 pm
by j2graves
I need this people! please help! +2 for anyone who gives me the answer!

Re: pinball

PostPosted: Sat Nov 03, 2007 12:54 pm
by Azou
Hahaha!!! You're playing the teacher!! Sorry i don't know,but try to ask to Kalladdolf,or Bee-ant.Maybe they have the solution! :D

Re: pinball

PostPosted: Sat Nov 03, 2007 1:10 pm
by j2graves
:roll:
okay. I hope they get on soon.

Re: pinball

PostPosted: Sun Nov 04, 2007 1:21 am
by Rux
I bet you just add gravity to the ball
Code: Select all
yvelocity = yvelocity + .5;

And add a physical Response to the game board on the ball. :)

Re: pinball

PostPosted: Sun Nov 04, 2007 3:42 pm
by j2graves
I know how to do gravity, but I need to know how to make the ball fly upward when I press the key.

Re: pinball

PostPosted: Sun Nov 04, 2007 5:09 pm
by Kalladdolf
I'm sure you know how to add a variable.
Call it fly_up

For the flipper goes:
Key down -> right -> script editor->
Code: Select all
fly_up = 1;

Key up -> right -> script editor->
Code: Select all
fly_up = 0;


For the ball goes:
Collision -> top side of flipper -> script editor ->
Code: Select all
if (fly_up == 1)
{yvelocity = -20;}


This will make the ball go up when it touches the flipper and the key is pressed.

Re: pinball

PostPosted: Sun Nov 04, 2007 6:49 pm
by j2graves
THANKS! +2

Re: pinball

PostPosted: Mon Nov 05, 2007 1:54 am
by Fuzzy
Lets eliminate the if all together.

make a variable called direction. set it to -1;

For the flipper goes:
Key down -> right -> script editor->
Code: Select all
direction = direction * -1; // I think you could also go direction =*;

Key up -> right -> script editor->
Code: Select all
direction = direction * -1;


For the ball goes:
Collision -> top side of flipper -> script editor ->
Code: Select all
yvelocity = yvelocity*direction; // you might want to bleed a little speed off this to account for frictional forces.


When it collides with something else, you will have to set the xvelocity and yvelocity again, perhaps using the same system as this.

This will make the ball go up when it touches the flipper and the key is pressed.[/quote]

Re: pinball

PostPosted: Tue Nov 06, 2007 5:58 pm
by j2graves
well uh, thanks. that was a little harder to follow, fuzzy :(
but I'll try it out. I'll give u 2 points for helping. feel lucky! :D

Re: pinball

PostPosted: Wed Nov 07, 2007 4:34 pm
by Troodon
Wait, that can be made with physical response too! Seriously, slowly enough moving frames affect physically correctly. I mean, there is a Makslanes demo somewhere... I don't find it. You can try Metal_pt:s game:
http://game-editor.com/forum/download.php?id=698

Re: pinball

PostPosted: Thu Nov 08, 2007 9:35 am
by Bee-Ant
==Kalladdolf== wrote:I'm sure you know how to add a variable.
Call it fly_up

also rand_up (actor variable)
CollisionEvent>top side of Fipper>ScriptEditor>
Code: Select all
if(fly_up==1)
{
    rand_up=rand[10];
    if(rand_up<2)
    {
        xvelocity-=20;
    }
    if(rand_up>2&&rand_up<4)
    {
        xvelocity-=10;
    }
    if(rand_up>4&&rand_up<6)
    {
        xvelocity-=0;
    }
    if(rand_up>6&&rand_up<8)
    {
        xvelocity+=10;
    }
    if(rand_up>8)
    {
        xvelocity+=20;
    }
    yvelocity-=20;
}

This code could make the random flies...hope help :D

Re: pinball

PostPosted: Thu Nov 08, 2007 9:40 am
by Bee-Ant
Azou wrote:Try to ask to Kalladdolf,or Bee-ant.Maybe they have the solution! :D

Me and Kalladdolf are just active users..
Here are too much of members who have solutions more than us...but they aren't active :D

Re: pinball

PostPosted: Sat Nov 17, 2007 1:17 pm
by j2graves
active alright!

Re: pinball

PostPosted: Sun Dec 02, 2007 12:30 am
by DST
--