Tuesday, January 26, 2016

Collision Detection

So I've been having issues with collision detection. I've tried using a method that looks at the images' size and location to determine collision. In the code, I compared that method against the form-fitting collision box method, printing to the system dialogue when they don't match up. I used the data of the collision boxes' sizes and locations, along with the images sizes and locations.


What we get from this is that the soul's collision box isn't moving properly with its image (JLabel). However, as you can see from the overlapping red and purple, the projectiles themselves have matching images and collision boxes (the image just happens to be slightly bigger than the collision box, due to empty space at the bottom of the image). I find this very strange, as Projectile and Soul are classes that both extend another class, CollisionLabel, which handles everything to do with movement and collision boxes. If one works, so should the other, but that's not the case. I'll continue working on this issue and make a new post when I run into a new problem and/or fix this one.

Edit: The error was really simple, actually. Soul's move method calls CollisionLabel's setLocation method, which doesn't work, while Projectile's move method calls CollisionLabel's moveLocation method, which does work. For now, I've implemented a simple work around by calling CollisionLabel's moveLocation method in Soul's move method. This does cause some issues, however, when trying to set a Soul object's location. I will work on fixing the setLocation method.

Wednesday, January 20, 2016

Introduction

Hi!

This is the blog for the development of my Undertale battle engine, built in Java. It's being built to be developer-friendly, so all of you who know Java can make your own custom battles. I've already done most of the work, so this blog will only track the tail end of development. By the end, I will have a complete engine that allows users to build their own battles, using provided attack patterns or custom ones, and a full battle to go with it. All battles made in Javatale will be fully playable by all fans, even those who don't know Java! So far, I've got the main buttons (FIGHT, ACT, ITEM, and MERCY), the battle sequence with a red soul (collision detection, projectiles, soul movement, health, etc.), and dialogue box dialogue working. Here's some screenshots:





Before anyone asks, it is compatible with both Mac and Windows (I don't own a Linux, so I can't say as far as that goes). In the future, I may build an application (and extension to Javatale to make them compatible) so that even fans who don't know Java can build their own battles, too. I'll update this blog as I work on it, so look forward to future updates!