Saturday, 21 May 2016

When it kinda works

Finished my test animation and made a video with test controls. She runs, she jumps and she stops!

Looks like it all works but… it actually doesn’t.

Run into trouble with transition.pause(). It took me pointless hours of changing code — and after creating a new simple project to test it, I can say — it is the problem with Corona’s built-in function, and not with my code.

As you can see on the video, character can run and stop, and jump and stop. But if you use controls to jump, run and then stop — transition.pause() won’t work.

The example from my simple project:
We have a background transitioning to the left.
A static object (or sprite).
Set of controls triggering events Listeners that catch events, pause or resume background transition, and call a function that changes the position of the static object.

Problem: transition.pause() doesn’t work if you resumed it more than once before. Though if you do catch event with transition.pause() 2 times — it will pause, as if it stops resume 1 and than stops resume 2.

Google doesn’t know what to do with this. I don’t know either.

Luckily for me, in my game user won’t ever get a chance to use “stop” control — all scenes where character stops are script-driven. But still, it would be nice to know how the hell I can fix that 8(((

Friday, 20 May 2016

Menu and opening

Most of the week I was fighting with project architecture. Though problem was not the architecture per se, but myself mostly. My ideal project architecture looks like that: everything is global, and everything is available to everyone at any given time. You call it anarchy, I call it freedom, blah blah.

With this mindset I always end up with main.lua about 20k lines.

So this time I decided to do it the right way (kind of), and use packages. It worked out fine — until I got a dialogue package, and an act package, where the act triggers the related dialogues, and the dialogues had to trigger each other, and the animations that are in the act package that just triggered this dialogue. The word “mess” doesn’t even start to describe it.

4 days and many swear words later, I sorted it out. At least now I have a file called gameplay.lua, because… why not?

The proof of concept:

Actually, I also finished spritesheets and animations for a test character. But before I can show it to anyone, I need to work a bit on the controls, and I am too drunk to do that today (It’s Friday, yeeeeiii!)

Monday, 9 May 2016

Endless run and endless troubles 8)

I decided to take a small break from interactive stories (still working on Russian translation, and Android version of Koschei though) and get acquainted with Corona physics.
So from now on, at least until I released update for Koschei, I am going to work on my endless run game.

First, I thought about developing a platformer, but endless run is a bit easier to make.
Now I enjoy the "research" stage. I installed Temple Run, Subway surf, Jetpack, Joan Mad Run, Nyan Cat, Nosferatu and Rush City 8))

But I don't just play games, I actually started working on my own endless run and immediately ran into trouble (irony!).

I still use Corona, but this time I started with a setup for several devices. There's a very good tutorial about it and it actually works perfectly. Until I decided to load my stage.

At this point, I don't want to spend too much time optimising stuff - so I simply load an image and fill a rectangle with it, repeating it as many times as I need (actually there are 3 textures and 3 rectangles to create a parallax effect, but who cares 8))
And... Corona magically resizes it, but instead of fitting the screen based on base resolution, as it says in tutorial, it re-aligns it to the middle of the screen, making a margin at the top for iOS status bar.

The only fix I have found so far is:
Instead of using an example of actual device resolution by default (for instance 1024x768), I use an average resolution for all available devices (1136x710) and Corona adjusts it a bit, leaving out parts off the screen. Then I create background images with this resolution, keeping in mind that some parts of it will be omitted on different devices.

So, here it is, my first parallax (all textures are just for testing, they will be redrawn later)