Topic: FOR SALE Body Parts! Leg + Arm combo $450, Heads $400

Offline Pyromanik

  • Hero Member
  • Pyromanik is awe-inspiring!Pyromanik is awe-inspiring!Pyromanik is awe-inspiring!Pyromanik is awe-inspiring!Pyromanik is awe-inspiring!Pyromanik is awe-inspiring!Pyromanik is awe-inspiring!Pyromanik is awe-inspiring!Pyromanik is awe-inspiring!Pyromanik is awe-inspiring!Pyromanik is awe-inspiring!Pyromanik is awe-inspiring!
  • Posts: 28,834
Quote from: Bell;1510337
Why do you hate white-space :(

^

Tiwa plz.

Reply #25 Posted: November 29, 2012, 08:33:33 pm
Everyone needs more Bruce Campbell.

Offline Tiwaking!

  • Hero Member
  • Tiwaking! is awe-inspiring!Tiwaking! is awe-inspiring!Tiwaking! is awe-inspiring!Tiwaking! is awe-inspiring!Tiwaking! is awe-inspiring!Tiwaking! is awe-inspiring!Tiwaking! is awe-inspiring!Tiwaking! is awe-inspiring!Tiwaking! is awe-inspiring!Tiwaking! is awe-inspiring!Tiwaking! is awe-inspiring!Tiwaking! is awe-inspiring!
  • Posts: 12,562
Quote from: Spacemonkey;1510307
You can only do two types of attacks, punch and kick. Type somthing like 'kick him in the face' or 'punch his head off'
 
Kill him before he kills you.

If your feet get damaged/broken, they'll do less damage. So it may be better to punch instead.

This game is so simple yet so clever. You could have a whole list of After Fight statistics like:

How many undamaged body parts left: Yours vs Theirs
Most heavily damaged body part: Yours vs Theirs
Monetary cost of damage: Yours vs Theirs


You could even put a "Survival Mode" in where you get money at the end of a fight to repair yourself and just keep fighting until you die horribly from a lucky dismembering punch to the torso.
Quote from: Bell;1510337
Why do you hate white-space :(

I hate white-space. I am a programmatical racist.

Reply #26 Posted: November 29, 2012, 09:01:43 pm
I am now banned from GetSome

Offline Apostrophe Spacemonkey

  • Fuck this title in particular.

  • Apostrophe Spacemonkey is awe-inspiring!Apostrophe Spacemonkey is awe-inspiring!Apostrophe Spacemonkey is awe-inspiring!Apostrophe Spacemonkey is awe-inspiring!Apostrophe Spacemonkey is awe-inspiring!Apostrophe Spacemonkey is awe-inspiring!Apostrophe Spacemonkey is awe-inspiring!Apostrophe Spacemonkey is awe-inspiring!Apostrophe Spacemonkey is awe-inspiring!Apostrophe Spacemonkey is awe-inspiring!Apostrophe Spacemonkey is awe-inspiring!Apostrophe Spacemonkey is awe-inspiring!
  • Posts: 19,050
Quote from: Pyromanik;1510323
Defeating a ninja is like dividing by zero: it just can't happen.



I blame the QA department.

Reply #27 Posted: November 29, 2012, 09:03:43 pm

Offline Apostrophe Spacemonkey

  • Fuck this title in particular.

  • Apostrophe Spacemonkey is awe-inspiring!Apostrophe Spacemonkey is awe-inspiring!Apostrophe Spacemonkey is awe-inspiring!Apostrophe Spacemonkey is awe-inspiring!Apostrophe Spacemonkey is awe-inspiring!Apostrophe Spacemonkey is awe-inspiring!Apostrophe Spacemonkey is awe-inspiring!Apostrophe Spacemonkey is awe-inspiring!Apostrophe Spacemonkey is awe-inspiring!Apostrophe Spacemonkey is awe-inspiring!Apostrophe Spacemonkey is awe-inspiring!Apostrophe Spacemonkey is awe-inspiring!
  • Posts: 19,050
Quote from: Tiwaking!;1510345
This game is so simple yet so clever. You could have a whole list of After Fight statistics like:

How many undamaged body parts left: Yours vs Theirs
Most heavily damaged body part: Yours vs Theirs
Monetary cost of damage: Yours vs Theirs


You could even put a "Survival Mode" in where you get money at the end of a fight to repair yourself and just keep fighting until you die horribly from a lucky dismembering punch to the torso.



I'm going to add the internal organs to the torso. (There should already be eyes and nose, but they rearly get hit)

You hit him in his Pancreas.

I'll put some stats in as well as a command so you can see the current state of your body.

Reply #28 Posted: November 29, 2012, 09:09:03 pm

Offline Bell

  • Addicted
  • Bell is on the verge of being accepted.Bell is on the verge of being accepted.Bell is on the verge of being accepted.Bell is on the verge of being accepted.Bell is on the verge of being accepted.
  • Posts: 4,263
That's why I love QA departments.

Meanwhile...

Quote from: NonRacist!;1510273
Code: [Select]
public static NinjaBody getNinjaBody()
{
    NinjaBody ninjaBody = new NinjaBody();

    String[]sides = {"Left","Right"};
    String[]parts = {"Arm","Forearm","Hand","Thigh","Shin","Foot"};
    String[]body = {"Head","UpperTorso","LowerTorso"};
    String[]digits = {"Finger","Toe"};

    for(int i=0; i<body.length; i++)
    {
        ninjaBody.addPart( new BodyPart(body[i]) );
    }//4i

    for(int i=0; i<parts.length ;i++)
    {
        ninjaBody.addPart( new BodyPart(String.format(&quot;%s %s&quot;,sides[0],parts[i])) );
        ninjaBody.addPart( new BodyPart(String.format(&quot;%s %s&quot;,sides[1],parts[i])) );
    }//4i

    for(int i=0; i<10; i++)
    {
        ninjaBody.addPart( new BodyPart(digits[0]) );
        ninjaBody.addPart( new BodyPart(digits[1]) );
    }//4i

    return ninjaBody;
}//me get ninja Body


Ahh that's better

Reply #29 Posted: November 29, 2012, 09:11:18 pm

Offline Tiwaking!

  • Hero Member
  • Tiwaking! is awe-inspiring!Tiwaking! is awe-inspiring!Tiwaking! is awe-inspiring!Tiwaking! is awe-inspiring!Tiwaking! is awe-inspiring!Tiwaking! is awe-inspiring!Tiwaking! is awe-inspiring!Tiwaking! is awe-inspiring!Tiwaking! is awe-inspiring!Tiwaking! is awe-inspiring!Tiwaking! is awe-inspiring!Tiwaking! is awe-inspiring!
  • Posts: 12,562
Quote from: Spacemonkey;1510347
I'm going to add the internal organs to the torso. (There should already be eyes and nose, but they rearly get hit)

You hit him in his Pancreas

Just the Pancreas you say...


Reply #30 Posted: November 29, 2012, 09:13:23 pm
I am now banned from GetSome

Offline Pyromanik

  • Hero Member
  • Pyromanik is awe-inspiring!Pyromanik is awe-inspiring!Pyromanik is awe-inspiring!Pyromanik is awe-inspiring!Pyromanik is awe-inspiring!Pyromanik is awe-inspiring!Pyromanik is awe-inspiring!Pyromanik is awe-inspiring!Pyromanik is awe-inspiring!Pyromanik is awe-inspiring!Pyromanik is awe-inspiring!Pyromanik is awe-inspiring!
  • Posts: 28,834
Quote from: Spacemonkey;1510346
I blame the QA department.

By the look of that stack trace that windows wouldn't let me look at because it was busy unhelpfully trying to be helpful but really just denying me access to the stuff I need - I'd blame recursion.

Reply #31 Posted: November 29, 2012, 11:49:14 pm
Everyone needs more Bruce Campbell.

Offline Apostrophe Spacemonkey

  • Fuck this title in particular.

  • Apostrophe Spacemonkey is awe-inspiring!Apostrophe Spacemonkey is awe-inspiring!Apostrophe Spacemonkey is awe-inspiring!Apostrophe Spacemonkey is awe-inspiring!Apostrophe Spacemonkey is awe-inspiring!Apostrophe Spacemonkey is awe-inspiring!Apostrophe Spacemonkey is awe-inspiring!Apostrophe Spacemonkey is awe-inspiring!Apostrophe Spacemonkey is awe-inspiring!Apostrophe Spacemonkey is awe-inspiring!Apostrophe Spacemonkey is awe-inspiring!Apostrophe Spacemonkey is awe-inspiring!
  • Posts: 19,050
It's a feature.

Reply #32 Posted: November 30, 2012, 08:20:01 am

Offline The Demon Lord

  • Addicted
  • The Demon Lord is awe-inspiring!The Demon Lord is awe-inspiring!The Demon Lord is awe-inspiring!The Demon Lord is awe-inspiring!The Demon Lord is awe-inspiring!The Demon Lord is awe-inspiring!The Demon Lord is awe-inspiring!The Demon Lord is awe-inspiring!The Demon Lord is awe-inspiring!The Demon Lord is awe-inspiring!The Demon Lord is awe-inspiring!The Demon Lord is awe-inspiring!
  • Posts: 2,849
Quote from: Pyromanik;1510363
By the look of that stack trace that windows wouldn't let me look at because it was busy unhelpfully trying to be helpful but really just denying me access to the stuff I need - I'd blame recursion.

Have you tried manually updating Punkbuster?

Reply #33 Posted: November 30, 2012, 04:12:21 pm

Offline Tiwaking!

  • Hero Member
  • Tiwaking! is awe-inspiring!Tiwaking! is awe-inspiring!Tiwaking! is awe-inspiring!Tiwaking! is awe-inspiring!Tiwaking! is awe-inspiring!Tiwaking! is awe-inspiring!Tiwaking! is awe-inspiring!Tiwaking! is awe-inspiring!Tiwaking! is awe-inspiring!Tiwaking! is awe-inspiring!Tiwaking! is awe-inspiring!Tiwaking! is awe-inspiring!
  • Posts: 12,562
Quote from: The Demon Lord;1510438
Have you tried manually updating Punkbuster?

Punch
You attack Punkbuster with your Healthy Foot for 15 damage
You hit him in his Torso
His Torso is Dismembered
He is Dead!
Play Again?

Reply #34 Posted: November 30, 2012, 11:05:24 pm
I am now banned from GetSome

Offline Pyromanik

  • Hero Member
  • Pyromanik is awe-inspiring!Pyromanik is awe-inspiring!Pyromanik is awe-inspiring!Pyromanik is awe-inspiring!Pyromanik is awe-inspiring!Pyromanik is awe-inspiring!Pyromanik is awe-inspiring!Pyromanik is awe-inspiring!Pyromanik is awe-inspiring!Pyromanik is awe-inspiring!Pyromanik is awe-inspiring!Pyromanik is awe-inspiring!
  • Posts: 28,834
Tiwaking!: Chuck Norris to Punkbuster.

Reply #35 Posted: November 30, 2012, 11:33:07 pm
Everyone needs more Bruce Campbell.

Offline Tiwaking!

  • Hero Member
  • Tiwaking! is awe-inspiring!Tiwaking! is awe-inspiring!Tiwaking! is awe-inspiring!Tiwaking! is awe-inspiring!Tiwaking! is awe-inspiring!Tiwaking! is awe-inspiring!Tiwaking! is awe-inspiring!Tiwaking! is awe-inspiring!Tiwaking! is awe-inspiring!Tiwaking! is awe-inspiring!Tiwaking! is awe-inspiring!Tiwaking! is awe-inspiring!
  • Posts: 12,562
This sounds like the RogueLike for you!
Iter Vehemens ad Necem
http://ivan.sourceforge.net/
Quote
Fellow adventurer, turn back while you can! For here begins the roguelike Iter Vehemens ad Necem, a Violent Road to Death. If you choose to travel along it, you will dive into countless exciting adventures to gain items of great magic, attain powerful equipment made of mysterious materials, bathe in the blessings of mighty gods and recruit loyal allies of various shapes and sizes. Unfortunately, along the way you will also often be dangerously injured, poisoned, catch numerous diseases, lose several limbs and transform into manifold different kinds of pitiful creatures in the darkest depths of hostile dungeons. And, at the end of the road, you are bound to perish in a most gruesome and painful way. Don't say we didn't warn you.

And to sweeten the deal: A quote from Somnlaut
Quote
Iter Vehemens Ad Necem: http://ivan.sourceforge.net/

No longer developed. Didn't get too far, but the mechanics are very interesting, especially the body part and materials system. You can get your arm sliced off, turn it into banana and eat it... among other interesting possibilities.

Oh, and it's ridiculously difficult. I don't believe that anybody has beaten it without cheating. Difficulty scales with how well you're doing... sort of.
Last Edit: February 24, 2013, 11:06:42 pm by Tiwaking!

Reply #36 Posted: February 24, 2013, 11:05:11 pm
I am now banned from GetSome

Offline The Demon Lord

  • Addicted
  • The Demon Lord is awe-inspiring!The Demon Lord is awe-inspiring!The Demon Lord is awe-inspiring!The Demon Lord is awe-inspiring!The Demon Lord is awe-inspiring!The Demon Lord is awe-inspiring!The Demon Lord is awe-inspiring!The Demon Lord is awe-inspiring!The Demon Lord is awe-inspiring!The Demon Lord is awe-inspiring!The Demon Lord is awe-inspiring!The Demon Lord is awe-inspiring!
  • Posts: 2,849
I came to this thread Expecting a DLC for Ninja Attack.

Reply #37 Posted: February 25, 2013, 08:05:36 am

Offline Xenolightning

  • GS Developer
  • Xenolightning is awe-inspiring!Xenolightning is awe-inspiring!Xenolightning is awe-inspiring!Xenolightning is awe-inspiring!Xenolightning is awe-inspiring!Xenolightning is awe-inspiring!Xenolightning is awe-inspiring!Xenolightning is awe-inspiring!Xenolightning is awe-inspiring!Xenolightning is awe-inspiring!Xenolightning is awe-inspiring!Xenolightning is awe-inspiring!
  • Posts: 3,485
Quote from: The Demon Lord;1518915
I came to this thread Expecting a DLC for Ninja Attack.
Over-revived, under-delivered?

Reply #38 Posted: February 25, 2013, 08:11:41 am
-= Sad pug is sad =-

Offline Apostrophe Spacemonkey

  • Fuck this title in particular.

  • Apostrophe Spacemonkey is awe-inspiring!Apostrophe Spacemonkey is awe-inspiring!Apostrophe Spacemonkey is awe-inspiring!Apostrophe Spacemonkey is awe-inspiring!Apostrophe Spacemonkey is awe-inspiring!Apostrophe Spacemonkey is awe-inspiring!Apostrophe Spacemonkey is awe-inspiring!Apostrophe Spacemonkey is awe-inspiring!Apostrophe Spacemonkey is awe-inspiring!Apostrophe Spacemonkey is awe-inspiring!Apostrophe Spacemonkey is awe-inspiring!Apostrophe Spacemonkey is awe-inspiring!
  • Posts: 19,050
A DLC is being worked on.


I'll start a kickstarter up for it.

The rewards will be a copy of the game, and a body part of your choice.


While stocks last!

Reply #39 Posted: February 25, 2013, 08:47:31 am

Offline Apostrophe Spacemonkey

  • Fuck this title in particular.

  • Apostrophe Spacemonkey is awe-inspiring!Apostrophe Spacemonkey is awe-inspiring!Apostrophe Spacemonkey is awe-inspiring!Apostrophe Spacemonkey is awe-inspiring!Apostrophe Spacemonkey is awe-inspiring!Apostrophe Spacemonkey is awe-inspiring!Apostrophe Spacemonkey is awe-inspiring!Apostrophe Spacemonkey is awe-inspiring!Apostrophe Spacemonkey is awe-inspiring!Apostrophe Spacemonkey is awe-inspiring!Apostrophe Spacemonkey is awe-inspiring!Apostrophe Spacemonkey is awe-inspiring!
  • Posts: 19,050
Exciting features coming in the next version of Ninja Attack

  • Unlockable unlocks - Earn points to unlock items like the Fists of steel, and the Pants of tightness.
  • Always online DRM - The game will check with the server every two milliseconds. If a connection is not found, it will report you to the FBI and shutdown your computer.
  • Two new maps - Fight Ninjas on the Tokyo docks, and in a Chinese drug factory.
  • New Ninja boss - The mega ultra robot ninja, so powerful he'll kill you before you even think about starting the game.
  • Invisible microtransactions - Your credit card will be charged without you even knowing.
  • Multiplayer - Your home address is transmitted to your opponent, so he can exact revenge in real life after you have defeated him.
  • Blood - So much blood!

Reply #40 Posted: February 25, 2013, 09:58:58 am

Offline The Demon Lord

  • Addicted
  • The Demon Lord is awe-inspiring!The Demon Lord is awe-inspiring!The Demon Lord is awe-inspiring!The Demon Lord is awe-inspiring!The Demon Lord is awe-inspiring!The Demon Lord is awe-inspiring!The Demon Lord is awe-inspiring!The Demon Lord is awe-inspiring!The Demon Lord is awe-inspiring!The Demon Lord is awe-inspiring!The Demon Lord is awe-inspiring!The Demon Lord is awe-inspiring!
  • Posts: 2,849
Quote from: Spacemonkey;1518928
Exciting features coming in the next version of Ninja Attack

  • Unlockable unlocks - Earn points to unlock items like the Fists of steel, and the Pants of tightness.
  • Always online DRM - The game will check with the server every two milliseconds. If a connection is not found, it will report you to the FBI and shutdown your computer.
  • Two new maps - Fight Ninjas on the Tokyo docks, and in a Chinese drug factory.
  • New Ninja boss - The mega ultra robot ninja, so powerful he'll kill you before you even think about starting the game.
  • Invisible microtransactions - Your credit card will be charged without you even knowing.
  • Multiplayer - Your home address is transmitted to your opponent, so he can exact revenge in real life after you have defeated him.
  • Blood - So much blood!

Can I get these without having to buy Ninja Attack Premium?

I already paid for the game and don't see why I should pay extra for the DLC....

Reply #41 Posted: February 25, 2013, 10:49:52 am

Offline Apostrophe Spacemonkey

  • Fuck this title in particular.

  • Apostrophe Spacemonkey is awe-inspiring!Apostrophe Spacemonkey is awe-inspiring!Apostrophe Spacemonkey is awe-inspiring!Apostrophe Spacemonkey is awe-inspiring!Apostrophe Spacemonkey is awe-inspiring!Apostrophe Spacemonkey is awe-inspiring!Apostrophe Spacemonkey is awe-inspiring!Apostrophe Spacemonkey is awe-inspiring!Apostrophe Spacemonkey is awe-inspiring!Apostrophe Spacemonkey is awe-inspiring!Apostrophe Spacemonkey is awe-inspiring!Apostrophe Spacemonkey is awe-inspiring!
  • Posts: 19,050
New features will include a shop.

You get money for killing Ninja's (of course).

You can then spend your money at the shop to buy things to heal you, or weapons, etc


Reply #42 Posted: February 25, 2013, 10:58:43 am

Offline Apostrophe Spacemonkey

  • Fuck this title in particular.

  • Apostrophe Spacemonkey is awe-inspiring!Apostrophe Spacemonkey is awe-inspiring!Apostrophe Spacemonkey is awe-inspiring!Apostrophe Spacemonkey is awe-inspiring!Apostrophe Spacemonkey is awe-inspiring!Apostrophe Spacemonkey is awe-inspiring!Apostrophe Spacemonkey is awe-inspiring!Apostrophe Spacemonkey is awe-inspiring!Apostrophe Spacemonkey is awe-inspiring!Apostrophe Spacemonkey is awe-inspiring!Apostrophe Spacemonkey is awe-inspiring!Apostrophe Spacemonkey is awe-inspiring!
  • Posts: 19,050
Quote from: The Demon Lord;1518933
Can I get these without having to buy Ninja Attack Premium?

I already paid for the game and don't see why I should pay extra for the DLC....

If you already bought the game, you'll have to buy the game again, and then buy it once more, before you can buy the DLC.

Reply #43 Posted: February 25, 2013, 11:00:51 am

Offline Tiwaking!

  • Hero Member
  • Tiwaking! is awe-inspiring!Tiwaking! is awe-inspiring!Tiwaking! is awe-inspiring!Tiwaking! is awe-inspiring!Tiwaking! is awe-inspiring!Tiwaking! is awe-inspiring!Tiwaking! is awe-inspiring!Tiwaking! is awe-inspiring!Tiwaking! is awe-inspiring!Tiwaking! is awe-inspiring!Tiwaking! is awe-inspiring!Tiwaking! is awe-inspiring!
  • Posts: 12,562
Quote from: Spacemonkey;1518928
Exciting features coming in the next version of Ninja Attack

  • Unlockable unlocks

There is an interesting review about Modern Warfare (which I cannot for the life of me find) which denigrates the idea that a player would be motivated to wipe all their previous experience for the sake of gaining some kind of symbol that shows they have unlocked the highest level. This is called "Prestige Mode"

It is the most retarded thing to ever come about in gaming, but dipshits with infinite amounts of time and very little education covet these unlocks like Monkeys and Dung throwing.

I suggest you put Prestige Mode into your game.

Reply #44 Posted: February 25, 2013, 12:21:29 pm
I am now banned from GetSome

Offline Apostrophe Spacemonkey

  • Fuck this title in particular.

  • Apostrophe Spacemonkey is awe-inspiring!Apostrophe Spacemonkey is awe-inspiring!Apostrophe Spacemonkey is awe-inspiring!Apostrophe Spacemonkey is awe-inspiring!Apostrophe Spacemonkey is awe-inspiring!Apostrophe Spacemonkey is awe-inspiring!Apostrophe Spacemonkey is awe-inspiring!Apostrophe Spacemonkey is awe-inspiring!Apostrophe Spacemonkey is awe-inspiring!Apostrophe Spacemonkey is awe-inspiring!Apostrophe Spacemonkey is awe-inspiring!Apostrophe Spacemonkey is awe-inspiring!
  • Posts: 19,050
Work on the store is almost finished.


Reply #45 Posted: February 25, 2013, 02:24:41 pm

Offline Tiwaking!

  • Hero Member
  • Tiwaking! is awe-inspiring!Tiwaking! is awe-inspiring!Tiwaking! is awe-inspiring!Tiwaking! is awe-inspiring!Tiwaking! is awe-inspiring!Tiwaking! is awe-inspiring!Tiwaking! is awe-inspiring!Tiwaking! is awe-inspiring!Tiwaking! is awe-inspiring!Tiwaking! is awe-inspiring!Tiwaking! is awe-inspiring!Tiwaking! is awe-inspiring!
  • Posts: 12,562
"Walking down a dark street, a Ninja jumps out and attacks!"

Sorry, could you wait just a second: SHOP

Could I have one Prestige Mode, two DLC, and a whole bunch of Steroids please?
Thank you, Come Again!

Reply #46 Posted: February 25, 2013, 02:56:52 pm
I am now banned from GetSome

Offline The Demon Lord

  • Addicted
  • The Demon Lord is awe-inspiring!The Demon Lord is awe-inspiring!The Demon Lord is awe-inspiring!The Demon Lord is awe-inspiring!The Demon Lord is awe-inspiring!The Demon Lord is awe-inspiring!The Demon Lord is awe-inspiring!The Demon Lord is awe-inspiring!The Demon Lord is awe-inspiring!The Demon Lord is awe-inspiring!The Demon Lord is awe-inspiring!The Demon Lord is awe-inspiring!
  • Posts: 2,849
Fuck yes. I am the most expensive Forum member in the shop.

Reply #47 Posted: February 25, 2013, 04:16:16 pm

Offline Bell

  • Addicted
  • Bell is on the verge of being accepted.Bell is on the verge of being accepted.Bell is on the verge of being accepted.Bell is on the verge of being accepted.Bell is on the verge of being accepted.
  • Posts: 4,263
Now all you need is to make a map out of ascii characters.
That way you can give the player an objective to get to and give the shop a physical location.

Reply #48 Posted: February 25, 2013, 06:35:45 pm

Offline Tiwaking!

  • Hero Member
  • Tiwaking! is awe-inspiring!Tiwaking! is awe-inspiring!Tiwaking! is awe-inspiring!Tiwaking! is awe-inspiring!Tiwaking! is awe-inspiring!Tiwaking! is awe-inspiring!Tiwaking! is awe-inspiring!Tiwaking! is awe-inspiring!Tiwaking! is awe-inspiring!Tiwaking! is awe-inspiring!Tiwaking! is awe-inspiring!Tiwaking! is awe-inspiring!
  • Posts: 12,562
Quote from: Bell;1518995
Now all you need is to make a map out of ascii characters.
That way you can give the player an objective to get to and give the shop a physical location.

Hmmm

Spoiler :

Code: [Select]
import java.util.ArrayList;
import java.util.Random;
import java.awt.*;
import javax.swing.*;
import javax.swing.ImageIcon;
import java.awt.event.*;
import javax.swing.event.*;
import javax.swing.JFrame;
import javax.swing.JPanel;
import java.awt.Canvas;
import java.awt.Dimension;
import javax.swing.WindowConstants;
import java.awt.event.KeyListener;
import java.awt.event.KeyEvent;
import java.awt.image.BufferStrategy;
import java.awt.Color;
import java.awt.Graphics2D;
import javax.swing.ImageIcon;
import java.util.ArrayList;
/**
A test of using a canvas and Key Listener to navigate around the Naruto Map
 * @author Tiwa
 * @version mon 27 aug 2012
@Wed Oct 17 07:51:47 NZDT 2012 <- moved to RogueLike
@Wed Oct 17 20:30:06 NZDT 2012 <- test complete: Monospace enabled
 */
public class TestMapPanel extends Canvas implements KeyListener{
protected final int WIDTH=500;
protected final int HEIGHT=500;
protected final int OFFSET_WIDTH=200;
// protected final int WIDTH=600;
// protected final int HEIGHT=600;
protected final int barHeight=30;
protected final int tileSize=10;
private BufferStrategy strategy;
protected boolean gameRunning=true;
// protected final Travel travel=new Travel();
// protected final Tile[][]TILES;
// protected Tile myTile=new Tile();
// protected ImageIcon bgimage=new ImageIcon(&quot;narutomap.png&quot;);
protected final char[][]grid=new char[WIDTH/tileSize][WIDTH/tileSize];
// protected final char[][]grid=new char[5][5];
protected int playerX=0;
 protected int playerY=0;
protected final int screenTop=10;
protected final Random rnd=new Random();
// protected String[]stats={&quot;Name: Bob&quot;,&quot;Strength: 10&quot;,&quot;Speed: 5&quot;,&quot;Armour: 5&quot;,&quot;Weapon: Sword&quot;};
protected boolean mv_blocked;
protected String blocked_message=&quot;Your way is blocked!&quot;;
 public TestMapPanel(){
 // WIDTH=bgimage.getIconWidth();
 // HEIGHT=bgimage.getIconHeight();
 JFrame frame=new JFrame(&quot;Tiwas Roguelike Game&quot;);
// frame.setUndecorated(true);
 JPanel panel=(JPanel)frame.getContentPane();
 panel.setPreferredSize(new Dimension(WIDTH+OFFSET_WIDTH,HEIGHT));
 panel.setLayout(null);
 setBounds(0,0,WIDTH+OFFSET_WIDTH,HEIGHT);
 panel.add(this);
 setIgnoreRepaint(true);
 frame.pack();
 frame.setResizable(false);
 frame.setVisible(true);
 frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);

 addKeyListener(this);
 createBufferStrategy(2);
 strategy=getBufferStrategy();

 // myTile.setSize(tileSize);
 // myTile.setX(0);
 // myTile.setY(0);
 // myTile.setType('L');
 // myTile.addItem(&quot;Naruto&quot;);
 // myTile.setImage(new ImageIcon(&quot;narutobody.jpg&quot;));
 // TILES[0][0]=myTile;
for(int x=0;x<grid.length;x++){
 for(int y=0;y<grid[x].length;y++){
 grid[x][y]='.';
 }//4y
 }//4x
 grid[playerX][playerY]='@';
requestFocus();
 gameLoop();
 }//con
 /**
 Main Game Loop
 */
 public void gameLoop(){
String[]stats={&quot;Name: Bob&quot;,&quot;Strength: 10&quot;,&quot;Speed: 5&quot;,&quot;Armour: 5&quot;,&quot;Weapon: Sword&quot;};
Font font = new Font(&quot;Monospaced&quot;, Font.BOLD, 14);
 long lastLoopTime = System.currentTimeMillis();
 while(gameRunning){
 long delta = System.currentTimeMillis() - lastLoopTime;
 lastLoopTime = System.currentTimeMillis();
 Graphics2D g = (Graphics2D)strategy.getDrawGraphics();
 g.setColor(Color.WHITE);
g.fillRect(0,0,WIDTH+OFFSET_WIDTH,HEIGHT);
 // g.drawImage(bgimage.getImage(),0,0,WIDTH,HEIGHT,null);
 g.setColor(Color.BLACK);
g.setFont(font);
 int tileWidth=getWidth()/tileSize;
 int tileHeight=getHeight()/tileSize;
for(int x=0;x<grid.length;x++){
 /*
for(int y=0;y<TILES[x].length;y++){
 g.drawRect(x*tileSize,y*tileSize,tileSize,tileSize);
 // Tile tile=TILES[x][y];
 char tile=grid[x][y];
 if(tile!=null){
g.drawImage(ResizeImage.getImage(tile.getImage(),tileSize,tileSize).getImage(),x*tileSize,y*tileSize,null);
 g.drawChars(tile,tileSize,tile.length,
drawChars(char[] data, int offset, int length, int x, int y)
Draws the text given by the specified character array, using this
 graphics context's current font and color.
char[] c = { 'W', 'a', 't', 'c', 'h', ' ', 'i', 't', ' ', 'D','u',
 'k', 'e', '!' };
g.drawChars(c, 0, c.length, 10, 30);
 }//fi tile not null

 }//y
*/
// g.drawChars(grid[x],0,grid[x].length,0,x*tileSize);
// g.drawChars(grid[x],1,grid[x].length,0,x*tileSize);//bad offset??
g.drawChars(grid[x],0,grid[x].length,0,x*tileSize+screenTop);
if(x<stats.length)g.drawString(stats[x],WIDTH-100,x*tileSize+screenTop);
}//x
if(mv_blocked)g.drawString(blocked_message,WIDTH-100,stats.length*tileSize+screenTop);
 g.dispose();
 strategy.show();

 try {Thread.sleep(10);
 }catch(Exception eek) {
//new Help(eek.toString());
// eek.printStackTrace();
JOptionPane.showMessageDialog(this,eek.toString(),&quot;Error in main loop&quot;,JOptionPane.INFORMATION_MESSAGE);
}//do nothing
 }//while game is running
 System.exit(0);
 }//method
 /**
  * The following methods are implemented by the Key Listener
  */
 public void keyPressed(KeyEvent e) {

if (e.getKeyCode() == KeyEvent.VK_LEFT) {
//  movePlayer(playerX-1,playerY);
// movePlayer(playerX,playerY+1);
movePlayer(playerX,playerY-1);
}//if you press left
 if (e.getKeyCode() == KeyEvent.VK_RIGHT) {
// movePlayer(playerX+1,playerY);
// movePlayer(playerX,playerY-1);
movePlayer(playerX,playerY+1);
}//if you press right
 // if (e.getKeyCode() == KeyEvent.VK_DOWN && !pressD) {
 if (e.getKeyCode() == KeyEvent.VK_DOWN){
// movePlayer(playerX,playerY+1);
//  movePlayer(playerX-1,playerY);
movePlayer(playerX+1,playerY);
}//if you press right
 if (e.getKeyCode() == KeyEvent.VK_UP) {
// movePlayer(playerX,playerY-1);
// movePlayer(playerX+1,playerY);
 movePlayer(playerX-1,playerY);
}//if you press right
 }//method

 public void keyReleased(KeyEvent e) {

 }//method

 public void keyTyped(KeyEvent e) {
 if (e.getKeyChar() == 27) {
 // System.exit(0);
 gameRunning=false;
 }//if you press escape (keyChar 27)
 }//method
protected void movePlayer(int x,int y){
grid[playerX][playerY]='.';
blocked_message=&quot;&quot;;
boolean blockedx=true;
boolean blockedy=true;
if(x>-1 && x<grid.length){
playerX=x;
blockedx=false;
}//fi x
if(y>-1 && y<grid.length){
playerY=y;
blockedy=false;
}//fi x
grid[playerX][playerY]='@';
if(!blockedx && !blockedy)mv_blocked=false;
else {
mv_blocked=true;
if(blocked_message.length()==0)blocked_message=&quot;Your way is blocked!&quot;;
}
// repaint();
 }//me move player
// protected void checkCoordinate(int num,int
 } // class TestMap



Reply #49 Posted: February 25, 2013, 07:19:19 pm
I am now banned from GetSome