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

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
Standard output or nothing IMO :P

My first year C++ rouge-like might be lying around on the BIT servers somewhere.
I'd love to look at that code it was during my "pointers are melting my brain" phase.

Oh how I miss C++ this is making me want to make a crappy gui version of ninja attack.
Who's good at making little animation strips using paint?
Last Edit: February 25, 2013, 09:15:29 pm by Bell

Reply #50 Posted: February 25, 2013, 09:11:12 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,583
Quote from: Bell;1519033
Standard output or nothing IMO :P

You have to understand that the Standard Outputs Output is never Standard.

The font sizes differ depending on the operating system. Java is write once, run anywhere

C++ is write a dozen times, hope it compiles, and if there are any fuckups: Blame the USER

Reply #51 Posted: February 25, 2013, 09:33:44 pm
I am now banned from GetSome

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
But using a gui framework to draw simple ascii characters makes me cry a little.
Look at all of those imports, there is something fun to me about making a game using the bare minimum.
Last Edit: February 25, 2013, 10:51:36 pm by Bell

Reply #52 Posted: February 25, 2013, 10:47:28 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,583
Quote from: Bell;1519038
But using a gui framework to draw simple ascii characters makes me cry a little.
Look at all of those imports, there is something fun to me about making a game using the bare minimum.

Hehehehe.

If you think that makes you cry, you would absolutely hate to see the Dwarf Fortress source code.

Reply #53 Posted: February 25, 2013, 10:55:54 pm
I am now banned from GetSome

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
I'll forgive you when your game is %1 as complex as Dwarf Fortress.

Also C/C++ doesn't blame the user, it just does exactly what you tell it to do so allows you to blame yourself and not that high level built-in programming construct or the garbage collector.

The last commerical game I worked on had frame rate issues because of memory usage, unfortunetly we had little control over the memory usage during some frames because the garbage collector decided to clean up our memory at a time it determined was best.
They flew in a optimisation expert who gaves us some tips that helped somewhat but the general concensous was, 'Yea you should have used C++ for this".
Last Edit: February 25, 2013, 11:08:52 pm by Bell

Reply #54 Posted: February 25, 2013, 11:00:02 pm

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
hahahah, so true.

Modern game dev: PUSH EVERYTHING TO SCRIPTS! AS MUCH AS YOU CAN! THE WHOLE GAME!
Which has it's pros, of course. But... speed :<

And you end up with mad shit like this: https://developer.mozilla.org/en/demos/detail/bananabread
Last Edit: February 26, 2013, 07:19:04 pm by Pyromanik

Reply #55 Posted: February 26, 2013, 07:15:03 pm
Everyone needs more Bruce Campbell.

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
i have begun work on the basic 2d engine that will power ninja-kick 1990's edition.
The all powerful C++ with its sidekick Simple DirectMedia Layer (SDL) have been tasked with the challenge.

Reply #56 Posted: March 03, 2013, 03:22:19 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,583
In the event you attack someone with a limb which has been Dismembered (Red), you will instead attempt to strike them with the bloody stump which is all that remains of that limb. This is as gross as it sounds and it is highly advised you Retreat or use an Active Limb.
Last Edit: March 22, 2013, 07:02:29 pm by Tiwaking!

Reply #57 Posted: March 22, 2013, 06:59:56 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
Tiwa is genius.

Reply #58 Posted: March 22, 2013, 07:18:56 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,583
Quote from: Spacemonkey;1521557
Tiwa is genius.

Actually: You're the genius here. I would never have thought of using the old school system of hit location in a fighting game like this. That is one of those 'Too Crazy To Work' situations.
Spoiler :
My original idea with the body parts thing was to have the Ninjas be able to replace their body parts with stolen parts from other Ninja's, a surprisingly common occurrence

So: This whole locational damage thing is, not a new idea by any means, but poses a surprisingly structural dilemma (pun not intended)


"How the buggery farts do I display all this??"

The Book/Internet/Programming Answer: Use Objects and Methods
My Answer: One Ninja Body containing HashMap + One Array of Strings + Two HashMaps (NinjaBodyParts, JLabel)


