Sunday, 22 February 2015
Timing of the Loop
Pretty soon, I'll have to implement a "disable touch response" system, so that the user can't do anything during an animation that has to run to completion.
Thursday, 19 February 2015
Using a Rocket
Back to the drawing board...
Saturday, 14 February 2015
Multiple Sprite Interaction
Monday, 9 February 2015
Problems with Conditions that Affect Multiple Sprites
The particular case is when the rocket launcher already has a rocket in it, and the user tries to put a second rocket in the launcher.
Later still: A new test version of Jade is available via the link in the left hand column.
Furniture Sprites
Though Furniture sprites are INACTIVE (i.e. don't react to touch or collision), they sometimes have to be moved to and from Limbo, so their 'home' scene and location are remembered. Initially, I set up special variables to remember these, but it occurs to me that I could use a single Dropzone for the purpose. Saves coding.
Saturday, 7 February 2015
Rocket sprites
After long contemplation, decided that the furniture sprites, though they tend to be static, should also be MOVABLE, so they can be shoved into Limbo, as will happen with the dummy rockets. So probably type is an irrelevant attribute of Sprite, but I'll leave it there for the time being. The other attribute - GETTABLE, however, is significant, as is ACTIVE.
Thursday, 5 February 2015
Re: Switches, Conditional Scenes and Use of Inventory
I had thought I might have to implement a new class - Switches - to enable recognition of new conditions (e.g. Rocket already fired) and to give a handle to Save and Restart. However, I am now sure that Sprites themselves will be sufficient, either by detecting the the presence or position of a Sprite, or by creating a Zombie Sprite whose Position data can be used to indicate a state. The Zombie would be saved and restored like a carryable or movable Sprite. The Zombies would be in the Limbo scene (which is unreachable by players), and would never need to be drawn in real play, though inspection by developers of the Limbo scene would aid debugging..
Conditional Scenes:
I have now implemented a function in JadeData that inspects every destination scene before a scene switch, and changes the destination scene according to current game conditions.
Use of Inventory
Hitherto, if a carried sprite was dropped, and there was no specific dropzone on that scene, it was dropped into Inventory. I'm changing this so that Inventory drops only occur if there's a specific location in Inventory specified in the sprite dropzones. Otherwise, no drop will take place.
Sunday, 25 January 2015
Progress
Now need to design the code to allow change of Exit as a result of user action. For example, if the candle is present, the cave backgrounds are illuminated, so the destination screen might be different. Or to have the junk present. Also necessary to record the change so that a runtime save / restore can recreate the changes.
Wednesday, 21 January 2015
At the End of Another Long Gap
You haven't missed much. I made some performance improvements, added a cursor which follows the touch and stays where the last touch lifted. The major change happened after a painful time with Eclipse, on upgrading desktop hardware, then wifi problems, only finally resolved last week when when I migrated the project to Android Studio.
For a while last year, I was unable to work on povray because of remote accessibility, which I needed. So, I've moved onto the rocket cave in povray, and will be extending the game and the engine real soon now.
Thursday, 5 December 2013
Bug Fix
Fixed a bug whereby if a sprite was dropped on a page with no valid position so that it went to the inventory in the position of the inventory exit, then it couldn't be picked up!
Wednesday, 4 December 2013
Incredible time gap...
I built another test version which you can load from this handy link.
I was dissatisfied with the re-rendering engine in android java, so I built a version that only does a few sizes of playfield. It needs work, but it's viable.
Tuesday, 9 April 2013
Another Aide Memoire post
- 200 Hi N (junkhin) (with rocket launcher)
- 201 Hi S (junkhis) (above beach)
- 202 Hi W (junkhiw) (towards rocks)
- 203 Hi E (junkhie) (to distant sea)
- 204 Unlikely to use
- 205 Unlikely to use
- 206 Lo N Parked junk (junklopark)
- 207 Unlikely to use
- 208 Lo SW beach Probably won't use it
- 209 View back up cliff (junkloup) Cliff path painted in.
- 210 Lo South beach (junklosb) Landing place on lo level.
- 211 No use at present
- 212 High, looking down on beach but beach has to be painted in (junkhisx)
- 213 Lo N no junk (junklon)
- 214 Lo W (junklow)
- 215 Lo E Dark cave (junkloe)
Thursday, 4 April 2013
Catch-up
On Jade code, plans are afoot to distinguish between animated and static images for the same sprite. Also, it's now clearer how to restore configurations which are changed as a result of user action. e.g. where zone destinations have been altered, or resources used up, or doors opened.
Monday, 12 November 2012
Ignore this entry - I'm talking to myself.
- How to dispense rockets one by one only.
- Caves. Probably start again with new .pov file.
- Candle Illumination - cave dark without candle or with candle in inventory.
- Mirror the junkani pictures for speed.
- Stationary / moving junk - triggered by rocket.
- Rocket ignition without tube - explosion.
Sunday, 4 November 2012
Composite Sprites (contd.)
Tuesday, 30 October 2012
Composite Sprites
My first draft of this class quickly showed me the error of my ways, as the coordination of the multiple sub-sprites would be extremely difficult, due to scaling and flipping, for example. Especially scaling.
Unless.. the multiple subsprites were co-located - i.e. had the same position (which is a CENTRE position), even if this meant they had a lot of transparent content in them.
Once you do that, however, there's no longer any need for a composite class. You just mirror certain characteristics of the main sprite (position, scale etc.) on the subsprites, eliminating the need for a composite class.
Easier still, make the main sprite and the principal subsprite as a single sprite with all the necessary animations - say, the boat and its wake, and use a separate sub sprite for each of the other animations required.
So, long story short, no composite sprite class.
Sunday, 28 October 2012
Another Idle Month
I'm now ready to start setting up a more satisfactory demo version with some interesting action, so I'll be working in Povray a lot - a condition that isn't conducive to much reporting from me.
I'd like again to appeal to anyone who wants to collaborate on the Povray side. I'd be delighted to share the load and the credit with you.
Meanwhile, and this is the problem with me, I've seen another possible use of the Jade engine and I keep thinking about that instead of getting on with what I should be doing!
(below) Junk sprite with bluescreening.
Tuesday, 18 September 2012
Example Game
This is a "game" with just six scenes, and very little to do except pick up a candle and drop it, but the music and sound effects are there, and the options.
Try it if you dare. Actually it is very benign as alpha versions go. Other than its own running space and private data, it only uses the media player, and surrenders or pauses that whenever it loses focus.
It works for me on my Android Xoom, but I'm interested in the behaviour of other platforms.
From left to right the options are Quit, Restore, Save, Music On/Off, Inventory, Pause.
Double tap to pick up and drop the candle.
Sparing no expense, the source is also available at the same address.
http://amazonsystems.phpzilla.net
Monday, 17 September 2012
New Touch protocol in place
The next activity is definitely the prototype game. I've got all the elements I need in the engine now, I think. I just have to use these capabilities to write an acceptable mini game.
I've been a little disappointed by the appearance of some of my backgrounds on the Xoom. I'll experiment with less compressed jpg files.
Friday, 7 September 2012
Jade Sound
package uk.co.amazonsystems.jade;
import java.util.ArrayList;
import android.content.Context;
import android.media.MediaPlayer;
import android.media.SoundPool;
import android.media.AudioManager;
public class JadeSound
{
// This class handles all sounds. There are two sound sources. Use soundpool for short
// transient sounds. A single soundpool does all the sounds.
// For background music and ambient sound, Use MediaPlayer. Each sound is a new mediaplayer.
// Only one sound can be running at a time. All such sounds are looped.
public static final int OK_SOUND = 0;
public static final int BAD_SOUND = 1;
public static final int NOSUCH_SOUND = 2;
public static final int BAD_PLAY = 3;
private SoundPool soundpool = null;
private static int CHANNS = 4; // Sound Channels
private String soundName; // current ambient sound name
private int [] SFX = new int[CHANNS]; // Stream IDs
private int priority = 1;
private int soundid[]; // Sound IDs
private Context thiscontext;
private MediaPlayer mp;
private ArrayList soundfiles;
private int buggins;
private boolean soundstate = true;
// Initialise
public JadeSound(Context JadeContext, ArrayList SFXFiles)
{
thiscontext = JadeContext;
soundfiles = SFXFiles;
if (soundpool != null) soundpool.release();
soundpool = new SoundPool(4, AudioManager.STREAM_MUSIC, 0);
int temp = soundfiles.size();
soundid = new int [temp];
for (int ii = 0; ii < temp; ii++)
{
int resid = getRaw(thiscontext, soundfiles.get(ii));
if (resid == 0)
{
soundid[ii] = 0;
}
else
{
soundid[ii] = soundpool.load(thiscontext, resid, priority);
}
}
for (int ii = 0; ii < CHANNS; ii++)
{
SFX[ii] = -1;
}
buggins = 0;
}
public int playSFX(String name)
{
return playSFX(name, 0);
}
public int playSFX(String name, int Loop)
{
int index = soundfiles.indexOf(name);
if (index == -1)
{
return NOSUCH_SOUND;
}
else
{
soundpool.stop(SFX[buggins]);
if (soundid[index] != 0)
{
int reply = soundpool.play(soundid[index], 1, 1, priority, Loop, 1);
if (reply == 0) return BAD_PLAY;
SFX[buggins] = reply;
buggins++;
if (buggins >= CHANNS)
{
buggins = 0;
}
}
else return BAD_SOUND;
}
return OK_SOUND;
}
public int playAmbient(String name)
{
// if the same sound name, just exit immediately
// we use the same mp we used last time, and keep playing the same song
if (soundName != null)
{
if (soundName.equals(name))
{
return OK_SOUND;
}
}
// if the media player still in use, reset it, release it and null it
if (mp != null)
{
mp.reset();
mp.release();
mp = null;
}
// remember the new sound name for next call
soundName = name;
// find the sound file in raw
int resid = getRaw(thiscontext, name);
// if it's not there, return
if (resid == 0)
{
return BAD_SOUND;
}
// Finally, create a media player
mp = MediaPlayer.create(thiscontext, resid);
// if it doesn't work, return
if (mp == null) return BAD_SOUND;
// Ambient always loops
mp.setLooping(true);
// start the playback
mp.start();
// if the song flag is false, pause it
// we may have to start it later
if (!getSoundState())
pauseAmbient();
return OK_SOUND;
}
public void pauseAmbient()
{
if (mp != null)
{
mp.pause();
}
}
public void resumeAmbient()
{
if (getSoundState())
{
if (mp != null)
{
mp.start();
}
}
}
public void pauseAll()
{
if (soundpool != null) soundpool.autoPause();
pauseAmbient();
}
public void resumeAll()
{
if (soundpool != null) soundpool.autoResume();
resumeAmbient();
}
public void closeSound()
{
if (soundpool != null)
{
soundpool.release();
soundpool = null;
}
if (mp != null)
{
mp.reset();
mp.release();
mp = null;
}
}
public void setSoundState(boolean state)
{
soundstate = state;
}
public boolean getSoundState()
{
return soundstate;
}
// Helper method that translates a filename in res/raw to a resource id
public static int getRaw(Context context, String name)
{
return context.getResources().getIdentifier(name,
"raw", context.getPackageName());
}
}






