Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
PONG - The RPG
#1
Yeah, I got internet (sloooow dialup) but now I can update about my current project:


PONG - THE ROLE-PLAYING GAME!

or, P-RPG.

It's a mix of tomogachi and monster rancher, with different Pong challenges - you have to train, raise, and discipline your paddle, which may involve whacking it upside the head (which sounds kinda dirty).

So far, I have a few things down. I'm actually logging my progress on this one.

Test out this for me - http://fileanchor.com/55930-d I'm still shakey about speed. It works fine for me, but does it run well for others?
Quote:As a side note, I wish I was a robotic zombie ninja pirate.
Reply
#2
it runs perfectly fine for me.
quote="whitetiger0990"]whitetiger is.. WHITE POWER!!! [/quote]
Here
Reply
#3
Sweet. I can't rely on sleep - it's still too slow, and other timing methods have proven too slow. Also, how acurate is it? would it be roughly the same speed for everyone?
Quote:As a side note, I wish I was a robotic zombie ninja pirate.
Reply
#4
It runs good here. It might be a tad fast, but I could still easily read everything.
Reply
#5
I'm not sure if FB has it (it should) but you could use timeGetTime() from Windows.h, of course you have to call

timeBeginPeriod(1) at the start of the program
timeEndPeriod(1) just before you quit the program

but I think it's quite accurate (of course you throw linux etc. compatability out of the window, pun intended)
url=http://www.sloganizer.net/en/][Image: style4,TheDarkJay.png][/url]
Reply
#6
Timer should work just fine. I've used it for time based movement, and it worked perfectly.
Reply
#7
Now then, let's move on to the gameplay. Would someone be willing to help with the ball physics? I plan on having the battles be simply pong tournaments - but it's computer vs. computer and your character performs based on how well you train it. I'm planning on a few different types of PONG variations, so it's not blandly one thing.
Quote:As a side note, I wish I was a robotic zombie ninja pirate.
Reply
#8
I made a ball physics demo... hope it helps. Wink


Code:
#Include Once "FBGFX.BI"
'Option Explicit
'Option Explicit is obsolete, as of fbc v.017b
Screenres 640, 480, 8, 2, 1
Screenset 0, 1

Type Vector2D
    X As Single
    Y As Single
End Type

Declare Function Vec_2D_Normal(a As Vector2D, b As Vector2D ) As Vector2D
Declare Function ClosestPointOnLine(Va As Vector2D, Vb As Vector2D,vPoint As Vector2D) As Vector2D
Declare Sub Vec_2D_Normalize(Byref v As Vector2D)
Declare Function Vec_2D_Len(V As Vector2D) As Single
Declare Function Vec_2D_Dot(a As Vector2D, b As Vector2D) As Single
Declare Function Vec_2D_Dist(vA As Vector2D, vB As Vector2D) As Single

Dim As Vector2D Pl=>(320,240), Pld=>(0,0), ipoint, normal
Dim As Single   Radius = 10, Dist
Dim As Integer  i, iAnd1, Num_Verts


Read Num_Verts
Dim Lines(Num_Verts) As Vector2D
For i = 0 To Ubound(Lines)
    Read Lines(i).X, Lines(i).Y
Next


Do
    Cls
    
    If Multikey(Sc_Left)  Then PlD.X -=.15
    If Multikey(Sc_Right) Then PlD.X +=.15
    If Multikey(Sc_Up)    Then PlD.Y -=.15
    If Multikey(Sc_Down)  Then PlD.Y +=.15    
    
    PlD.X*=.95
    PlD.Y*=.95
    
    Pl.X+=PlD.X
    Pl.Y+=PlD.Y
    
    For i=0 To Ubound(Lines)-1 Step 2
        iAnd1 = i+1
        normal = Vec_2D_Normal( Lines(i), Lines(iAnd1) )
        ipoint  = ClosestPointOnLine( Lines(i), Lines(iAnd1), PL )
        Dist = Vec_2D_Dist( Pl, ipoint )
        
        If Dist<Radius Then
            Pl.X+=( normal.X *(Radius-Dist) )
            Pl.Y+=( normal.Y *(Radius-Dist) )
        End If
        
        Line(Lines(i).X, Lines(i).Y)-(Lines(iAnd1).X, Lines(iAnd1).Y),14
        Line(ipoint.X, ipoint.Y)-(ipoint.X + (normal.X*Radius), ipoint.Y + (normal.Y*Radius)),7
    Next
    
    Circle (Pl.X, Pl.Y),Radius, 1
    Pset (Pl.X, Pl.Y), 4
    
    Wait &H3da, 8
    Flip
Loop Until Multikey(Sc_Escape)

End



Function ClosestPointOnLine( Va As Vector2D, Vb As Vector2D, vPoint As Vector2D ) As Vector2D
    Dim  As Vector2D tVector1, tVector2, vReturn
    Dim As Single d, t
    
    tVector1.X = VPoint.X - va.X
    tVector1.Y = VPoint.Y - va.Y
    tVector2.X = vb.X - va.X
    tVector2.Y = vb.Y - va.Y    
    Vec_2D_Normalize tVector2    
    d = Vec_2D_Dist( va, vb)
    t = Vec_2D_Dot( tVector2, tVector1 )
    
    If t<=0 Then Return va
    If t>=d Then Return vb
    vReturn.X = va.X + ( tVector2.X * t )
    vReturn.Y = va.Y + ( tVector2.Y * t )
    Return vReturn
End Function

Function Vec_2D_Dist( va As Vector2D, vb As Vector2D ) As Single
    Dim As Vector2D d
    Dim As Single tLen
    
    d.x = va.x - vb.x
    d.y = va.y - vb.y
    tLen = Vec_2D_Len( d )
    
    Function = tLen
End Function

Sub Vec_2D_Normalize( Byref v As Vector2D )
    Dim VecLen As Single
    
    VecLen = Vec_2D_Len ( V )
    v.x = v.x / VecLen
    v.y = v.y / VecLen
End Sub

Function Vec_2D_Len( v As Vector2D ) As Single
    Dim tLen As Single
    
    tLen = Sqr( v.x^2 + v.y^2 )
    
    If tLen = 0 Then tLen = 1
    Function = tLen
End Function

Function Vec_2D_Dot( a As Vector2D, b As Vector2D ) As Single
    Function = a.x*b.x + a.y*b.y
End Function

Function Vec_2D_Normal( a As Vector2D, b As Vector2D ) As Vector2D
    Dim VecLen As Single
    Dim As Vector2D d, n
    
    d.x = b.x - a.x
    d.y = b.y - a.y
    VecLen = Vec_2D_Len( d )
    n.x = (  d.y ) / VecLen
    n.y = ( -d.x ) / VecLen
    
    Return N
End Function



Data 21

Data 0,0
Data 0,240

Data 0,240
Data 100,340

Data 100,340
Data 125,400

Data 125,400
Data 300,450

Data 300,450
Data 450,470

Data 450,470
Data 600,370

Data 600,370
Data 550,300

Data 550,300
Data 625,250

Data 625,250
Data 500,0

Data 500,0
Data 320,50

Data 320,50
Data 0,0
Reply
#9
Wow...

No idea what that is... I'm kinda weak on math...

I don't even understand what it does...

But it's pretty cool 8) - i'll figure it out soon enough, still got a lot to do before getting into the battles.
Quote:As a side note, I wish I was a robotic zombie ninja pirate.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)