This has actually solved all my problems with the whole Object -> Interface -> Display questions I have ever had.
(I've taken out the Accessor/Mutators, aka Getters and Setters, for brevity)
Code: [Select]
import java.util.HashMap;
public class NarutoNinja {
protected String name;
protected HashMap<String,NinjaBodyPart>body=new HashMap<String,NinjaBodyPart>();
protected HashMap<String,Jutsu>jutsus=new HashMap<String,Jutsu>();//These are a Ninjas Attacks, in this case &quot;Left Punch&quot;,&quot;Left Kick&quot;, etc

public NarutoNinja(String n){
name=n;
}//c
}//class
Ninja Body Parts
Code: [Select]
import java.util.ArrayList;
public class NinjaBodyPart{
protected String name;
protected int health;
protected int MAX_HEALTH;
protected final ArrayListparts=new ArrayList();
public NinjaBodyPart(String n,int h){
name=n;
health=h;
MAX_HEALTH=h;
}//c
public String toString(){
return name;
}
public String getLabel(){
return String.format("%s: %d",name,health);
}
And the HashMap of JLabels in the Main Program/Display
Code: [Select]
protected final HashMaplblBody=new HashMap();
Now you iterate through the Ninja's Body Parts and add new JLabels for them
Code: [Select]
HashMapbody=kakashi.getBody();
Object[]keys=body.keySet().toArray();
for(int i=0;iString key=keys[i].toString();//one key now can access both HashMaps
JLabel lbl=new JLabel(body.get(key).getLabel());//makes text for the JLabel
lbl.setOpaque(true);//otherwise the background colour doesnt come through
lbl.setBackground(Color.green);//a nice healthy limb
lblBody.put(key,lbl);
}//for i
Spoiler contains code for processing attacks which is somewhat irrelevant (you can just use an int damage amount)
Spoiler :
Code: [Select]
protected String processAttack(NarutoNinja ninja1,NarutoNinja ninja2,Jutsu attack){
NinjaBodyPart part=processPart(ninja2,attack);
Color col=Color.yellow;
String line=String.format("%s %ss %s in his %s for %d damage (%d Health)\n",ninja1.getName(),attack.getName(),ninja2.getName(),part.getName(),attack.getDamage(),part.getHealth());
int phealth=part.getHealth();
String damage="";
part.setHealth(phealth-attack.getDamage());
if(part.getHealth()damage="bruised";
}
if(part.getHealth()<0){
damage="dismembered";
col=Color.red;
destroyBodyParts(part,part.getHealth());
String[]dead={"Head","UpperTorso","LowerTorso"};
for(int i=0;iif(part.getName().equals(dead[i])){
sndKick.stop();
sndPunch.stop();
sndWin.play();
JOptionPane.showMessageDialog(
                    this,
                    "Congratulations! You Win!",
                    "Crombat Great Success",
                    JOptionPane.PLAIN_MESSAGE,
new ImageIcon("gaithumbsup.jpg")
);
}//fi
}//4 i
return line+=String.format("Kakashis %s is %s (%d Health)",part.getName(),damage,part.getHealth());
}//if part.getHealth()<0
if(part.getHealth()==0){
sndCrack.play();
damage="critically injured";
col=Color.WHITE;//gray doesnt show up properly here
}
if(part.getHealth()>=part.getMaxHealth()/2){
damage="damaged";
}
line+=String.format("Kakashis %s is %s (%d Health)",part.getName(),damage,part.getHealth());
lblBody.get(part.getName()).setText(part.getLabel());
if(col!=null){
lblBody.get(part.getName()).setBackground(col);
}
return line;
}//me
So: How do you destroy multiple parts when a limb is liberated from the body? With Recursion!
You probably dont need to use recursion here, but Im lazy.
Code: [Select]
protected void destroyBodyParts(NinjaBodyPart part,int h){
part.setHealth(h);
lblBody.get(part.getName()).setText(part.getLabel());
lblBody.get(part.getName()).setBackground(Color.red);
if(part.getParts().isEmpty())return;
for(int i=0;idestroyBodyParts(part.getParts().get(i),h);
}
}//me
And the buttons? All run from Reflection:
Code: [Select]
protected final String[]btnLabels={"Left Punch","Right Punch","Left Kick","Right Kick","Combo","Instructions"};
protected void createButtons(JPanel btnPanel){
for(int i=0;iJButton btn=new JButton(btnLabels[i]);
btn.setMargin(new Insets(0,0,0,0));
btn.setActionCommand(String.format("%s%s","btn",Library.removeSpaces(btnLabels[i])));
btn.addActionListener(this);
btnPanel.add(btn);
}//4
}
public void actionPerformed(ActionEvent ae){
try{
getClass().getDeclaredMethod(ae.getActionCommand()).invoke(this);
}//catch
catch(Exception e){
Library.getHelp(e.toString(),ae.getActionCommand());
}//catch
}//me action performed
And all you need is the methods that are named after the buttons e.g btnLeftPunch(),btnRightKick(),btnInstructions()

And thats it. Put some JPanels in to display the information and Thats all you need. When the Body Parts take damage you can use the name of the Body Part to access the Label displaying the information for the Body Part and update the display

What this whole HashMap display idea does is simplifies the reset (aka 'Healing') of a character down to one ridiculously simple method
In this case: ninja(0) is the Target and ninja(1) is the aggressor. So we reset the target like so
Code: [Select]
protected void reset(){
HashMapbody=ninjas.get(0).getBody();
for(Map.Entryentry:body.entrySet()){
NinjaBodyPart part=entry.getValue();//get the iterated body part from the Map
part.setHealth(part.getMaxHealth());//MAX_HEALTH is saved in the class from the initial health
JLabel lbl=lblBody.get(part.getName());//get the label associated with the body part
lbl.setText(part.getLabel());//reset the text of the label
lbl.setBackground(Color.GREEN);//nice healthy limb
}//4 iterate map of body parts
}//reset
Which is simplified further in the spoiler
Spoiler :
Code: [Select]
protected void reset(){
for(Map.Entryentry:ninjas.get(0).getBody().entrySet()){
entry.getValue().setHealth(entry.getValue().getMaxHealth());
lblBody.get(entry.getValue().getName()).setText(entry.getValue().getLabel());
lblBody.get(entry.getValue().getName()).setBackground(Color.GREEN);
}
And Finally: If one of the Body Parts is a 'Principal Body Part'
Code: [Select]
protected final String[]PARTS_BODY={"Head","UpperTorso","LowerTorso"};
Then all you need to do is iterate this incredibly short list to see if the damaged part is one of these. If it is: Enemy is Killed
You could even turn this into a HashSet if you want and use PARTS_BODY.contains(part.getName())
Either Way:

Last Edit: March 23, 2013, 12:55:40 am by Tiwaking!

Reply #59 Posted: March 22, 2013, 11:23:32 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
Oh you, chuunin exam.

Reply #60 Posted: March 23, 2013, 12:50:25 am
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
What's up with these bots selling stuff?

No one wants your iApples and HTC Galaxies.

Reply #61 Posted: July 04, 2014, 09:48:44 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
I heard the next version of Ninja Attack will been released this week.


If you have a previous install, you have to uninstall if first, format your hard drive, then buy a new computer before reinstalling.

Last Edit: July 07, 2014, 08:31:32 am by Spacemonkey

Reply #62 Posted: July 04, 2014, 09:55:14 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,583
What's up with these bots selling stuff?

No one wants your iApples and HTC Galaxies.
It looks like Xsannz banished these guys back to where they came from i.e Facebook
I heard the next version of Ninja Attack will been released this week.


If you have a previous install, you have to uninstall if first, format your hard drive, then buy a new computer before reinstalling.
Do I have to buy a SpaceMonkey brand computer? If so: How much, because I am running out of arms and legs and I need a hand.
Last Edit: July 04, 2014, 10:03:39 am by Tiwaking!

Reply #63 Posted: July 04, 2014, 10:02:05 am
I am now banned from GetSome

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,583
But using a gui framework to draw simple ascii characters makes me cry a little.
Look at all of those imports, there is something fun to me about making a game using the bare minimum.
An odd thing is how Notch made a rogue like with an absolutely horrible control scheme
https://mojang.com/notch/ld16/

To pick up items you use comma (,). To show inventory you press 'i'. To move around you use the Numpad.

Using comma and i for commands while using the numpad to move around is incredibly awkward. He could have made multiple command keys, but he didnt.

Coolness: 1/5

Reply #64 Posted: July 20, 2014, 01:36:10 pm
I am now banned from GetSome