I'm a noob

Whether you're a newbie or an experienced programmer, any questions, help, or just talk of any language will be welcomed here.

Moderator: Coders of Rage

User avatar
eatcomics
ES Beta Backer
ES Beta Backer
Posts: 2528
Joined: Sat Mar 08, 2008 7:52 pm
Location: Illinois

I'm a noob

Post by eatcomics »

So, I'm making a pong clone and it is in blitz basic, I'm using text graphics
and I can't get the stinkin ball to bounce off the paddles after that I'm done, but I can't find the code on the internet. I've been lookin for an hour!
Image
User avatar
Arce
Jealous Self-Righteous Prick
Jealous Self-Righteous Prick
Posts: 2153
Joined: Mon Jul 10, 2006 9:29 pm

Post by Arce »

OH, didn't see this topic before I replied to your PM.

Post the PM in here if you'd like so that others may add to what I say/help you out as well.

And tell me if it was any help.
<qpHalcy0n> decided to paint the office, now i'm high and my hands hurt
User avatar
Arce
Jealous Self-Righteous Prick
Jealous Self-Righteous Prick
Posts: 2153
Joined: Mon Jul 10, 2006 9:29 pm

Post by Arce »

Also, if you could tell us a bit more about your program (what it does atm, what exactly you want it to do, what variables you're using/how it's structured) I bet I could aid you better.
<qpHalcy0n> decided to paint the office, now i'm high and my hands hurt
User avatar
eatcomics
ES Beta Backer
ES Beta Backer
Posts: 2528
Joined: Sat Mar 08, 2008 7:52 pm
Location: Illinois

Post by eatcomics »

i could just post my code it looks like crap but I could. Im almost done If the paddles will just start working I'll be finished!
Image
User avatar
Arce
Jealous Self-Righteous Prick
Jealous Self-Righteous Prick
Posts: 2153
Joined: Mon Jul 10, 2006 9:29 pm

Post by Arce »

I don't understand your most recent PM.

Tell me what's wrong with it, and what you want it to do?

Does the ball work?

I need to know what you have done and don't have done.
<qpHalcy0n> decided to paint the office, now i'm high and my hands hurt
User avatar
eatcomics
ES Beta Backer
ES Beta Backer
Posts: 2528
Joined: Sat Mar 08, 2008 7:52 pm
Location: Illinois

Post by eatcomics »

Click here to see the hidden message (It might contain spoilers)
;PEENG PAWNG writen and developed by Eric Kline
;Thanks to my Dad for lettin me use his comp and thanks to Maneesh Sethi for writin the book that helped me develop this game
;Here we almost go
;copyright E.K. comics 2008- actually like i have legal rihgts to this!
;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!Game!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Graphics 400, 300
;This will make random numbers
SeedRnd (MilliSecs())

;This will make the buffer backbuffer so it looks good and smooth
SetBuffer BackBuffer()


AutoMidHandle True

;Types
Type Paddle
Field x,y
End Type

Type Ball
Field x, y
Field xv, yv
End Type

;Constants
Const PADDLESTRING$ = "|"
Const BALLSTRING$ = "o"
Const UPKEY = 17
Const DOWNKEY = 31
Const PAUSEKEY = 25
Const ENTERKEY = 28
Const WARPKEY = 19
Const MENUKEY = 50
Const ESCKEY = 1

Global ballheight = FontHeight()
Global ballwidth = Len(ballstring$) * FontWidth()
Global playerheight = FontHeight()
Global playerwidth = Len(playerstring$) * FontWidth()
Global player1score = 0
Global player2score = 0
Global difficulty1 = Input ("How quick can you move?")
Global difficulty2 = Input ("How Quick can the computer move?")
Global ballX = 190
Global ballY = 140
Global ballspeedX = Rnd(-1,1)
Global ballspeedY = Rnd(-1,1)
Global youX = 20
Global youY = 140
Global compX = 370
Global compY = 140
Global ball.Ball = New Ball
Global you.Paddle = New Paddle
Global comp.Paddle = New Paddle



Function DrawHUD()
Cls
Text 0, 0, player1score
Text 380, 0, player2score
Text 0, 270, "p1 speed " + difficulty1
Text 0, 280, "p2 speed " + difficulty2

End Function

Function TestInput()

If KeyDown(DOWNKEY)
youY = youY + difficulty1
EndIf
If KeyDown(UPKEY)
youY = youY - difficulty1
EndIf
If KeyHit(PAUSEKEY)
Cls
While Not KeyHit(PAUSEKEY)
Text 0, 0, ("P1 score: " + player1score)
Text 0, 20, ("P2 score: " + player2score)
Text 0, 40, ("P1 speed: " + difficulty1)
Text 0, 60, ("P2 speed: " + difficulty2)
Text 10, 100, ("PEENG PAWNG, developed by Eric Kline, is paused!")
Text 100, 120, ("Press P to unpause...")

Wend
EndIf

If KeyDown(WARPKEY)
youY = ballY
EndIf
End Function





