Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Topics - Irony

Pages: [1] 2
Support / [SOLVED] Too dumb to use setorientiation...
« on: May 09, 2015, 12:43:33 pm »
I want a shot to point towards a certain target but it points in some strange direction.
Do you see any obvious flaw in my code?

Code: [Select]
vTargetPos.sub(vPlayerPos);  //to get direction vector
vUp.set(vTargetPos.calcCross(VECTOR_LEFT));   // I do not care about the up vector, so I calculate an abitrary one
shot.setOrientation(vTargetPos, vUp);

As said, this does not work at all. Don't ask how I managed to finish my space shooter without figuring basic stuff like this out   ::)
btw: "Direction" in setorientation means positive z-axis - right?

Support / Simplevector.normalize(v)
« on: March 24, 2015, 12:30:59 pm »
Sorry for being so anal, but I somehow don't like to see vec.normalize(vec) in my code ;)
Any specific reason why it's not a static method?

Support / Is there a way to remove a texture from an object?
« on: November 16, 2014, 09:05:06 pm »
See subject :)

Support / Which comes first: setvertexcontroller or build?
« on: November 09, 2014, 03:50:48 pm »
When I setvertexcontroller before build(), there is a warning about normals. When I set vertexcontroller after build, applyvertexcontroller seems to have no effect.
I have read and experienced some contradicting things about the topic.

Maybe it's important to mention that there is a rotateMesh call in there as well.

Support / Non-uniform scaling
« on: August 15, 2014, 01:41:58 pm »
It would be really convenient to have a non-uniform scale function for Object3D, something like scale(x,y,z). (I know there are ways to achieve that, but not as comfortable.)
Do you have any plans to implement that someday?

When I call
setScale (distanceToCamera)
on an object, shouldn't it always appear at the same size regardless of distance?  It seems to not work that way, so maybe my thought is wrong?

Projects / Armada RELEASE
« on: July 02, 2014, 09:10:43 pm »
A journey that has taken over two years is coming to an end.
Besides some sub-standard texts and most likely a few bugs, Armada - Mobile Space Combat - is finished (though there will probably be continuous updates after publishing).
Anyone willing to try out the beta version, please direct your mobile browser to this address: (Use the link in the last post!)

Or use this QR code:

Those two nice guys are already waiting for some new friends and enemies:

Have fun!

P.S. Feeback is the lifeblood of all indie devs, so thanks to everyone in advance!
cu, Irony

Support / Image not visible
« on: May 17, 2014, 08:55:17 pm »
Hey Egon,
do you have any idea why I don't see the title image?

