Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - camaleonyco

Pages: 1 2 3 ... 10
Journals / Re: Defendo an action arcade reflex game for iOS
« on: August 30, 2016, 11:11:56 am »
I would love to read a Defendo post-mortem. After 6 months I guess you already have enough data to evaluate the game success.

Ask a Question / Re: can't spawn large objects off screen
« on: May 05, 2016, 01:40:47 pm »
Do all the asteroids share the same properties on the Physics tab?

Ask a Question / Re: can't spawn large objects off screen
« on: May 05, 2016, 01:39:01 am »
Maybe your big asteroids are being created outside of the "active" area of the game.
Off Screen Actors Become Inactive

Something you may notice is that actors that are off screen stop working, as if they froze in time. We do this to preserve performance.

Nevertheless, there are cases where you want an actor to be active regardless of whether it’s on or off screen.

If your small asteroids are entering the active area before "falling asleep", they will act normal even you create them off-screen.

Wherever you are creating those asteroids, add a "make (last created actor) always active" block. You can also change the "active" area with the "Set Offscreen Bounds" block (

Ask a Question / Re: how to make a loading Scene?
« on: April 28, 2016, 10:58:22 am »
the "scene is not transitioning" bit is to ensure that the loading animatin is being shown. If you don't use it the game will start loading an atlas while the fade in is in progress, pausing the game and the fade in.

Ask a Question / Re: characters in show alert on iOS
« on: April 27, 2016, 05:06:29 pm »
Have you tried using the "unicode text" block from the External Data extension?
Returns the text with preserved Unicode characters. This is a workaround of Stencyl's automatic Unicode-to-code-point conversion, which results in glyphs outside the ASCII range encoding safely, but incorrectly.,35620.html

Ask a Question / Re: Not playing melee animation
« on: April 27, 2016, 05:02:55 pm »
I guess that it happens because the actor is already showing the melee animation (at least, the last frame of it). Try using both "Switch animation to..." and "Switch to frame 0..." on your event to send the playhead to the first frame of the animation.

Ask a Question / Re: Filing Maps
« on: April 27, 2016, 04:58:18 pm »
I use the External Data extension (,35620.0.html) to load a text file from the "extras" folder. There's a block in the same extension that split the text file into lines to create a list.

Take a look at the attached file, I loaded a CSV file and converted it into a 2-dimensional Array (a list of lists), but If you need a simple list, the first block will be enough.

You may want to run a loop to convert each item to the appropiate kind of object. For example, if you have a text file like:
Code: [Select]
After importing the file you will have a list of text strings, not booleans. You'll have to run something like:
Code: [Select]
repeat (number of items in "myList") times{
   replace item #(current loop count) with (((get item #(current loop count) in "myList")in all upper case)as boolean)in "myList"
Even if the file contains just numbers, the resulting list will have text strings, therefore you will have to convert the items to the right kind of object before using them.

Ask a Question / Re: how to make a loading Scene?
« on: April 27, 2016, 02:47:54 pm »
While the atlas is being loaded, the games pauses. So does the loading animation.

You can distribute your assets among many atlases and the load them in a sequence, like this:
Set NumberAttribute to 0
If <not<scene is transitioning>>{
   if <"NumberAttribute"<"NumberOfAtlases">{
      increment "NumberAttribute" by 1;
      Load atlas with ID "NumberAttribute";
      Switch to scene...
However: If your loading time is 15 seconds, and the loaded data is 86Mb, and you distribute the assets among 15 atlases (5.7Mb each), the loading animation will run at 1 frame per second... Maybe you can create even more atlases, to get a better fps count, but I don't know if there's a penalty for using too many atlases. Even if there is not, It isn't worth it in my opinion. I would place a loading bar instead, changing its width according to how many atlases has been loaded.

Sorry for my english.

Ask a Question / Re: Error when testing game
« on: April 27, 2016, 10:50:18 am »
The error message is pretty explanatory:
Code: [Select]
TypeError: Error #1009: Cannot access a property or method of a null object reference.Afaik, this means an attribute has no value and therefore the block cannot perform his action. Where?
Code: [Select]
at scripts::SceneEvents_0/init()[Source/scripts/SceneEvents_0.hx:88]Apparently, you can find it in the Events tab of the first scene you created (hence the "0" in "SceneEvents_0"). Since you use this tab for your code instead of an attached behaviour, you cannot switch to code mode to find the 88th line, but if you don't have custom events or custom code in there, I would guess that the null attribute can be found at the firts or second block in the "When Created" event.

Sorry for my english.

Ask a Question / Re: how to make a loading Scene?
« on: April 27, 2016, 10:28:23 am »
I've tried it on 3 Android devices and works great: Just Move everything to a different Atlas, leave just one "Loading" message or animation in the main Atlas and add an update event like:
If <not<scene is transitioning>>{
   Load atlas with ID 1;
    Switch to scene...

I don't know if the <if atlas with ID X is loaded> block has been deprecated, but you don't need it for a loading scene.

I'm not sure if this qualifies as a Shared Resource, but I don't know where else to post it. I have lot of actors on my scene and I wanted to arrange them using the Y-coordinate of each one. Becasue of the perspective I'm using, an actor with a higher Y value should always appear in front an actor with a lower Y value. I tried creating  a Map populated with all my actors and a their respective Y-coordinates, but it was really messy. I used the Array.sort(function) method, and it worked but I wanted something cleaner.

Then I found this:

It was exactly what I was looking for, using a simplier and cleaner method, so I implemented it on my game.

As you can see on the attached file (image only), I created a custom event called "ArrangeDepths", where I populate a list with all the actors that I need to sort - All the "TestTile" actors.

Then I call and Array.sort() method, that triggers the "sortByY" function, which compares a couple of items and returns an integer as a result. The returned value tells the Array.sort() method wheter the first item is greater than, less than or equal to the second item, and the method runs this function as many times as it needs to sort all the items.

Finally we take the sorted Array/list, and for each item we set its depth according with its place in the Array/list. Note that I didn't use the haxe "setChildIndex" methods, but Actor.setZIndex(index) instead.

Works like a charm for me (Sorting only 37 actors), and I thought it could be useful for someone else, so I wanted to share it. I'm sure you can adapt it for your own needs, for example: populating the list in a different way, sorting inside an update event or comparing X-coordinates instead.

Sorry for my English.

Extensions / Re: Video (MP4) [iOS/Android]
« on: March 27, 2016, 02:24:09 am »
@mdotedot Thanks a lot for your contribution!
It would be ideal to have blocks to set the size and position of the video player window, as well as the possibility of playing a video file stored in the "extras" folder to get an immediate video playback.
Also, it would be useful to have a block to check if the video playback has finished.
Exactly, without those 3 features the extension is not very useful to me. I tried to modify it to play the videos fullscreen on Android by default, without luck so far. Is anyone else trying to add those features?

Sorry for my English.

This is how switching scenes works:

Maybe your problem comes from your buttons:

 You'll need to post your behavior.

Ask a Question / Re: Why doesn't actor width change when you rotate it
« on: October 16, 2015, 03:43:49 am »
Your question isn't very clear to me, but if you have something like:

... and you want to know by and bx, the solution is simple:

NewWidth = (sin(Angle)*OriginalHeight)+(cos(Angle)*OriginlWidth)
NewHeight = (sin(Angle)*OriginlWidth)+(cos(Angle)*OriginalHeight)

Just remember to convert your degrees to radians before using an angle in a trigonometric function.

Ask a Question / Re: 16 bit images
« on: October 16, 2015, 02:48:18 am »
I've been reading about this subject on StackOverflow forums, and it seems like most developers don't understand what's the deal with 16bit textures. Maybe that's why my question doesn't get much attention here. I'll try to explain how this image format works and why it is important to use it.

16 bit graphics  and 16 bit channels
One thing that usually confuses people is that the 16 bit mode they use in Photoshop ( doesn't have anything to do with 16 bit graphics. Photoshop 16 bit mode is refereing to a 16 bits per channel format. That means that using the additive color system ( you will have 16 bits for the Red Channel, 16 bit for the Green Channel, and 16 bit for the Blue Channel.

If you do the math, 216 means each channel has 65536 levels, and the combination (65536 3) gives us 281 trillion possible colors. That's great, but each pixel takes 48 bits, or 64 if you add a 16 bit alpha channel (  48 bits per pixel, not 16.

Stencyl uses the standard 8 bits per channel, which means 24 bits per pixel, or 32 if you need the alpha channel. However, both iOS and Android support 16 bit-per-pixel images, which usually has 4 bits per channel. 4 bits for Red + 4 Green + 4 Blue + 4 Alpha =16 bits per pixel.

What's great about 16 bit graphics?
They are smaller. Doing the math, again, a 2048x2048 atlas that uses 32bit pixels has a file size of 16 Mb. The same atlas using 16bit pixels: just 8Mb.

What's wrong with 16 bit graphics?
Well, because of how binary numbers work,  even when the file size of a 16 bit image is half of the 32 bit image file size, the number of colors is far from that proportion. Where 32 bit images can show a palette of 16 million colors with 256 degrees of transparency... a 16 bit image shows only 4096, with 16 degrees of transparency. These images show the same gradation using a 32bit and 16bit palette.


Pretty bad, right? You are losing 99.975% of the color spectrum to get 50% lighter atlases.

How to fix that?
Take a look at this link:
The first map uses a regular 32 bit image (actually 24 bit, it doesnt use the alpha channel). The second map shows a 16 bit image without alpha channel. This image uses 5 bits for the red channel, 6 for the green channel, 5 for the blue channel. This RGB565 16 bit format shows 65536 colors, lot more than 4096, but still far from 16 million colors. However, do you really miss them? The nature of the image helps to hide this reduced palette.

Now compare RGBA8888 and RGBA4444. The first one, with 32 bits per pixel, shows a nice color gradation, where the second one with 16 bits per pixel looks horrible, showing hard edges instead of blending the colors. I think this is the reason why Jon took the 16 bit conversion option out of Stencyl a couple of years ago. He said "When I played around with them, I found the graphics degradation to be quite bad, especially for things with gradients". It's understandable, but the problem comes from the  conversion method. When you have a restricted palette, you need to find ways to trick the eye of the player. That's when dithering comes in handy(


The first image has a full 32bit palette. The second one is not a 16bit image but has a reduced palette (just 64 colors). Looks terrible with the usual "color areas" with hard edges. That's what Jon was talking about. The third image thou, has the same palette and a diffusion dither. The granular look might bother you, but you wouldn't believe how many games are out there that use the same dithering technique and no one notice it.

More Examples

Here's another example from the TexturePacker website:

Let's try again with the first example. A 32bit grayscale, from white to black, has only 256 steps... sometimes they aren't enough. A 16bit grayscale has 16 steps, so few that you can count them on screen. But when we use a dithering noise:


Much better. If the granular look still bothers you, imagine this gradient 1 inch tall. That's how it would look on a retina display. Can you see a pixel on an iPhone 6+ without a magnifying glass? Now that most of the mobile devices have such high pixel density displays, the grain doesn't matter that much. Here's a screenshot of my first game:

I won't lie: the grain is still visible on my ipod 4, but you need to get really close. If you don't want your plain colors to get grainy you just need to use 16bit safe colors. That means you need to repeat the same hex digit  on every channel. For example, instead of using #42DA87 you should use #44DD88. I didn't knew this back then, and thats why the plain colors on my backgrounds have a granular look.

Why should I care about this?

In many cases, saving some megabytes won't matter. If your entire game runs with only a couple of atlases, just load both of them at the beginning and forget about my rant.

I'm a graphic designer, and that's why I care. When you make a mobile game, and you want it to look really good, you might need to add more content, more assets. Maybe you want to have 2 or 3  backgrounds in paralax. Maybe you want to double the number of frames on your animations to make them smooth. Maybe you want to experiment with hand-made terrains. Add big-ass bosses. Cool explosion animations. A fighting game with a lot of moves and tons of characters.

At one point or another you will have a memory crash on an old device, and then on a not-so-old device, and so on. Before you know it, the game will only run on the iPhone 8+++.

Most of the memory issues you have to deal with are related to the amount of graphics you have loaded on memory. If you have found the limit of Mb  you can load in order to avoid a memory crash on all the devices you want to support, you might feel frustrated, because that single low-end device (Maybe an iPhone 4, maybe an old Galaxy model) is deciding how much content you can have. But if Stencyl gives you the 16bit atlas option, suddenly you can have twice the content. Twice the amount of backgrounds, enemies, animated effects, etc.

Or maybe the problem is that your game is just too big, because in a moment of madness you decided to hand-draw each level (remember that if a iOS game is bigger than 100Mb you can't download it over a 3g connection). 16bit graphics will bring down the file size of all your art assets. In some cases, 16bit animations can even improve your FPS count.

Yes, there are valid reason to ask for this feature, and that's why I ask. Is there any method to use 16 bit graphics on a Stencyl project? I hope someone from the Stencyl crew can shed some light on this matter.

Sorry for the wall of text, and sorry for my English.

Pages: 1 2 3 ... 10