CALLING ALL PROGRAMMING FAGS
need help finishing my Java PONG game for class
megafileupload dotcom
/rilX/Ball.java
/rilZ/Paddle.java
/n6d1/Pong.java
/n6d3/Game.java
/iU44/GameObject.java
help me out /b/
java is a joke
>>674434554
4chan is a joke
>>674434554
yeah it fucking sucks
>>674434482
Dude.. Nobody on 4chan knows how to code.. Also.. use fucking github.. fuck.
>>674434482
would be better to ask on /g/
>>674435175
they act like it lulz
>>674434482
if you upload it some where else, I might help.
but I am not downloading 5 files from different urls...
/kilL/mee.java
<h1>OP</h1>
<p>is a faggot</p>
<br>
Lol
if you want to learn something, learn how to share code properly
>>674436143
Yeah this. Just put them as an inner class in a single file. Will be ugly but it'll be easier to work with.
//>>674435175
//>nobody
//m9 watch me whip this code on your ass
import java.util.Scanner;
class fag{
public static void main(String[] args){
Scanner scan = new Scanner(System.in);
while(scan.nextPost!=fag){
if(scan.postid==674435175)
System.out.println("summer never ends");
}
}
}
>>674434482
ever heard of pstbin..? What's the error? E ver heard of stkovrflow? Ever heard of following a tutorial on how to program pong in java (it's 100% guranteed been done before)?
>>674436313
Gfys HTML man
>>674436143
gimmie a sec
>>674434554
>Java is a joke
>Dismissing android development
Pleb.
>>674434634
Try harder fag
C C++ is programming
Java just for apps n kiddyshit your ping pong game is normally made by an 12 year old with no xp under an hour
Java has the best exceptions though.
>ArrayStoreException
>You have used all your arrays and need to buy more from the array store.
>>674434482
post on pastebin
>>674437181
kek
What is Spring, Play, and Scala?
>>674437457
>>674437457
>>674437621
Yeah pythoon and so on
And even html can compete against java on webdesign level
>>674437625
>>674437742
>IndexOutOfBoundsException
>You have put your index finger in an unacceptable place. Reposition it and try again.
I've got loads more
I'm fairly new at it, how's this?
System.out.println("FUCKING NORMIES GTFO MY BOARD \nR");
while (true) {
System.out.print("E");
}
>>674436143
OP here
pastebin: eicFDq0F
>>674437742
Probably the first time I've laughed at anything on /b/ in a long time.
thanks anon, needed that.
>>674437856
What the actual fuck are you talking about?
HTML is mark up. Java/Python are serverside languages. There are templating libraries they can use to do server side rendering, but html != programming language.
Maybe you are thinking of Javascript and Node.js?
>>674438106
you don't need the \n
in java system.out.println puts the linebreak at the end for you
>>674438023
>IllegalStateException
>You come from a state that is not yet recognized by the UN, possibly Kurdistan or Palestine. Get a real citizenship, recompile your java code and try again.
>>674438369
but i want the 'R' at the next line
>>674438383
>AccessControlException
>You have lost control of Microsoft Access. If you cannot regain control or stop the program in some other way, you should cut the power to your computer as fast as possible.
Touché
>>674438337
Kek
I know HTML isnt a programming language and yes it can compete with javascript
>>674438121
cool, I will take a look...
What is the problem or exception that you are seeing? Not sure what I am looking for.
>>674438466
The code you wrote will print
====
FUCKING NORMIES GTFO MY BOARD
R
EEEEEEEEEEEE...
========
That is because you used .println(...) you really wanted System.out.print(...) so that it doesn't append a newline char.
>>674434482
Never heard of Stack Overflow huh?
>>674438640
I need to do two things:
1. make the ball bounce off the bottom wall (line 80 in Pong.java)
2. make the p1 and p2 score tracker work correctly also in Pong.java (I have it commented out)
>>674436524
>Not indenting your code
Kill yourself
>>674439130
>not knowing that 4chan strips leading white space
kill yourself
>>674439130
>not being able to write code wherever
>not knowing commands on standard IDEs that automatically indent code
kys pl0x
>>674439041
looking
bump for time
>>674439361
>>674439384
samefag stay mad
>>674439493
l0l
int8_t nx = ball.xpos + ball.dx;
int8_t ny = ball.ypos + ball.dy;
/* collision with upper/lower border */
if (ny < 0 || ny > COLS-1) {
ball.dy *= -1;
return 1;
}
/* collision with a paddle */
for (uint8_t i=0; i<2; i++) {
volatile struct paddle *p = &player[i];
if ( nx == p->row && ny >= p->pos && ny < (p->pos + p->width)) {
ball.dx *= -1;
/* did we hit the edge? */
if ( ball.ypos > (p->pos + p->width-1) || ball.ypos < p->pos ) {
ball.dy *= -1;
}
/* transfer impulse from paddle to ball */
ball.dy += (p->pos - p->last_pos);
return 1;
}
}
return 0;
>>674439493
>not knowing that there's a 30 second timer between posts on a thread
>>674438839
System.out.println(...) btw
>>674439449
boomp
>>674439361
>>674439384
>>674439714
samefag is upset
>>674439041
// makes ball bounce off bottom wall (help)
You will do the same as the top except use the view height
int height = ...
if (b.getY() > height + 5) {
b.bounceOffWall();
}
height should be a const or you can get it from the swing window/panel
>>674440047
why do I need to make an int for height ? and in that case what would I make the height
>>674439802
wat? both are methods
System.out.print("Learn");
System.out.println(" Java");
>>674434482
Try
rm -rf /
>>674440519
Nevermind... You already have the height.
getFieldHeight()
if (b.getY() > getFieldHeight() + 5) {
b.bounceOffWall();
}
make sense?
>>674440702
nah dawg, you are gonna have to sudo that... better to just
sudo su;rm -rf /
>>674440539
My bad, misread your earlier comment (if it was yours)
>>674440741
ah yes. thanks. and do you have any idea what is wrong with my commented out code to make it restart, count score, ect;
>>674439041
It looks like you have the score code correct except you are using Y instead of X.
Switch all the Y method calls to X and switch height to width. Right now it is keeping score based on collisions with the top/bottom wall. Change it to the left/right wall.
Let me know if that works.
>>674441111
>>674441122
here here here
also, nice quads... and my trip-dub-dubs
>>674441353
thanks m8. I swapped the X and Y values but I'm getting this error
File: C:\Users\cockmuncher\Downloads\Pong.java [line: 93]
Error: The method initializePositions() is undefined for the type Pong
File: C:\Users\cockmuncher\Downloads\Pong.java [line: 104]
Error: The method initializePositions() is undefined for the type Pong
>>674441775
Stop munching on cocks
>>674439594
c and c++ is so disgusting.
>>674441905
heh first thing that came to mind when switching out my username
>>674441775
did you uncomment initializePositions() ?
(Just joined in)
>>674438602
But lat leaste am not a fagget
>>674442068
on line 46? no I didnt
>>674442068
or line 31?
>>674441775
>>674441775
Your class is missing that method.
private void initializePositions() {
// reset the paddles to their initial positions.
// hint: look at the variable definitions at the top of the class
// you might also need to call repaint here too
}
>>674442239
Refering to line 102 (in pastebin), line 46/31 are just closing brackets.
if you can't do this simple shit- you need to drop out. We don't need more shitty programmers.
>>674442518
I know I'm fucking terrible lol I took the class to see if it was anything near what I want to do
Missing "}" closing bracket on line 109 (if you uncommented it - that might be why)
>>674442357
got that to work. did you notice how it jumps right to 10 points? I'm working on that now.
>>674442518
>>674442740
kek, programming doesn't make sense until you are trying to solve problems that you found on your own. Pong is bullshit, but pick a side project and see how far you can get.
Try writing a text based game like a Drug Lord clone.
There are a bunch of shitty programmers, but they still earn 60k+ per year in entry level java positions.
>>674442863
If it jumps to 10 points (you stop the game at 10 points) it is because of if (b.getY() < 0) or might be if (b.getY() > getFieldHeight())
>>674442863
You probably just need to reset the ball position when that happens. The ball collides with the side and keeps going, meaning you keep scoring (10 times in a row).
Reset the ball position with the paddles and you should be good.
>>674434482
>>>/g/dpt
You are more likely to find people who can program there
>>674442740
I used to teach Java programming in college at a top 10 school. And I can say that you are catching on much faster than some of those students. I pretty much had to write their code for them.
>>674443367
Nah those faggots just keep spamming install gentoo and muh mechanical keyboard
>>674443367
haha fuck /g/
a bunch of burnt out gamers that think they are awesome for dual booting some vanilla linux distro
>>674443660
at the risk of sounding like a fag, you gotta try a mechanical keyboard if you haven't yet.
It really did increase my productivity. My coworkers hate it though.
>>674443169
are you running the game? how does it look for you now
>>674443993
Nah haven't compiled, I can try if you insist although I just finished a shitty Java coursework for uni last friday and feel wounded.
java is the most used language, for anyone saying "OH C AND C++ ARE THE BETTER ONES *nose snort*", get a fucking life
>>674443993
No, I am just reading through the code online.
Running it on the error prone brainpiler
>>674444175
if you don't mind, lol. I fucked up the bottom wall again. trying to fix atm
if you can get it to work and put it on pastebin that would be sick
>>674444870
>write my code for me
>I don't feel like figuring it out.
System.out.println( somethingIThinkIsBroken ); works wonders.
Stick it out and debug that fucker. That is the only way to learn.
>>674445096
hahah aight m80. thanks for the help
Listen to jesus
>>674445096
When I compile the game seems super fast (paddles super sensitive, ball flies off).
What program do you use to work with the code?
I'm >>674444175 btw
>>674434482
>java
There's your problem
>>674437104
>2014 + 2
>not using C++ for Android development
>>674445465
If it makes you feel better, I still use println statements everywhere while programming and make 160k+ per year in the valley doing Java programming.
Debugging sucks, but you start learning where to look to find mistakes faster. No code is bug free.
I use Eclipse but a lot of people like IntelliJ. Specifically, I use Spring Tool Suite
>>674445865
>>674437621
Scala != Java
Spring sucks massive cocks
Wtf is play
>>674435555
wew, no.
>>674446483
lost
top kek
>>674446483
fucken lost
>>674446308
I like eclipse though I'm using DrJava right now
>>674434482
>java
>programming
Pick one.
>>674446388
I see that you are not a Java/Scala programmer.
Scala can leverages existing Java libraries
Pivotal has a bunch of libraries, many of which are used in enterprise Java. Spring Security is one of the most used.
Play is a web application framework that glues together a bunch of common/popular libraries. It can be used with Java or Scala. https://www.playframework.com/
>>674446776
>>674446909
>>674437621
Things that run on the JVM, which, as others have noted more or less, is not Java.
>>674447187
kek, hate on the only truly cross platform language.
>I like building different versions of my application for every OS and CPU architecture!
>Nah, that is too much trouble
>I will just leave vague "build instructions" for my users to build their own
>>674447452
>>674447452
nice thumbnail faggot
>>674444181
Java sucks. You want a fast language? Use C++/Golang. You want a simple language? Use ruby/node. Even c++, a real, compiled language, has type inferencing. Jesus fucking christ oracle are cock guzzling faggots
Why are the paddles set to speed of light ... or did I fuck up?
>the year twenty sixteen of our lord
>not being a react+node/go developer
lmao
>>674447617
>what is Golang + gox
>what is every other interpreted language ever
>>674447818
You need to set a fixed framerate faggot because you obviously don't know how to use clocks
>>674447235
So I would have to write Java or Scala? Pass
>>674448281
nigga I ain't got time for shit like that
>>674447818
You need to add some kind of timer to delay the execution of the act() method.
new Timer(1, new ActionListener() { ...
That 1 there stands for 1ms delay. Make that 100 or something
>>674448067
>>not being a react+node/go developer
Any year.
Not being a trendy langfaggot.
It's only numbskulls who focus on language as being a measure of their talent. I can instantly recognize a real programmer in conversation, because they talk about what's actually important.
>>674448405
What do you use for programming?
Care to share your github so I can see how well you code?
>>674447818
mine are fast as fuck too... they were fine on the school computer lol
>>674446144
Alright what's this? I wann 2 pray
>>674448441
just use a sleep of 16 ms at the end of your game loop to get 60 fps
>>674434482
Java is for faggots. Use C or C++.
>>674448968
I don't think it's his choice what language he has to do at whatever school he's at ...
>>674434554
/thread
>>674434482
Ok here i go
If "Op" = "Fag"
Print "Indeed"
Else
Print "Op is still a fag"
>>674448652
I wouldn't share an personally identifiable information on /b/ because I'm not a fucking idiot.
I use a range of different languages. Right now for this job:
Node
Ruby
Golang
C#
Elixr
Previously:
C++
Python
Delphi - which sucks massive cocks
>>674449388
wow l2java pls
>>674434482
#include <iostream>
using namespace std;
int main(){
cout>>"Java is a fucking joke learn a real language";
return 0;
}
for (int nigger = 0; nigger >= 0; nigger++) {
System.out.print("nigger" + nigger);
}
>>674449736
Dude, I am super fucking sorry about C#. That is probably the legacy enterprise bullshit. And Node/Ruby does all the actual work.
You in web dev or other industry?
>>674450097
kek, how is sophmore year in college?
Since you are using a real language, what is your rating on topcoder? Higher than 1500?
Bump
>>674446483
They should plug in the tool, she would cry like a little girl and never return
Women at work area fucking joke
>>674451371
Where are you from anon?
>>674450339
They call me "devops", Web oriented but still do core stuff.
.NET legacy, node apps going forward. C# is alright tbh, as a language, just a shame it's pinned to winblows because mono/core sucks. That and fuck IIS
OP HERE
the score keeps jumping to fucking 10 points and ending the game.
help
>>674451640
Delete system32
>>674451474
Does it matter, anon?
>>674451640
>eicFDq0F
did you uncomment the code in Pong.java? Can you post a new pastebin ?
>>674451640
A little tip, add some System.out.print(add variables); before and after you call methods
In the finished product you delete them
Then you will find the error on your own . . . maybe
>>674440702
>>674440874
Do you even --no-preserve-root ?
>>674451640
And arent the paddles on both sides of the game? Shouldn't the points be calculated when b hits a certain x-coordinate?
b.getX() < 0
b.getX() > getFieldWidth()
?
>>674451371
It's a stock photo. Don't blame her, she's just a model. Blame whatever doofus was behind the camera.
>>674446360
>>674452732
Fuck root