This in ondrawFrame()

      if (man.state==SM.STATE_TITLE) {
         if (!tm.containsTexture("title1")) {
            Log.d("draw", "load title");
            tm.addTexture("title1", new Texture("title1.png"), true));
         fb.blit(tm.getTexture("title1"), 0, 0, 100, 100, 512, 512, 200, 200, 100, false);

05-17 20:52:56.903: D/draw(9336): load title
05-17 20:52:59.456: D/draw(9336): draw title
05-17 20:52:59.476: D/draw(9336): draw title
05-17 20:52:59.496: D/draw(9336): draw title

Hi guys
after resisting for a long time,  I did the unthinkable and built an Indiegogo page to help the game get finished and polish it up. Not asking for a crazy amount, just enough to get in-game music and some other assets. Yeah, it's e-begging, but at least it's for a somewhat reasonable sum. (Will Wheaton is making a web series showing him playing board games with a few friends, and is asking for a million dollars to film it, so hey :)
Even if you cannot imagine giving out any cash, there is still a lot of information about the game I haven't posted before, so take a look if you're interested:
Thanks guys.

Projects / Armada Gameplay video
« on: April 25, 2014, 11:48:36 pm »
Time for another update.
For those who didn't have the chance to play the alpha before, this video shows a typical mission and how the virtual stick works.

Support / Rotating skybox
« on: April 18, 2014, 10:48:41 pm »
Egon, do you think there is any chance that some day you add a function to rotate the skybox?
I've set up the different mission types of my space game with fixed coordinates, so you are always flying against the same background. It would be really nice if I could simulate that the mission paths are different each time, without having to adjust all coordinates for all 13 mission types. There are hundreds of them...
I'm sure there are other uses for this as well, like a rotating background.

Support / Texture loading questions
« on: April 16, 2014, 10:02:50 pm »
1. When I call addTexture from onDrawFrame() , does it block or will onDrawFrame continue?
2. When TextureManager.containsTexture returns true, is the texture already fully loaded?

If 1 and 2 are No, how can I check if a texture has been completely loaded?

Support / Overlay glitching out?
« on: March 25, 2014, 08:37:35 pm »
Egon, can you make a wild guess what could be wrong if an overlay is not visible? It should be rendered on world.renderscene, right?

Debug code:
Code: [Select]

if (arrow==null) arrow = new Overlay(, fb, "arrow");
arrow.setNewCoordinates(50, 50, 200, 200);

Still, no overlay :(

Bugs / Mipmap creates black texture?
« on: February 09, 2014, 10:38:32 pm »
I did setMipmap(true) after loading a texture. Strangely, it turned out black then. I don't get this - isn't mipmapping turned on by default anyway?

Support / Code snippet: Nicer buttons with 9-Patches
« on: December 29, 2013, 02:05:08 pm »
A nine-patch is a bitmap that is very useful for GUI elements.
Usually, when you blit-scale your buttons for different resolutions, they may look like that:

Wouldn't it be much nicer if they looked like that:

You can do this with a 9Patch, where only the inner area gets scaled in two directions; the corners do not get scaled at all, while the borders only scale in one direction (horizontally or vertical).

There is no built-in support in JPCT-AE for it, so I adapted the blit function to write my own implementation. It's not a 1:1 adaptation (scaleable area is supported, but not fill area).

First, you will need a source bitmap like this:

Zoomed in to better show the black borders. They need to be on the first horizontal and vertical stripe of the image and show where the inner zone begins and ends. The borders themselves do not get blitted.
I made the button translucent inside, but that is not mandatory.

Here is the code:

Code: [Select]

class NinePatch {

  private int[]X = new int[2];
private int[]Y = new int[2]; //These hold the scale zone coordinates
private int W, H;  // Input bitmap dimensions
private Texture tex;
private String name;

public Space9Patch(Bitmap b, String name) {  // Make sure b is not scaled! It is best to use a white picture so you can blit it in any color later on = name;

W = b.getWidth();
H = b.getHeight();
X[0] = X[1] = Y[0] = Y[1] = -1; //Start and end positions of inner scale zone

for (int x=0; x<W; x++) { // Analyze first horizontal stripe of bitmap
if (b.getPixel(x, 0) == Color.BLACK && X[0] == -1) { // Look for black pixel
X[0] = x;   //Save position of first black pixel
else if (b.getPixel(x, 0) == Color.TRANSPARENT && X[0]>=0) {  //Look for first transparent pixel after black stripe
X[1] = x-1;  //Save position of last black pixel

for (int y=0; y<H; y++) { // Analyze first vertical stripe
if (b.getPixel(0, y) == Color.BLACK && Y[0] == -1) { //same as above but in vertical direction
Y[0] = y;
else if (b.getPixel(0, y) == Color.TRANSPARENT && Y[0]>=0) {
Y[1] = y-1;

//Create texture from bitmap
TextureManager tm = TextureManager.getInstance();
if (!tm.containsTexture(name)) tm.addTexture(name, new Texture(b, true));
tex = tm.getTexture(name);

//Draw 9-patch in abitrary size and additional color
public void blit(FrameBuffer fb, int x, int y, int w, int h, int transp, RGBColor col) {
fb.blit(tex, 1, 1, x, y, X[0]-1, Y[0]-1, X[0], Y[0], transp, false, col);
            fb.blit(tex, X[0], 1, x+X[0], y, X[1] - X[0]+1, Y[0]-1, w- X[0]- (W-X[1])+1, Y[0], transp, false, col);
fb.blit(tex, X[1]+1, 1, x+w-(W-X[1])+1, y, W-X[1]-1, Y[0]-1, W-X[1]-1, Y[0], transp, false, col);

fb.blit(tex, 1, Y[0], x, y+Y[0], X[0]-1, Y[1] - Y[0]+1, X[0], h - Y[0] - (H-Y[1]) + 1, transp, false, col);
fb.blit(tex, X[0], Y[0], x+X[0], y+Y[0], X[1]-X[0]+1, Y[1]-Y[0]+1, w-X[0] - (W-X[1])+1, h - Y[0] - (H-Y[1])+1, transp, false, col);
fb.blit(tex, X[1]+1, Y[0], x+w-(W-X[1])+1, y+Y[0], W-X[1]-1, Y[1] - Y[0]+1, W-X[1]-1, h - Y[0] - (H-Y[1])+1, transp, false, col);

fb.blit(tex, 1, Y[1]+1, x, y+h-(H-Y[1])+1, X[0], H-Y[1]-1, X[0], H-Y[1]-1, transp, false, col);
fb.blit(tex, X[0], Y[1]+1, x+X[0], y+h-(H-Y[1])+1, X[1] - X[0]+1, H-Y[1]-2, w - X[0] - (W-X[1])+1, H-Y[1]-1, transp, false, col);
fb.blit(tex, X[1]+1, Y[1]+1, x+w-(W-X[1])+1, y+h-(H-Y[1])+1, W-X[1]-1, H-Y[1]-2, W-X[1]-1, H-Y[1]-1, transp, false, col);

//Blit using original color
public void blit(FrameBuffer fb, int x, int y, int w, int h, int transp) {
blit(fb, x, y, w, h, transp, RGBColor.WHITE);

Pages: [1] 2