Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (513)
Games in Android Showcase (120)
games submitted by our members
Games in WIP (577)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
   Home   Help   Search   Login   Register   
  Show Posts
Pages: [1]
1  Game Development / Newbie & Debugging Questions / Re: Moving Player on: 2010-01-21 03:32:06
ok i figured it out but now im a bit confused.

heres my code to rotate

1  
2  
3  
4  
5  
6  
7  
public void rotatePlayer(Graphics g)
   {
      Graphics2D g2 = (Graphics2D) g;

       g2.translate(60, 45);
       g2.rotate(45.0 * Math.PI / 180.0);
   }


my question is what do i past to 'g' when i call upon 'rotatePlayer'
2  Game Development / Newbie & Debugging Questions / Re: Moving Player on: 2010-01-21 03:17:04
ok i like that better for move the player but i want to know how to rotate the player.

so i can hold up and left and it will turn on a lets say 5 degree angle.

I found this for a rotate script but it doesnt rotate from the center point of the player.

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;

import javax.swing.JFrame;
import javax.swing.JPanel;

public class MainClass extends JPanel {

  public void paint(Graphics g) {

    g.fillRect(0, 0, 20, 20);

    Graphics2D g2 = (Graphics2D) g;

    g2.translate(50, 50);
    g2.rotate(30.0 * Math.PI / 180.0);

    g2.scale(2.0, 2.0);

    g.setColor(Color.red);

    g.fillRect(0, 0, 20, 20);

  }

  public static void main(String[] args) {
    JFrame frame = new JFrame();
    frame.getContentPane().add(new MainClass());

    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setSize(200, 200);
    frame.setVisible(true);
  }
}
3  Game Development / Newbie & Debugging Questions / Re: JFrame Issue on: 2010-01-21 00:45:17
The error i had to ignore is Forbidden Reference. Its must be a problem with Vista but im not sure
4  Game Development / Newbie & Debugging Questions / Moving Player on: 2010-01-21 00:27:21
I am making a simple shooter game in Java for my Computer Science Final.

Currently Players can only move up and down. I was wondering how i could get them to move freely in the window.

i was thinking i might have forward and backwards with rotation.

If there is a certain function i should use please give an example of how to use it for example for using the simple drawImage

1  
drawImage(image, xPosition, yPosition, width, height, null);


if it matters i use booleans to control player movement
5  Game Development / Newbie & Debugging Questions / Re: JFrame Issue on: 2010-01-18 21:36:49
I fixed it kind of. i just changed the rules to ignore those errors.
6  Game Development / Newbie & Debugging Questions / Re: JFrame Issue on: 2010-01-18 20:28:11
there is an error on the import line. it says Access Restriction. Im running windows vista if that has anything to do with it
7  Game Development / Newbie & Debugging Questions / JFrame Issue on: 2010-01-18 18:38:01
Im going through a video tutorial on making a simple 2D Game in Java. Im at the point where he want to JFrame but when i go to import it its not there in the list. is something extra i have to download. IM using eclipse as my editor.
8  Game Development / Newbie & Debugging Questions / Re: Tower Defense Game Tutorial on: 2010-01-13 22:27:46
thanx man
9  Game Development / Newbie & Debugging Questions / Re: Tower Defense Game Tutorial on: 2010-01-11 20:33:25
ok thanks man
10  Game Development / Newbie & Debugging Questions / Tower Defense Game Tutorial on: 2010-01-11 19:00:25
For my Computer Science class my teacher wants me to make a simple Tower Defense game. I was wandering if anyone knows of a tutorial on the basic of a TD Game in Java.
Pages: [1]
 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

Longarmx (52 views)
2014-10-17 03:59:02

Norakomi (43 views)
2014-10-16 15:22:06

Norakomi (33 views)
2014-10-16 15:20:20

lcass (37 views)
2014-10-15 16:18:58

TehJavaDev (68 views)
2014-10-14 00:39:48

TehJavaDev (66 views)
2014-10-14 00:35:47

TehJavaDev (60 views)
2014-10-14 00:32:37

BurntPizza (73 views)
2014-10-11 23:24:42

BurntPizza (45 views)
2014-10-11 23:10:45

BurntPizza (86 views)
2014-10-11 22:30:10
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!