Function DrawPaddles()
If ballspeedX = 0
ballspeedX = -1
ElseIf ballspeedY = 0
ballspeedY = 1
EndIf
Text youX, youY, paddlestring$
Text compX, compY, paddlestring$
Text ballX, ballY, ballstring$
End Function





Function TestAI()

ballX = ballX + ballspeedX
ballY = ballY + ballspeedY

If ballY > compY
compY = compY + difficulty2

ElseIf ballY < compY
compY = compY - difficulty2
EndIf



End Function

Function Walls()
;lets see if i can get this workin stupid bouncing balls :(
If ballY <0>= 300
ballspeedY = -ballspeedY + Rand (-1,1)
ballspeedX = ballspeedX + Rand (-1,1)
EndIf

If ballX <0>= 400
player1score = player1score + 1
ballX = 190
ballY = 140
youX = 20
youY = 140
compX = 370
compY = 140
EndIf

If ballY >= youY And ballY <youY>= youX And ballX + ballwidth <= youX + playerwidth
ballspeedX = -ballspeedX + 1
EndIf

If ballY <compY>= compY + playerheight And ballX + ballwidth <compX>= compX + playerwidth
ballspeedX = -ballspeedX - 1

EndIf




End Function

;Mainloop this makes the game run
While Not KeyDown(ESCKEY)

;Functions here's where the stuff happens
DrawHUD()
TestInput()
DrawPaddles()
TestAI()
Walls()
Flip
Wend


it works fine except the comp paddle wont reflect hte ball
and the you paddle only reflects it occassionally
so im stuck!
guyofcomics
Chaos Rift Cool Newbie
Chaos Rift Cool Newbie
Posts: 53
Joined: Wed Apr 09, 2008 12:33 am
Contact:

Post by guyofcomics »

I thought u were gonna learn C++
Go Bears!
User avatar
MarauderIIC
Respected Programmer
Respected Programmer
Posts: 3406
Joined: Sat Jul 10, 2004 3:05 pm
Location: Maryland, USA

Post by MarauderIIC »

You only have to post the relevant sections, instead of the whole thing :P

Code: Select all

 If ballY <0>= 300
ballspeedY = -ballspeedY + Rand (-1,1)
ballspeedX = ballspeedX + Rand (-1,1)
EndIf 
Isn't it supposed to be more like

Code: Select all

If (ballY < 0 Or ballY >= 300)
?

Unless that's what you wrote (and just didn't disable HTML in your post)
I realized the moment I fell into the fissure that the book would not be destroyed as I had planned.
User avatar
eatcomics
ES Beta Backer
ES Beta Backer
Posts: 2528
Joined: Sat Mar 08, 2008 7:52 pm
Location: Illinois

Post by eatcomics »

yeah that's what I wrote I didn't dissable HTML so that is why...
And I changed my mind, or Arce changed my mind ...
Image
User avatar
dejai
Chaos Rift Junior
Chaos Rift Junior
Posts: 207
Joined: Fri Apr 11, 2008 8:44 pm

Post by dejai »

The definition of a noob is one who cannot solve there own problems IMO.
User avatar
eatcomics
ES Beta Backer
ES Beta Backer
Posts: 2528
Joined: Sat Mar 08, 2008 7:52 pm
Location: Illinois

Post by eatcomics »

Don't worry guys I gave up on this. I'm workin on a game with graphics. It's currently going very well, I havent had any problems and the gameplay is quite addictive!
Image
User avatar
Arce
Jealous Self-Righteous Prick
Jealous Self-Righteous Prick
Posts: 2153
Joined: Mon Jul 10, 2006 9:29 pm

Post by Arce »

Hey, my apology for not helping sooner--I'll take a look at it tomorrow sometime. I've been without internet for the past 2 or so weeks, so when I've been on it's only been for brief periods of time and I really haven't had enough to debug that.

As for your later programs, I'd like to see what you come up with.
<qpHalcy0n> decided to paint the office, now i'm high and my hands hurt
User avatar
eatcomics
ES Beta Backer
ES Beta Backer
Posts: 2528
Joined: Sat Mar 08, 2008 7:52 pm
Location: Illinois

Post by eatcomics »

I told you were to find my newest program vid on youtube in your twelve year old you tribute... So just follow the instructions I gave you...
Image
User avatar
JS Lemming
Game Developer
Game Developer
Posts: 2383
Joined: Fri May 21, 2004 4:09 pm
Location: C:\CON\CON

Post by JS Lemming »

eatcomics wrote:I told you were to find my newest program vid on youtube in your twelve year old you tribute... So just follow the instructions I gave you...
If you want people to watch your video, post the god forsaken link.
Small girl at the harbor wrote:Look Brandon, that crab's got ham!
User avatar
eatcomics
ES Beta Backer
ES Beta Backer
Posts: 2528
Joined: Sat Mar 08, 2008 7:52 pm
Location: Illinois

Post by eatcomics »

http://youtube.com/watch?v=BndPvsUtbj4

Are you happy? It was intended for my friends to see so they didn't think I was slackin off... :|
Image
Post Reply