Bullets Are Not Showing Up Across Network Client Screen In Game
Apr 11, 2014
Tank war game thats ran over a network and is multiplayer, however whenever I fire a bullet it shows on my screen but not the other player's screen. Here's the code:
import java.awt.*;
import java.awt.event.*;
import java.awt.geom.*;
import javax.swing.*;
import java.util.*;
import java.net.*;
import java.io.*;
[Code] ....
View Replies
ADVERTISEMENT
Apr 13, 2014
Tank war game thats ran over a network and is multiplayer, however whenever I fire a bullet it shows on my screen but not the other player's screen. Here's a snippet of code form where i think the problem is coming from:
class Tank implements Ball {
double locX, locY, radius, angle;
int self; // index of this tank in WarPanel.tanks
public boolean turnL, turnR, forth, back, fire;
boolean prevtL, prevtR, prevfo;
Color color;
[Code] ....
View Replies
View Related
Apr 10, 2014
I have a program thats ran over a network and is multi-player. However whenever I fire any bullets they do not fire on the other clients screen. Here's the code
import java.awt.*;
import java.awt.event.*;
import java.awt.geom.*;
import javax.swing.*;
import java.util.*;
public class TankWar {
[Code] ....
View Replies
View Related
Jan 20, 2015
public void paint(Graphics g) {
g.drawImage(Background, bg1.getbX(), bg1.getbY(), this);
for(int i=0;i==400;i+=10){
g.drawImage(block1,fg1.getBlockX(),fg1.getBlockY(),this);
g.drawImage(block2,fg1.getBlockX(),fg1.getBlockY()+10,this);
}
}
This is what im dealing with right now. When i click run i only get the background image showing the other two are not showing on the screen.
View Replies
View Related
Mar 16, 2015
I'm making a game of checkers for my A2 Computing coursework which is due in within a week. I have completely finished the game, and only thing I have left to do is connect the two JPanels together via a CardLayout that I have made. However I am unsure how to do so
Here is the code from my CardLayout:
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import javax.swing.JButton;
[Code] ....
I have kept the code I am displaying to a minimal, hence I have removed all the action listeners for my buttons, anyway the problem I have is that, I would like it so that when the user clicks on the 'Multiplayer' button which is the array button ourButtons[1], it will then transition into my main game screen so that the user can then play a game of checkers.
Here is the main important GUI from my CheckerBoard class:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class CheckerBoard extends JPanel implements ActionListener, MouseListener {
// Main routine that opens an Applet that shows a CheckerBoard
public static void main(String[] args) {
new CLayout();
[Code] ....
Once again kept to a minimal.
View Replies
View Related
Jul 22, 2014
.
.
.
RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/MyServletPDF?username=TEST");
response.setContentType("application/pdf");
dispatcher.include(request,response);
%>
While debugging everything is going through... even it passes through the last line. But the pdf is not launching... showing only a blank screen in its status bar as "Connecting"... Earlier it was launching.. but suddenly this issue is raising up. Is there any IE settings need to be checked?
View Replies
View Related
Apr 11, 2014
I am currently making a 5 card stud game for my Java Programming class at my highschool. I am deciding to go a little above expectations and make my poker game a little more fun than just comparing a few cards. However I want there to be text that is changing on my screen, but the repaint() is not the most reliable way to make the screen update, I am wanting a way for have the program constantly update the screen so that if I do something like someLabel.setText("Text"); then the text will update automatically whenever it is changed.
Here is my declarations and main/constructor method
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.util.Random;
public class FiveCard extends JFrame implements ActionListener {
[Code] .....
Here is the method addMainPage, which is called in the constructor. Whenever the enterButton is pressed, the actionListener directs it to loadBoard();
I use GridBag Layout, so to skip through all of the constraints
public void addMainPage() {
for (int i = 0; i < 4; i++) {
players[i] = new Player();
}
Icon cardBackImage = new ImageIcon("back.gif");
[Code] .....
Game intro is a method that changes the text of a label every second using .setText(), however it does not work because the enterButton is pressed, then after loadBoard() and gameIntro() is ran, it repaints the frame with the board objects and the gameIntro's final .setText() command.The action listener is simple...
public void actionPerformed(ActionEvent e) {
if (e.getSource() == enterButton) {
players[0].setName(playerNameField.getText());
loadBoard();
}
p.repaint();
}
View Replies
View Related
Jan 14, 2014
I am making a game with java in a program called greenfoot.My problem is that a sound won't play when the player dies and a Game Over screen pops up..
- I have saved the audio file in my sound map of the scenario
- Applied the good name of the file
- tested the sound effect and it's working
this is my code:
public GameOver()
{
setImage(new GreenfootImage("GAME OVER", 100, Color.BLACK, null));
Greenfoot.playSound("fail-trombone-03.wav");
Greenfoot.stop();
}
View Replies
View Related
Jun 4, 2014
This is code for a game I am making where you are a character at the bottom of the screen dodging falling rocks. I was wondering how to add in the falling rocks. I think I need to use Timer and an ArrayList but I am not sure if that would work and not truly sure how to go about doing it.
import java.applet.Applet;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.awt.event.MouseListener;
import javax.imageio.ImageIO;
[Code] .....
View Replies
View Related
Jan 23, 2015
I have tried each and every thing in all the other answers. Like setting chunked to false, changing parameters, changing http1.1 -1.0. I am just writing a sample client to compare it with my real time client. Following is the code of client:
package com.webservicemart.ws;
import java.rmi.RemoteException;
import org.apache.axis2.AxisFault;
import com.webservicemart.ws.USZipStub.ValidateZip;
public class UsZipClient {
public static void main(String[] args) {
[Code] ....
And Following is the error :
[INFO] Unable to sendViaPost to url[http://www.webservicemart.com/uszip.asmx]
org.apache.axis2.AxisFault: Transport error: 404 Error: Not Found
at org.apache.axis2.transport.http.HTTPSender.handleResponse(HTTPSender.java:310)
at org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:194)
at org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:75)
[Code] ....
I have tried with other geoIP service and weather forecast too. I get the same error.
View Replies
View Related
Dec 6, 2014
I have all of my code written, but it is not producing any output and i'm not sure why.
import java.io.BufferedInputStream;
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.File;
[code]...
View Replies
View Related
Apr 16, 2015
I want to make a service like Spotify, where I can stream music that I have stored on my computer (in this case server) to my laptop or phone.
* What would be a suitable format for this?
* How would I actually stream it? I want to stream, not download and then play, I want to play the music while downloading.
View Replies
View Related
May 7, 2014
This question has confused me because "Errors" are capitalized and I'm not sure what they mean.
To me this question is false. Sockets can be used to transfers file over a network.
I can't see why this wouldn't work. The code looks fine to me.
I don't think this is true unless you're using the mouseEntered() or mouseExited() method. But again, I'm not sure.
I think this is true, I don't know what else could have listeners.
They're only worth a few marks each so the answer is only suppose to be a line or two. They are all true or false questions that require an explanation.
View Replies
View Related
Jun 1, 2014
I am trying to develop an application which will be showing a TimeSeries graph(related library JFreeChart) displaying network activity related to a particular network interface embedded in a JFrame.I have created a JPopUpMenu which is having containing a list of JMenuItems showing network interfaces as their String values.Menu is popping up correctly
Further I am selecting a JMenuItem related to a particular network interface to show network activity in TimeSeries graph.On selecting a JMenuItem I can see that graph is moving on constantly but not able to see any network activity.
Pasted the code below :
package com.ankit.analyser;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.EventQueue;
import java.awt.FlowLayout;
import java.awt.Window;
import javax.swing.JFrame;
[Code] .....
Further I can see that packetArrived method of PacketListener is not being overridden by class PacketHandler as I am not able to see data packets on console and static list in main class is also empty.
View Replies
View Related
Jan 9, 2015
I am learning few concepts in servlets. And i came across this doubt. We used to send data over network using httpsession as below.
HttpSession session = request.getSession();
Object obj = new Object();
session.setAttribute("object", obj);
And get the data in JSP with below code
<%= session.getAttribute("object")%>
However I am not sure whether HTTPSession is serializable or not.
How HTTPSession works?
View Replies
View Related
May 31, 2014
Suppose you are given a computer with 1GB RAM. The disk of this computer holds a 10GB file containing random numbers. Propose a technique for sorting the file without using the disk or network or virtual memory. Outline your approach, propose an algorithm, and implement the algorithm. What is the algorithmic complexity of your algorithm.
View Replies
View Related
Jan 13, 2014
I am new to java. I want to create a socket that can serve all the network protocols. Can we make such type of socket in java.
View Replies
View Related
Apr 16, 2014
I got my first project in which i need to receive some data from multiple client on network regularly(say every second) and then process that data and stored it to the database and then GUI needs to be created which display data accordingly.
While thinking for the design i thought blocking queue to implement the same. Like producer receive data from the port into a string builder and put that into the LinkedBlockingQueue. Consumer will take this data , process some work on it and store it into the database.I am using sybase ase 15 as a database.
My question is as i am receiving data very frequently which require insertion , updation and search almost every second into the database. What is the best way to improve the performance.
say i have 2 types of data is coming one having keyword 'Alarm' and other having 'ceased' so i need to use something like this
common fields in both is name and number.
if (ceased)
search into the database for particular event for which this ceased receive using name and numbe rand update the another field into it Also make separate entry for it
else
make a entry
Also as i am using 2-3 thread for consumers and thread = Number of client for the producer. So i thought to use synchronization at the consumer side which writes data into the database such that only 1 thread can write it.
View Replies
View Related
Sep 4, 2014
I have downloaded jns-1.7 & tried to run an example program "Simulator.java" by specifing the jar classpath while compiling as "javac -cp <path-to-jns-jar-file> Simulator.java". But i got 21 errors as follows:
Simulator.java:3: error: package jns.command does not exist
import jns.command.Command;
^
Simulator.java:4: error: package jns.element does not exist
import jns.element.Element;
[Code] ...
21 errors
I am trying my hand on JNS as i need to deveop a key-distribution scheme (random Key-Distribution scheme) using a simulator. As i have experience in java, i thought to use JNS instead of NS2/NS3 which seems very complex to me.
View Replies
View Related
Apr 15, 2015
I'm working in project, my theme is to develop an application management system for fingerprint and RFID card attendance machine in java programming language.
My problem i didn't find documentation in java for connecting with this device.
View Replies
View Related
Apr 4, 2014
The first 4 class below are the main classes while the last class is the testing class. I got it all to compile but for whatever reason there are several runtime errors. I have spent hours trying to figure out what they are, but I was only able to eliminate a few.
import java.util.*;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Set;
import java.lang.*;
public class PhoneNetwork {
[Code] .....
View Replies
View Related
Sep 21, 2014
I have a program that records and reruns network traffic. It was developed in C and runs in my case under Windows 7 Professional but will run almost anywhere. I have observed a lack of stability.
First I have a JAVA stand alone GUI program that runs the program as follows:
g11_bttn_start_script_capture.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
URI uri = null;
URL url = null;
String tempstr = "";
tempstr = "-s " + g11_txt_PATH_portnumber.getText() + " " + g11_txt_scriptname.getText() + ".both";
[Code] ....
Basically it launches the executable t3drive, hangs arounf so it gets a chance to start, and then connect to it via the embedded browser.
It frequently works, sometimes launches in the browser but then freezes, and sometimes fails to start at all.
t3drive works 100% of the time if I run it under cygwin and I can reliably connect to it using any browser.
Why this might not be stable? Just looking for a direction of what to try next.
View Replies
View Related
Jan 24, 2015
Yesterday, I established a connection with oracle 12c, codes is here:
ods.setURL("jdbc:oracle:thin:c##mytest/myt@//myhost:1521/orcl");Connection conn=ods.getConnection();
where "c##mytest/myt" is username and password. It worked well.
But, today, "IO Error:The Network Adapter could not establish the connection" appeared when I tried to run my program again.
I changed //myhost into 127.0.0.1, it worked again.(Before I did this, I checked lsnrctl and regedit and firewall....., no difference)
Here is my question:
1) What happens between //myhost to 127.0.0.1, hostname cannot be use to JDBC? If yes, how?
Besides, I have some other questions:
2) How import a *.dmp file which exported from 10g into 12c?
3)If I need upgrade 10g to 12c, what shall I do?
View Replies
View Related
May 17, 2013
I ma trying to implement Java "watchService". I am unable to register network mounted drive path. Is there any solution for this.
Path ftpFolder = Paths.get("H:/Ftp/Incoming/");
where H is mounted Drive.
View Replies
View Related
Jan 19, 2015
I want lo list all the devices connected to my network, I done like this
InetAddress i = InetAddress.getLocalHost();
byte[] ip1 = i.getAddress();
InetAddress address = InetAddress.getByAddress(ip1);
for (int b = 0; b <255;b++) {
ip1[3] = (byte)b;
[Code] ....
It prints all the connected devices, its k.. my doubt is, how to list the wired connections and wireless connections from them...
View Replies
View Related
Jan 30, 2014
I am trying to connect a remote machine but I can't. There is a shared folder in the remote machine, when I write the path to file browser in local machine, it does not find the path specified. Both machines have successful network condition and ping each other. Also, the shared folder is opened to everyone, there should not be a permission problem, right?
View Replies
View Related