Patatamosh

>> Sunday, May 2, 2010

Patatamosh will be a 2D fighting game which I will develop in order to test BIP so far. I also want to make it very extensible, so characters code is embeded inside Patatamosh.
Characters code is in Groovy, which is a very nice interpreted dynamically typed OO language, and can also be used as normal Java. So you could just use Java to write your own characters code :)
So far it's going pretty smooth, I will post all updates here. Wish me luck! 

Read more...

BIP Upgrades

>> Saturday, May 1, 2010

Well I've worked a bit more on BIP, the Input class now read a sequence of keys with a given delay, useful to check for actions if you are makign for example a fight game.
Also the Sprite class has been modified, the way to load spritesheets has changed, now it loads spritesheets with no requirement of it to have the same size for all images, it reads spritesheets generated by this program (which i reccommend by the way).
Another thing that changed from the Sprites class is the way to add animations, now, when you pack the spritesheet each image has it name you can use to add animations, for example say you have the images

  • wk_punch_1.png
  • wk_punch_2.png
  • wk_punch_3.png
  • wk_punch_4.png
You could add an animation by doing this

addAnimation("wk_punch", new String[]{ "wk_punch_1", "wk_punch_2", "wk_punch_3", "wk_punch_4" });

Way easier IMHO.
Also I fixed some bugs with Mouse Input and finished a little Button class, inside the gui subpackage. In the future I think it will have some more basic gui components, nothing fancy, I'll see how hard it is to give a simple interface to use swing or awt, BIP is all about simple interfaces :)

Read more...

NekoCM Util - Printer

>> Wednesday, April 28, 2010

This is a little utility I'm working on. It's still under development. Basically is a simple way to print something using Java.
Normally to print something you will need to use the Print API, which is pretty annoying, so i googled and found this tutorial, it worked very good! For simple purposes is the easiest way by far.
I used it and by using it I realised I could make an API with the simple stuff I was doing, I planned on improving it later, and that would be some work because you would normally want to do that when using that tutorial source code, so I decided to do that, the result is very nice! It really helped me.
Right now the first NekoCM Util class is about printing, under the package com.blogspot.nekocm.util.print.
The idea behind that is basically make a print preview window, in the window there is a JPanel in which you draw what the page (Currently only A4 size) is gonna look like. And that's it! No worries about anything else, here is the example code.

PrintExample.java

import javax.swing.*;

import com.blogspot.nekocm.util.print.PreviewPrint;

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

public class PrintExample extends JFrame {
 public PrintExample() {
  super();
  this.setTitle("NekoCM - Print example");
  this.setSize(new Dimension(300, 200));
  this.setVisible(true);
  this.setLocationRelativeTo(null);
  this.setLayout(new FlowLayout());
  this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

  JButton btn_print = new JButton("Print");
  btn_print.addActionListener(new ActionListener() {
   @Override
   public void actionPerformed(ActionEvent arg0) {
    new PreviewPrint(new PrintExamplePanel());
   }
  });
  this.getContentPane().add(btn_print);

 }

 public static void main(String[] args) {
  try {
   UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
  } catch (Exception e) {
   // best to do nothing here
  }
  new PrintExample();
 }
}

PrintExamplePanel.java

import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics2D;

import com.blogspot.nekocm.util.print.PreviewPanel;

public class PrintExamplePanel extends PreviewPanel {

 public PrintExamplePanel() {
  super("A4");
 }

 @Override
 public void paint(Graphics2D g) {
  Graphics2D g2d = (Graphics2D) g;
  g2d.setColor(Color.WHITE);
  g2d.fillRect(0, 0, this.getWidth(), this.getHeight());
  g2d.setColor(Color.BLACK);
  g2d.setFont(new Font("Arial", Font.PLAIN, 20));
  this.writeAligned(20, "center", "Neko CM", g2d);
  g2d.setFont(new Font("Arial", Font.PLAIN, 11));
  this.writeAligned(-1, "left", "\nThis is an example\n"
    + "of NekoCM Print lib", g2d);
  this.writeAligned(-1, "right", "Enjoy~", g2d);
  this.writeAligned(-1, "center", "\n\nhttp://nekocm.blogspot.com", g2d);

 }

}

That will produce something like this



You can now download the Eclipse example project or just download the api.
Hope you find this useful! I will update this as soon as I improve it, although right now I'm more into BIP (which is also improving by the way ;))

Read more...

Generic Game

>> Saturday, April 24, 2010

BIP is 60% finished, and my first project with it, may be an overkill, aiming to improve it, (although it does not requires a tile map! which is what BIP is needing right now) I'll make a fighting game, but i want the game to be somehow like MUGEN, so you can customize the characters, each attack, animation, etc. I have interesting ideas, which I will post if i succeed with the first steps. Whish me luck!

Read more...

BIP - Managers

>> Thursday, April 22, 2010

I added a Sprite Manager and Audio Manager to BIP, now is very easy to load and play sounds. The Sprite Manager basically is a Vector with many sprites, so is easier to update and draw them all, is somewhat similar to DarkGDK way of managing sprites if you want to think it like that, you can check for collision doing something like this:

if(manager.pixelCollide(1, 5)) { /* Collision! */ }

That will check for collision between sprites 1 and 5.
Also I added a Button class inside the "gui" package, it's a very basic abstract class, the way you make buttons will be inherit from that class, and define your own actionPerformed method, then just call it with an image and a location, and optionally an image for the hover state.

BIP seems to be doing pretty nice so far, so I'm planning on using it in a small project now, which do not need tiled maps, to test it and improve it.

Read more...

  © Blogger template Simple n' Sweet by Ourblogtemplates.com 2009

Back to TOP