Tile Scrolling with Maps Made with my Map Editor

Little tutorial on scrolling a map/world made with my Map Editor.

First, the source code in full:

Quite straight forward, but some words about the code.

In the Map Editor dat-file, the first 4 byte integer declares the width of the map, the second the height of the map in tiles. The size of the map is read first, then the map itself.

The scrolling is made with touch screen in mind.

The meaning of the Abs(…)-sentence is, that in which direction in the touch screen the finger is being moved most and then the map is scrolled into that direction.

The 256 color shapes of the world are from an Ultima IV remake and are free to be used. The original project is “xu4”, if my memory servers me right.

The source above is places to public domain as license for it.

Please, if you make a game (in any programming language) utilizing my code, show me, what you have achieved. I’m big fan of games of this kind of genre.

 

For the end a video regarding this post. At the beginning of the video there’s some scrolling:

 

 

Memorable Melodies v1.2 available

Memorable Melodies v1.2 is no longer at beta testing phase, now available on Google Play. There seemed to have been problem sometimes playing the music. I’ve tried to fix the problem as well as I can.

When programming in Cerberus X with Android target, there are two states for MusicPlaying(): -1, 0, 1.

  • 0: Music is not playing
  • 1: Music is playing
  • -1: Cannot determine if music is playing

Version 1.2 checks if the state is -1 and if it is, the game tries to play the music until MusicState() = 1.

Because the game is also meant to children, I’ve included a cheat in the game: Pressing at the upper right corner of the screen during game play clears all the mistakes. Now one can compete against onself as one wishes.

Below is a video of me playing the game on tablet:

 

The game is free and without ads.

Embedding HTML5 output of Cerberus X to WordPress pages

The first thing you need is Code Embed plugin.

If your HTML5 output code loads files, something must be changed in the JavaScript-code. Find the following piece of code:

The URL of the data drawer must be changed. If you have the data drawer at the root of your www (public_html) drawer, change the “path.slice” line like this:

If you’re working offline with some server program and have a testsite to experiment with, the path can be found as follows:

The y-coordinate of the mouse need also some adjustment, if the page has scrollbar: The y-start depends on the position of the scrollbar.

Find the following function:

The y-coordinate is correct with following change:

With the touch screen no additional changes need to be done.

While working with WordPress, the “tool/status” bar of WordPress changes the y-coordinate too, but the visitor on your page doesn’t have that page with the “tool/status” bar of WordPress. 🙂

You’ll probably want to remove the console from the page, too. Just remove all the references to splitter and console from the CerberusGame.html.

I almost forgot, in CerberusGame.html use absolute path to find the JavaScript-file. For example src=”https://yoursite.com/drawer/program.js”. Perhaps at first is good practice to try with all the contents of the default CerberusGame.html, so that you see that everything is working.

This should help.

As an example in practice, you might want check my online games corner.

Good luck!

You can be Memorable Melodies v1.2 beta tester!

Memorable Melodies v1.2 is at beta testing phase. You (anyone) can be a beta tester via Google+ community Android Developers. Find my post there and use the link I’ve provided to become a beta tester.

I’m not sure if there is anything more I can do with current version of Cerberus X to make it more compatible to different Android devices.  On my good old tablet that runs with Android version 4.4.2 the game has worked fine from the very beginning of version 1.0. The game is compiled to Android with SDK for Android 8.0.

Version 1.2 beta has “secret” cheat to clear all the mistakes made. I’ve decided to leave the cheat to the game so that one can compete against oneself as one wishes. The “secret” cheat is to tap at the upper right corner of the screen during game play to clear all the mistakes. Useful also to beta testers.

 

Old School XII – Unlimited Objects

The idea to Old School XII comes from Amiga demos from the early 90’s. First there was lots of competition in the Amiga demo scene on who makes a demo with most amount of bobs (blitter objects) in one 50Hz frame. Eventually we saw bob demos with unlimited amount of bobs!

The amount of bobs is basically unlimited; only the visible area of the screen limits the amount of moving bobs. This is achieved with actually only one bob!

I made today this effect in Monkey X.

The implementation in Monkey X is done by using multiple canvases with images. One canvas is used to draw into screen, the rest of of the canvases are used to achieve the unlimited objects effect.

