Java Game - 3D Space / Camera Positioning

Jan 4, 2014

1: 3D space. How do i define the space where i will make my world? Is there a certain point that i will define as 0,0,0 or is there some other way.

2: Camera positioning. When i have the 3D space, how to i make it so that the camera will show that what i want it to show. Lets say il define its lokatios 30,50,100 and direction is NW, then how to i make it so that is see the SW direction from the point 30,50,100?

View Replies


ADVERTISEMENT

Alien Movement In Space Invaders Game

Apr 13, 2014

I'm working on this space invaders game and I've been stuck trying to get the alien spaceships to move down in one group. The way we have to design the game is we have to implement at least these 3 classes. These classes are GameData,GamePanel, and Animator. GameData is all the action figures/models in the game. GamePanel draws all game action figures/ models on the screen. Animator updates periodicaly action figures positions,sizes, colors etc. I can get the aliens to move right but once they hit the end of the canvas I cannot figure out how to get them to move as a group down and then begin moving left. I tried to add alien objects to the GameFigures list and then have the update method in the Alien class be responsible for moving the alien ships, but I couldn't figure out how to make it work. So then I made an alienFigures list in the GameData class and I still cannot figure out what to do. Here is the GameData class

import java.util.List;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;

[code]....

View Replies View Related

Create 2D Game That Has Realistic Space Simulation

Jul 31, 2014

I am attempting to create a 2d game that has a realistic space simulation. The map is supposed to be set so that you are looking from the top down. The problem I am having exists in my interaction between the sun and a planet. Simply put, the planet will only move in a single diagonal direction without ever changing direction. The formulas I am using are F=(G*M1*M2)/D^2 and A=F/M. The code below is simplified.

(inside planet Class)
double x;
double y;
double mass;
double xForce;
double yForce;
double xAccel;
double yAccel;

[Code] ....

Things I have already tried:
1. Setting G to negative
2. changing the order of the subtraction in determining D
3. some weird pythagorean theorem thing someone suggested

View Replies View Related

Space Invaders Game - Collision Detection

Apr 19, 2014

I'm working on a space invaders game and I'm having problems with collision detection. My main issue is I'm having problems getting what the y value of the "missile" is as it goes up towards the top of the game. I have tried for many hours and tried to look at other people's space invaders game in an attempt to figure out how to figure out my problem. Also I'm not sure if I have the code for my collision detection in the correct spot. Right now I have the code in the keyPressed method. Below is the code for the main and missle classes ...

import java.awt.Color;
import java.awt.Container;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.util.ArrayList;
import java.util.Iterator;

[Code] ....

View Replies View Related

Java Syntax - Insert Space Between Int And Statement

Feb 26, 2015

How do I insert space between my int and the statement?

My out put it is: A heptagon has7 sides .

what I want is: A heptagon has 7 sides .

public class Geomerty {
public static void main(String[] args) {
int sides = 7;
System.out.println( "A heptagon has" + sides + " sides ." );
}
}

View Replies View Related

Facing OutOfMemory Java Heap Space Error

Jun 21, 2014

I am not a java developer, but I am using a java code that was available online to convert a large XML file to CSV file. The input file size is big, it is around 3GB. I got an error that it is out of memory, it is expectedly due to the large input file that i am trying to convert. Splitting of this file is not possible,

This is what I ran : xml2csv-conv data.xml data.csv

