Wednesday, November 19, 2014

sine wave (construct 2)

Apparently, I had a need to create a scene where the X position of consecutive objects was determined with sine function. Simultaneously, objects were moving from top to bottom, keeping their X position all the time until they exit the screen.

Please see sine wave demo (html5) to get an idea what I was trying to do.

The ready-made "Sine" function of Construct 2 was not suitable in this case, because I did not want to make the series of objects to look like a worm. :)


Task is not too complicated and math it pretty easy, but anyways I decided to create an example showing my solution. Please find an example .capx file here: gamaan.com/files/sine_demo.capx

If you are not willing to download .capx from my own server, the screenshot below shows the most critical points to implement this behavior:
















Basically, you will need following events and variables to make things working:










xPosDelta determines the "steps" in which the objects are created. You can try to change the value of this variable to see how it affects to the sine wave. X coordinate for each object is calculated using xPos variable:

sin(xPos)*100 + 200

Where 100 is amplitude and 200 the offset of sine wave. You can also try to modify these to see how sine wave changes.

When object is created, xPos is increased by xPosDelta. If xPos > 360 (full circle), then the value of xPos is resetted to initial value (2*xPosDelta). This is just to keep sine wave continuous.

"Bullet" behavior is required to implement vertical movement. I also added "DestroyOutsideLayout" behavior to make sure that objects are destroyed when exiting the screen.

-Jussi

Friday, November 7, 2014

"DualBall" released

This is just to inform, that "DualBall" flash version was released yesterday to Newgrounds (click picture to access the game). Judgment process has already been passed, and users have rated the game to 2.88 stars (out of 5) currently.



But it is a bit different story if this was worth all the effort.

For some reason, this game has several setbacks during the development process (HDD failure, migrating from Linux environment to Windows, some lack of motivation, lost asset library, etc.). Anyways, we were able to finish and publish this game.

We started developing this game somewhere in the beginning of August. I had an obsession to try how two objects could be controlled by turns using just one mouse button (or touch on mobile device). Even if I have not yet released any mobile games, I have spent lot of time thinking the UI for them. Anyways, when you are planning a game for mobile devices, you should keep in mind that controls should be as simple as possible. There is no keyboard attached in most of the touch screen devices, so in most case it is wise to limit input according to that.

So from this kind of a starting point we launched the development of "DualBall". :) Original idea was to make both flash and Android version using Stencyl, but at some point Android version was dropped out from the plans.

In practice game is working well on my tablet, but my current plans does not include buying the Stencyl license. I have already acquired the license for Construct 2, and it should be enough at this point. But if it turns out that there are tens of thousands of players for this game in Newgrounds, then I might consider the mobile version. :) 

-Jussi