Below is the video of the Monkey X implementation:

I haven’t yet tested if less amount of canvases is sufficient, but in the beginning of the code I wrote the following:

The only object is drawn subsequently to each of created canvases. The following line does the magic of unlimited objects:
For the end below is one Amiga demo with unlimited bobs:

I made HD (or HQ) version of the video later today:

That’s all for now!

My First Android Game Published on Google Play

This game project started in the year 2015. A long time passed I’m doing nothing for the game, but finally its ready and published!

The project started with Monkey X, but I finished it with Cerberus X and compiled it to Android. I have not — at least not yet — plans for a free PC version.

Before publishing I ran the tests that Google offers for the app. My app passed with zero crashes. 🙂

You might want to take a look at the game played with PC in the video above.

Like I wrote in “Shorty about computer playing history” post, if I’m ever to create a game, it would always have an ending and so does this game have.

The game is free (no ads) you might want to try it with your Android device, search for “Memorable Melodies” on Google Play. Or get here:

I hope you like it!

Starfield cube 2 and other Blitz3D demos

I haven’t done much 3D programming in Blitz3D. You can achieve quite a lot with a small effort with it. Also in Monkey2 programming language is the main functionality of Blitz3D. The idea to program a starfield cube came from an Amiga remix tune, that has speech in it: ”Starfield in a box. OMG it is rotating!” Back in the time it was hard to program things like that in assembly on Amiga. Nowadays even I can put a code together, that does the job in Blitz3D.

Starfield cube 2:

Making the starfield cube 2 program made me to create also the following video as a result of inspiration with Blitz3D:

The tiger in the cube (in some parts of the video) is from a photo of my trip to Zoo of Helsinki (Korkeasaaren eläintarha). The tiger seemed to be a bit stressed while people were watching it. Though, I remember someone saying it’s smart, because it uses the same always the same paths, when walking.

Version 1.05 of Order the Chaos games published

Now both Order the Chaos and Order the Chaos II work like charm with touch screen. There seem to have been problem with PCs with slow hard drives to run the games. This should be fixed now. I have tested the games on three different PCs and the games work fine on all of them. The oldest of the test PCs is an old laptop running Windows XP.

The video below gives an impression on the playing experience with touch screen in Ordetr the Chaos II:

The playability is much better than in version 1.03.

The games come with a zip-archive without an installer.

I hope you like the games! 🙂

Touching an Image in Cerberus X

This post is the 3rd in the series of touching an image pixel accurately. The second one is too complicated, now I have kept it clear and simple.

The image to be touch is middle handled (this makes scaling easier) and the image both moves and is scaled real time.

Here’s the source code:

The actual test is made for the original image data, that is left intact. Because the image is middle handled in order to get the top left corner of the image, one must decrease half of the width and height of the image from the x, y of the image. But as the image is scaled the actual graphical top left corner is x – (width / 2) * scale and y – (height / 2) * scale.

When then top left corner of the rectangle is calculated, to this is added the scaled size: width * scale and height * scale. This is taken care of in the if-sentence, when checking if in the rectangle is touched.

When one has the touching point, the point in the image must be “scaled” by the scale factor, see the commented part of the code for this.

In the actual test is tested is the picture’s alpha value in the calculated point <> 0; if it is, the image that has transparent pixels, must have been touched.

Clear and simple. 🙂

Below is a video of regarding this post:

If you want to compile this in Monkey X, just change in the LoadImageData-part “cerberus” to “monkey”.

Update:

In my Memorable Melodies  game is used slightly different code to touch the images, because the images to be touched don’t have “holes”.

New year, new programming language

Blow from the past… Cerbeus X programming language is based on Monkey X, and has dedicated community behind it. With quick look to the language, it seems that fonts are handled in a different way, more advanced way.

Below is Old School XI demonstration made in Cerberus X.

I changed the colors a bit and had to change the light position to a positive value, rest goes like in good old Monkey X programming.

You’ll probably see here some Cerberus X tutorials in the future and practically all my Monkey X tutorials help you to get started with Cerberus X. Stay tuned! 🙂

Let’s have a great year!