Community FAQ

captaincomic

  • *
  • Posts: 6108
I didn't know where to start this topic, I'm not really asking a question here, but it's about frequently asked questions, so that's why I post it here :)

I noticed that there is no FAQ about creating behaviors. I thought it would be nice if we could collect the most commonly asked questions and the most frequently encountered problems and put it in a nice FAQ page.

So how about everybody contributes questions / problems that appear to be common?

I start :)

Q: Two of my actors don't collide, even if the collision groups are set correctly. /
One of my actors doesn't collide with tiles, even if the collision groups are set correctly.
What's going on?

A: Probably the actors are set to "cannot be pushed". Two actors that cannot be pushed cannot collide with each other. Tiles cannot be pushed, therefore any actor that is set to "cannot be pushed" cannot collide with a tile.


Q: Why is my game suddenly slowing down and almost freezing?

A: Check the console. Maybe error messages are flooding the console and causing the slowdown. If this is not the case be sure you don't create a new actor every frame in the "always"-section.

How about it?

Abigayl

  • Posts: 807
Q: My game keeps freezing and giving me a null reference error?

A: Check each of your actor behaviors; for ANY time delay or time loop, immediately inside you need to check "if self is alive" (self is alive is under Actor -> Properties) and then place the coding inside of the check.

(i.e. Do every 1 second < if self is alive < coding > >)
If you need help, please check my tutorials either here or Kongregate (http://www.kongregate.com/accounts/Abigayl) or come over to my stream: http://www.livestream.com/poweredbyflowers

Hectate

  • *
  • Posts: 4643
Q: Why do my tiles now show properly in the scene when testing the game? (tiles may be not drawn, partially drawn, or have the wrong tiles displayed)

A: Check to make sure that the tileset you are using has tiles that match the scene's tile size settings. For instance, you will only want to use a 32x32 tile size tileset on a scene which has the tile size settings set to 32x32 pixels.
:
:
Patience is a Virtue,
But Haste is my Life.
Proud member of the League of Idiotic Stencylers; doing things in Stencyl that probably shouldn't be done.

captaincomic

  • *
  • Posts: 6108
Great! :)

Q: I want an actor to stay on the same position on the screen, even when the camera moves (e.g. a HUD element). How do I do that?

A: Use the "anchor <Self> to screen"-block. Put the block in the "when created"-section in an actor behavior and attach it to the actor.


Q: Why does my player actor vanish/freeze when it is about to leave the screen? /
Why is it not possible to create actors outside of the screen?.

A: By default actors stop simulating when they leave the screen. Use the "make <Self> always simulate"-block for any of your actors that are supposed to exist outside of the screen.
Put the block in the "when created"-section in an actor behavior and attach it your actors.

« Last Edit: February 07, 2012, 02:00:52 pm by captaincomic »

rob1221

  • *
  • Posts: 9473
Q: Why does my game stop working when I recycle actors?

A: A common cause of this is trying to recycle a non-recycled actor.  There is a separate block for creating recycled actors which appears near the block that recycles them.  Likewise, you shouldn't try to kill a recycled actor.  Normal actors are killed; recycled actors are recycled.

Hectate

  • *
  • Posts: 4643
Q: Why does my player actor vanish/freeze when it is about to leave the screen? /
Why is it not possible to create actors outside of the screen?.

A: By default actors are killed when they leave the screen. Use the "make <Self> always simulate"-block for any of your actors that are supposed to exist outside of the screen.
Put the block in the "when created"-section in an actor behavior and attach it your actors.
Actually, the actors are not killed, the engine merely stops processing them entirely - it stops simulating their existence (thus the need for "always simulate"). If the camera were to move so that their last X/Y position comes back on screen, they will begin simulating again. Since their behaviors/code does not run while they are not simulating, other behaviors (other actors, scene behaviors) would have to be used to bring them back on-screen.
:
:
Patience is a Virtue,
But Haste is my Life.
Proud member of the League of Idiotic Stencylers; doing things in Stencyl that probably shouldn't be done.

captaincomic

  • *
  • Posts: 6108
Actually, the actors are not killed, the engine merely stops processing them entirely - it stops simulating their existence (thus the need for "always simulate"). If the camera were to move so that their last X/Y position comes back on screen, they will begin simulating again. Since their behaviors/code does not run while they are not simulating, other behaviors (other actors, scene behaviors) would have to be used to bring them back on-screen.
Yay, the thread got stickied and I learn something new :)
I corrected the answer.

captaincomic

  • *
  • Posts: 6108
Q: How do I open the console in the Flash Player? How can I print text to the console?

A: To open the console press ~ (tilde) on a US-keybord. For other keyboard layouts (e.g. QWERTZ-keyboards) try \ (backslash).
To write text to the console in Desgin Mode use the "print"-block (under Flow->Debug).
To write text to the console in Code Mode or in code blocks use the Script.print() function
Code: [Select]
print("Hello World");
Note: trace() will not work.


Q: Is there a console when testing iOS games natively? A: Well, I don't know, please tell me ;)

Alexin

  • *
  • Posts: 3127
Quote from: captaincomic
A: To open the console press ~ (tilde) on a US-keybord. For other keyboard layouts (e.g. QWERTZ-keyboards) try \ (backslash).
Tip: Open and close the console to copy its content to the clipboard.
"Find the fun"
alexin@stencyl.com

eidern

  • Posts: 50
Q: How do I open the console in the Flash Player? How can I print text to the console?

A: To open the console press ~ (tilde) on a US-keybord. For other keyboard layouts (e.g. QWERTZ-keyboards) try \ (backslash).

I'm sorry to inform you that the for azerty layouts with a mac, I can't find a way to make the console appears, even with  \   

cloa513

  • Posts: 245
If its not an IOS game, then is there a practical maximum screen size you should use?

Hectate

  • *
  • Posts: 4643
Q: How do I open the console in the Flash Player? How can I print text to the console?

A: To open the console press ~ (tilde) on a US-keybord. For other keyboard layouts (e.g. QWERTZ-keyboards) try \ (backslash).

I'm sorry to inform you that the for azerty layouts with a mac, I can't find a way to make the console appears, even with  \
What is the key directly below ESC in the top left corner of the main keyboard area? Does that work?
:
:
Patience is a Virtue,
But Haste is my Life.
Proud member of the League of Idiotic Stencylers; doing things in Stencyl that probably shouldn't be done.

eidern

  • Posts: 50
What is the key directly below ESC in the top left corner of the main keyboard area? Does that work?

the key below Esc is @, it's not working; And i've tried the ~ key too (Alt+N in my case), it's not working neither

Why isn't there a simple Display console button in the menu? It solves many keyboard config layout problems.. :(

captaincomic

  • *
  • Posts: 6108
How about "ù"? (http://community.stencyl.com/index.php?topic=4855.0)

If this doesn't work either, does anyone know how to get an instance of FlxConsole?
Then one could write a behavior with a custom key that triggers FlxConsole.toggle(), but I can't find it in API (FlxG._game._console.toggle() didn't work)

eidern

  • Posts: 50
ù doesn't work either, but all these keys on my mac keyboard are created with combination of multiple keys,
So I guess that's why it doesn't work