Error:

Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
at com.sun.org.apache.xerces.internal.dom.DeferredDoc umentImpl.createChunk(Unknown Source)
at com.sun.org.apache.xerces.internal.dom.DeferredDoc umentImpl.ensureCapacity(Unknown Source)
at com.sun.org.apache.xerces.internal.dom.DeferredDoc umentImpl.createNode(Unknown Source)
at com.sun.org.apache.xerces.internal.dom.DeferredDoc umentImpl.createDeferredTextNode(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.Abstrac tDOMParser.character

[code]....

Additional information: I am running this from a Windows8 64 bit machine with 8GB physical RAM.

View Replies View Related

Locking The Camera On Character?

Mar 2, 2015

I finally made the app to draw 10x10 map out of 50x50 pixel blocks.Now I can't imagine how to make a camera and lock it on character. I know how to make a character, but I just want to understand how locking the camera on character would look.

package tiled;
 import org.newdawn.slick.*;
import org.newdawn.slick.state.*;
 public class play extends BasicGameState {
  int xSize = 10;
int ySize = 10;

[code]....

View Replies View Related

Face Detection On Camera?

Sep 3, 2014

I want to do face detection on the camera.

View Replies View Related

How To Track Player Positioning

Nov 25, 2014

So I have a player an enemy and enemy bounds the enemy can go. I need to have the enemy track my position and when I go into the position (I am using a collision method for this) the enemy comes over at a speed of 1. My problem is the enemy jumps to me and then follows at speed of 2 (2 is the player speed). The code is wrong this is why it is jumping and I have my other problems. so my question is what is a good solution for this? I am trying to make a method to track playerposition() so what I am thinking I could do is find x, y of player then store those into an array and return the array to Enemy so he tracks.

player.java
public class Player{
int x = 100; // Location of player
int y = 200; // location of player
int xa = 0; // Representation of where the player goes
int ya = 0; // Representation of where the player goes
private int speed = 2;

[Code] .....

Please note this is not the entire code I have cut some things out that did not need to be there. Also, the code is just to get an idea of what I was thinking of doing. The ideas that are came up with are not meant to be a reflection of what I already have but, what I could add or replace.

View Replies View Related

JButton Positioning On Bottom

May 20, 2014

import java.awt.GridLayout;
import javax.swing.*;
 public class Screen
{
JButton start;
JButton reset;
JButton box[][] = new JButton[20][20];
Screen()

[Code] ....

I am trying to place the buttons on the bottom. I tried a few different things but the grid layout keeps grabbing it and making them a part of the grid at the button.

View Replies View Related

Swing/AWT/SWT :: Curser Invisibility And Positioning

Jan 20, 2014

Is there a simple way to hide the mouse cursor?

Also, the e.getX()/Y() methods in my mouse listeners always spit out the position of the mouse relative to window instead of the entire screen. Is there a way to flip that or at least a way to track the movement of my window on my screen? Another acceptable fix for me would be to have my Robot object's mouseMouse(x,y) method move my mouse to a position (x,y) relative to the window instead of the entire screen.

View Replies View Related

JButton Positioning - Grid Layout

May 20, 2014

Java Code:

import java.awt.GridLayout;
import javax.swing.*;
public class Screen
{
JButton start;
JButton reset;
JButton box[][] = new JButton[20][20];

[Code] ....

I am trying to place the buttons on the bottom. I tried a few different things but the grid layout keeps grabbing it and making them a part of the grid at the button.

View Replies View Related

Create Application Which Detect Image Taken From Camera

Apr 7, 2015

I am new to java and i want to create an application which detect an image which took from camera and to process it so that it can be verified ..for example number plate of the vehicle ..if i need to extract the numbers from the image ..

View Replies View Related

How To Have A Camera View On A Bigger Image Than Screen

Apr 8, 2014

Where can I find tutorials about how you like have a big image, bigger than the specified screen, for the map of a game, and then you have camera view, the image is being printed on the screen continously as the character moves in different areas depending on what area of the map the character is in?

NOTE!!! I don't want to move objects around, I just want a camera view on a large image!

View Replies View Related

How To Get Stream Of Data From DVR And Control CCTV Camera

Jul 26, 2014

I am going to to develop an app for my final year project. basically the app is to show live video streaming on android phone from remote CCTV . The project is just in design phase i know the networking part i.e static ip for dvr etc but i dnt know how to get stream of data from dvr and how to control the CCTV camera i.e camera movement....

View Replies View Related

Swing/AWT/SWT :: Using Doubles For Positioning Objects And Testing Equality

Aug 15, 2014

I've been noticing some of my programs have been a little buggy recently, and think it's down to confusion over doubles and positioning. Lets say I have a label called banner that I want to scroll across the screen. Now I need to know the label's width in order to position it, but the width depends on the amount of text, so i use this code:

double bannerWidth = banner.getWidth();

Which forces me into using a double if I want to be accurate.

But the problem is that I'm trying to use a condition that compares the label's horizontal position (currentX) to the left edge of the screen (LEFT_EDGE), minus the width of the label (bannerWidth). In other words when the label is off the screen, it should go back to its starting position.

I assume that means that any variables I use to track the label's position (in this case currentX), or constants that I use to check equality (LEFT_EDGE), have to be doubles as well?

My difficulty is that I iterate currentX. But currentX--; won't work because doubles don't iterate as I'd expect.

So casting becomes an option..... but if I cast to an integer I effectively lose width on the label. And that is magnified each loop, resulting in the label's starting position moving further and further to the left.

View Replies View Related

Swing/AWT/SWT :: Positioning Slider Of Vertical Scrollbar Not Working

Apr 4, 2014

I have written a drum machine using Java. Into said drum machine I list all 47 available MIDI drums. The instrument list is placed into a JPanel, along with a gridArray of checkboxes. The JPanel is then in turn added to a scrollpane. I have listed the MIDI drums in order of 'ground-up'. For example, the bass drum is generally at the bottom of most drum kits, so it is at the bottom of my MIDI drums list. Next up would be the snare, followed by the cymbals, and then by all the specialty percussives. Since most beats are started from the 'ground-up', laying to foundation, so to speak, I want the scroll bar of the scrollpane which houses the JPanel, which in turn houses the instrument list and the beat checkboxes, to be positioned, upon opening, at the bottom of the scroll pane. Nothing I have tried works. It always positions the slider somewhere in the middle of the scroll track. Below is a listing of just the buildGUI portion of the code, all the MIDI functionality has been removed to keep the size of the post to this forum down.

import java.awt.*;
import javax.swing.*;
import java.util.*;

public class BeatBoxG
{
JFrame overallOuterFrame;
JScrollPane namesAndSquares;

[code]....

View Replies View Related

Live Video Streaming From CCTV Camera In Application?

Dec 26, 2013

I am developing some application in Java. The need is to continuously do a video streaming in the software. I am new to this and want to know how to do it.

View Replies View Related

Developing UNO Game In Java

May 11, 2014

I am new to java, i can develop basic java programs but am not really good at it. How should i pursue and how should i start. I know the game rules.Do i need to learn swings for the same?

View Replies View Related

Developing UNO Game In Java?

May 11, 2014

i can develop basic java programs but am not really good at it.I have been given this assignment of developing UNO game in java and have been given 10 days. How should i pursue and how should i start.I know the game rules.Do i need to learn swings for the same?

View Replies View Related

Java Game Creation

Jan 26, 2015

I am creating a simple tiled minecraft like game in java, but i dont know how to make the game loop.Here is the source:

package net.pltformgame.main;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import javax.swing.JFrame;
public class main extends JFrame implements KeyListener {

[code]...

I really dont know how i make the jump or the game loop.

View Replies View Related

Java Game Health

Jan 20, 2015

I'm building this custom project in stages, and I'm having difficulty getting the health of the player and the enemy to change. Upon compiling, I'll select weapon 1, then choose action 1 (basic attack), and the health of both the player and the enemy will stay at 15 and 10.There are no errors when compiling.

import java.util.Scanner;
public class CustomProject
{
public static void main(String[]args) {
Scanner sc = new Scanner(System.in);
it hp = 0;
int potionsleft = 0;
int choice1 = 0;
int weapon = 0;
int enemy1hp = 10;
//int newenemy1hp = 0;

[code]....

View Replies View Related

Java Matching Game

Apr 14, 2015

I'm working on a Java matching game and I'm having a hard time wrapping my mind around it. What I'm having trouble with is how exactly to create an array so that my squares have random values. Then how do I get it to reveal and compare those values by clicking on two of them? Here is what I have so far:

import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;

[code]....

View Replies View Related

Coding AI Game Through Java

Apr 10, 2015

The game has two players: x and o. The players take alternate turns, with player x moving first at the beginning of each game.

Player x starts at position (1,1) while o starts at (8,8).

Each turn, a player can move like a queen in chess (in any of the eight directions) as long as her path does not cross a square already filled in or occupied. After moving, the space vacated by the player is designated as filled and cannot be moved to again. Notice that only the space that was occupied is filled, not the entire path.

The game ends when one player can no longer move, leaving the other player as the winner.

The coordinate (1 1) indicates the top left hand side of the board.

The board is specified as a list of rows. Each row is a list of entries:

- is an empty square * is a filled in square x is the current position of the x player o is the current position of the o player

The board will always be 8 by 8.

Your player function should take in the parameters as described above and return a move as a list in the format (row column) within 1 minute. If you cannot move, return (nil nil). The Tournament Referees will check for this. If you return an illegal move, the other player (and the Tournament Referees) will detect it and you will lose.

Additionally if your time expires you will lose.

View Replies View Related

Tiled Based Map Game In Java

May 10, 2014

I'm trying to create a tile based map JPanel but all I get is a white screen. I'm fairly new to the Java Swing and AWT package so I've been watching tutorials on YouTube so learn as much as I can.

I've got three classes: Window.java which includes the Main method, Panel.java which is the JPanel and Tile.java to draw all the images into an array.

Window.java:

import javax.swing.JFrame;
public class Window extends JFrame {
public Window() {
setTitle("Project");
setSize(500, 400);

[Code] .....

I've checked through everything and still cannot find what I'm doing wrong. I did try different codes but I just got errors instead.

View Replies View Related

How To Improve Battleship Game Java

Dec 3, 2014

I have an battleship program that I would like to improve in performance. I know that using certain algorithms it can be improve however I am beginner in Java. I would like any recommendations and or hint in how to improve this game. The are 5 ships per game and the computers plays 10000. I just want to sink all ships in as many shots as possible.

Main class

package solution;
import battleship.BattleShip;
import java.awt.Point;
import java.util.List;

[Code] .....

View Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved