Pong-Spiel
Übersicht

raynesaBetreff: Pong-Spiel |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
Weiß jemand, wo ich ein Beispiel-plog Spiel in Blitz3D nur damit ich sehen kann, wie sie gebaut werden gebaut bekommen kann?
Hoffe jemand kann helfen. Dank ![]() |
||
BBPro2 |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
also zunächst mal wäre es super wenn du vernünftige sätze bauen könntest damit man dich auch auf anhieb versteht.
ich weiß weder was ein plog sein soll noch macht der 2. teil des satzes irgendeinen sinn. desweiteren baut man keine spiele sondern programmiert sie - zumindest in blitz basic baut man nichts. außerdem wird aus deiner frage nicht klar ob du ein 2d oder 3d pong willst. anhand der beispiele die bei blitz basic mitgeliefert werden (weiß grad gar nicht ob ein pong dabei ist) lässt sich ein pong sehr leicht programmieren - man muss sich nur die basics wie variablen, grafik zeichnen etc selbst beibringen (ja, so ist das mit dem programmieren) - ein pong ist dann kein großes problem mehr eigentlich. setz dich einfach mal an die beispiele, spiel ein bißchen rum und lies dir ggf das ein oder andere tutorial durch, dann wird das auch was |
||
![]() |
das wurgel |
![]() Antworten mit Zitat ![]() |
---|---|---|
Ich veweise Mal auf den Thread: https://www.blitzforum.de/foru...hp?t=37715
If you can make a ball rebound on the screen borders, then you just have to program two paddels and two point-counters. You change the y-position of the paddels by keypress. If the ball touches the right or the left side, check if the balls y-position lies between the y-position and the end y-position of the paddle. If so, the ball rebounds. Otherwise, it flys out of the screen, a player scores one point, and the balls position is reseted. For nearer information, send your code! |
||
1 ist ungefähr 3 |
raynesaBetreff: Code so far |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
Bislang habe ich den folgenden Code erzeugt;
Global GW = GraphicsWidth() Global GH = GraphicsHeight() Graphics 800,600 speedX = Rand( -3, 3 ); speedY = Rand( -3, 3 ); Const ESCAPE = 1 ball = LoadImage("ball.bmp") x=400 y=300 SetBuffer BackBuffer() While Not KeyDown(ESCAPE) Cls() x = x + speedX y = y + speedY If x < 0 Or x > 770 speedX = -speedX EndIf If y < 0 Or y > 570 speedY = -speedY EndIf If x < 0 Then x = 0 If x > 770 Then x = 770 If y < 0 Then y = 0 If y > 570 Then y = 570 DrawImage(ball, x, y) Flip() Wend End Vielen Dank für Ihre Zeit so, wie es viel appreicated ist. |
||
![]() |
das wurgel |
![]() Antworten mit Zitat ![]() |
---|---|---|
Okay, that looks good.
I've made some comentarys on the places, where you should check for collision and where you should increase the score. Code: [AUSKLAPPEN] Global GW = GraphicsWidth() Global GH = GraphicsHeight() Graphics 800,600 speedX = Rand( -3, 3 ); speedY = Rand( -3, 3 ); Const ESCAPE = 1 ball = LoadImage("ball.bmp") x=400 y=300 SetBuffer BackBuffer() While Not KeyDown(ESCAPE) Cls() x = x + speedX y = y + speedY If x < 10 Then ;10 is for the width of the paddle If ball collides with the Right paddle Then speedx=Abs(speedX) ; make the x-speed positive EndIf EndIf If x > 770 - 10 Then If ball collides with the Right paddle Then speedx=-Abs(speedX) ; make the x-speed negative EndIf EndIf If y < 0 Or y > 570 speedY = -speedY EndIf If x < 0 Then ; Point for Player One If x > 770 Then ; Point for Player Two If y < 0 Then y = 0 If y > 570 Then y = 570 DrawImage(ball, x, y) Flip() Wend End First program the two Paddles as far as you can. If you have problems with the collision, send your new code and ask. Use the Code button in the reply dialog to make a box around the code. |
||
1 ist ungefähr 3 |
raynesaBetreff: More details |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
Thanks for your help and advice.
Instead of drawing the paddles, I would actually like to import an image of my own in, like I have done with the ball. i.e paddle1 = LoadImage("Paddle1.bmp") However the problem I am having is assigning the move functions to the "paddle1" and the random move functions to the "ball". I haven't done much with the code so far apart from try and insert the "paddle1" into the game, but the probelm I am having is both "Paddle1" and the "Ball" are going randomly around the screen. Code so far: Code: [AUSKLAPPEN] Global GW = GraphicsWidth()
Global GH = GraphicsHeight() Graphics 800,600 speedX = Rand( -3, 3 ); speedY = Rand( -3, 3 ); Const ESCAPE = 1 Const UP = 200 Const DOWN = 208 Const Left = 203 Const Right = 205 ball = LoadImage("ball.bmp") ;Loads the image to screen paddle = LoadImage("paddle1.bmp") x=400 y=300 ;Sets the ball to the middle of the screen SetBuffer BackBuffer() While Not KeyDown(ESCAPE) Cls() x = x + speedX y = y + speedY If x < 0 Or x > 770 speedX = -speedX EndIf If y < 0 Or y > 570 speedY = -speedY EndIf If x < 0 Then x = 0 If x > 770 Then x = 770 If y < 0 Then y = 0 If y > 570 Then y = 570 If KeyDown(UP) y = y - 1 If KeyDown(DOWN) y = y + 1 DrawImage(ball, x, y) DrawImage(paddle1, x, y) Flip() Wend End Thanks again for your time, I am learning a lot from your help ![]() |
||
![]() |
XeresModerator |
![]() Antworten mit Zitat ![]() |
---|---|---|
...why are you using just two variables? Use x_ball, y_ball and x/y_paddle or something along those lines.
And again: why are you asking here? Why don't you look into the example folder or start with a tutorial for beginner? |
||
Win10 Prof.(x64)/Ubuntu 16.04|CPU 4x3Ghz (Intel i5-4590S)|RAM 8 GB|GeForce GTX 960
Wie man Fragen richtig stellt || "Es geht nicht" || Video-Tutorial: Sinus & Cosinus THERE IS NO FAIR. THERE IS NO JUSTICE. THERE IS JUST ME. (Death, Discworld) |
![]() |
Midimaster |
![]() Antworten mit Zitat ![]() |
---|---|---|
you need to have two different x and y variables for ball and paddle:
Better use PaddleX and PaddleY for the Paddle, and BallX and BallY for the Ball. |
||
Gewinner des BCC #53 mit "Gitarrist vs Fussballer" http://www.midimaster.de/downl...ssball.exe |
raynesaBetreff: Thanks |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
Thanks guys, I shall give that a go.
With regards to your comment "Xeres"; I dont see a problem with posting question on a forum and find it easier to learn asking questions apossed to following tutorials. If you have a problem with me asking questions on this forum, please just say? |
||
![]() |
BladeRunnerModerator |
![]() Antworten mit Zitat ![]() |
---|---|---|
I think he is just wondering ( like I do it too) why you are asking in a german speaking community when there ist a community in english language which seems to be your native language.
It would be far easier to obtain and give help there as the problems with misunderstanding would disappear. You seem to have used google translater which returns rubbish most of the time, and a lot of our users don't speak english very well, so your asking for help may often be unanswered. We had users here more than once who claimed they could not create a forum-account at blitzbasic.com but none of them had this problem unsolved after contacting brl (at least if they owned a legal copy of B3D). If you have bought B3D then BRL will have your contact data and they will be willingly helping you using your account. If you don't have a legal version of Blitz3D neither them will help you nor do we. |
||
Zu Diensten, Bürger.
Intel T2300, 2.5GB DDR 533, Mobility Radeon X1600 Win XP Home SP3 Intel T8400, 4GB DDR3, Nvidia GF9700M GTS Win 7/64 B3D BMax MaxGUI Stolzer Gewinner des BAC#48, #52 & #92 |
Übersicht


Powered by phpBB © 2001 - 2006, phpBB Group