Author Topic: Me and edman are making a game ! -Need a few coders experienced in java  (Read 5962 times)

I'm not too sure how I would implicate shading if I only use black, gray/grey, and light gray/grey for the metal walls

I'm not too sure how I would implicate shading if I only use black, gray/grey, and light gray/grey for the metal walls
Use a darker form of grey as you get farther from the original perception of light.

Use a darker form of grey as you get farther from the original perception of light.
alright, will do

Don't use only 3 colors. It looks like garbage.

Also, I downloaded Eclipse to try and figure this out.

http://www.javaprogrammingforums.com/whats-wrong-my-code/5607-moving-image-around-screen-using-arrow-keys.html

I used that to get it working. You should look into it.

Don't use only 3 colors. It looks like garbage.

Also, I downloaded Eclipse to try and figure this out.

http://www.javaprogrammingforums.com/whats-wrong-my-code/5607-moving-image-around-screen-using-arrow-keys.html

I used that to get it working. You should look into it.

The reason we dislike you is because you are criticizing us without any help whatsoever, do I tell you "HEH UR JAVER R GHEY."?

That link was a Java-related link for Edman/Ike.

That link was a Java-related link for Edman/Ike.

I assume that since you have been attacking us for the past day.


so something like this that shows shading would be good to use as a color pallete or something?

Code: [Select]
import java.awt.Canvas;
import java.awt.Dimension;
import java.awt.Graphics2D;
import java.awt.image.BufferStrategy;
import java.awt.event.*;
import javax.swing.*;

public class Main implements Runnable {

    JFrame frame;
    int myX = 400;
    int myY = 400;
    Canvas canvas;
    BufferStrategy bufferStrategy;
    boolean running = true;

    public Main() {
        frame = new JFrame("Basic Game");
        JPanel panel = (JPanel) frame.getContentPane();
        panel.setPreferredSize(new Dimension(500, 500));
        panel.setLayout(null);
        canvas = new Canvas();
        canvas.setBounds(0, 0, 500, 500);
        canvas.setIgnoreRepaint(true);
        panel.add(canvas);
        canvas.addKeyListener(new KeyAdapter() {
            @Override
            public void keyPressed(KeyEvent evt) {
                moveIt(evt);
            }
        });
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.pack();
        frame.setResizable(false);
        frame.setVisible(true);
        canvas.createBufferStrategy(2);
        bufferStrategy = canvas.getBufferStrategy();
        canvas.requestFocus();
    }
    public void run() {
        while (running = true) {
            Paint();
            try {
                Thread.sleep(25);
            } catch (InterruptedException e) {
            }
        }
    }
    public static void main(String[] args) {
        Main ex = new Main();
        new Thread(ex).start();
    }
    public void Paint() {
        Graphics2D g = (Graphics2D) bufferStrategy.getDrawGraphics();
        g.clearRect(0, 0, 500, 500);
        Paint(g);
        bufferStrategy.show();
    }

    protected void Paint(Graphics2D g) {
        g.fillOval(myX, myY, 30, 30);
    }
    public void moveIt(KeyEvent evt) {
     switch (evt.getKeyCode()) {
            case KeyEvent.VK_DOWN:
                myY += 5;
                break;
            case KeyEvent.VK_UP:
                myY -= 5;
                break;
            case KeyEvent.VK_LEFT:
                myX -= 5;
                break;
            case KeyEvent.VK_RIGHT:
                myX += 5;
                break;
        }
       
     
       
    }
}

Ok, here's something that most definently works. To make it so you move continuously while holding the arrow keys, you can do it as long as the key is held down, or you can add on to the X/Y every time it redraws the screen.


so something like this that shows shading would be good to use as a color pallete or something?

Perfect! that would make a good background tile in castles.



Pretty basic sword, I need a larger pallet though to get anything fancy.



Leonidas' Sword.



Generic sword.
« Last Edit: December 13, 2011, 09:16:35 PM by Thompson »

I have some experience in Java.
I'd be glad to help however I can.

I have some experience in Java.
I'd be glad to help however I can.

Java, or javascript?

Java, or javascript?
Java.
However, all my experience is from a class, not from real-world stuff.

for forgets sake people you don't need every goddamn import in the swing library