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.


Topics - SadiQ

Pages: 1 2 3 4
1
I created a code mode behavior (named MainBehavior) and within it I created a simple function:
Code: [Select]
public static function getSceneStatus():Float
{
    return 1;
}
Then I created a design mode behavior and I'm trying to call the function I created:


However Stencyl gives me the following :
Code: [Select]
DrawText: Class<scripts.MainBehavior> has no field getSceneStatus
from scripts.Design_12_12_DrawText

Is there any way to access my function from my second behavior?

2
I'm trying to expose a color attribute from a code mode behavior, and by following the stencylpedia article, the COLOR Attribute type corresponds to an Int, yet it exposes a text box expecting an integer value instead of the color picker box that everyone is used to.
Is there a way to get the actual color picker instead of the text box to show up in Stencyl? 

3
Bug Archives / Dragging blocks causes an OUCH message.
« on: January 27, 2016, 11:03:09 am »
I got the following when dragging some block inside a behavior (and it happens pretty frequently):
Code: [Select]
java.lang.NullPointerException
at stencyl.sw.editors.snippet.designer.dnd.BlockDragManager$1.actionPerformed(BlockDragManager.java:81)
at javax.swing.Timer.fireActionPerformed(Timer.java:313)
at javax.swing.Timer$DoPostEvent.run(Timer.java:245)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:756)
at java.awt.EventQueue.access$500(EventQueue.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.awt.EventQueue$3.run(EventQueue.java:703)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:726)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)

4
I'm trying to expose some attributes in Stencyl from a Code Mode behavior, but I am unable to assign a default value to them and have those values actually appear under the Behaviors tab.
The attributes show up in the Attributes tab as shown below WITH the default value that I want:


Yet this is what I see in the Behaviors tab after I attach the behavior to an actor (The TEST attribute should defaults to someDefault in the above image ):


The code I have is this:
Code: [Select]
@:attribute("id='1' name='AISpeed' desc='Movement speed of the actor. Default is ??' default ='18'")
public var _AISpeed:Float = 18.0;

@:attribute("id='2' name='TEST' desc='testing' default='someDefault'")
public var TEST:String = "someDefault";

EDIT: It appears that I needed to remove the behavior from the actor and then reattach it so that Stencyl can recognize the default values I want.

5
I'm trying  to create a joint between 2 actors, and I just typed the code that shows up in the Preview under a normal behavior,  however, I'm not getting any form of autocomplete from my editor (FlashDevelop), nor do I see any imports missing if I compare a design mode behavior with my own code.


My code fails to see the Joints class.



If I compile the above I get the following error on the _leg = Script.lastCreatedJoint() line:

Compilation error in behavior: PlayerAI: box2D.dynamics.joints.B2Joint cannot be called
.

Am I missing some import statement that stencyl generates when the game gets compiled or something?

6
Resolved Questions / [8670]Switch Scenes doesn't work. [SOLVED]
« on: September 14, 2015, 05:45:31 am »
I am unable to switch scenes with any of the blocks provided. No errors or anything.

EDIT: Turns out you need to wait more than .5 seconds to switch scenes after the current scene was created.

7
Completed / Find attribute in behaviors..
« on: August 06, 2015, 02:52:26 am »
I would be helpful if the 'Find attribute in behaviors' would present us with the actual name of the behaviors instead of the internal name that Stencyl uses in situations where the code is quite complex and some attributes appear in too many behaviors.


8
Fixed Bugs (3.x) / "Source and destination must store pixels as INT."
« on: April 06, 2015, 10:20:47 am »
This is what I get after creating a minimal actor and trying to compile a game with it:
Code: [Select]
Unexpected problem on thread AWT-EventQueue-0: Source and destination must store pixels as INT.
java.lang.IllegalStateException: Source and destination must store pixels as INT.
at stencyl.sw.util.gfx.ColorizeComposite$BlendingContext.compose(ColorizeComposite.java:110)
at sun.java2d.pipe.GeneralCompositePipe.renderPathTile(Unknown Source)
at sun.java2d.pipe.SpanShapeRenderer$Composite.renderBox(Unknown Source)
at sun.java2d.pipe.SpanShapeRenderer.renderRect(Unknown Source)
at sun.java2d.pipe.SpanShapeRenderer.fill(Unknown Source)
at sun.java2d.pipe.PixelToShapeConverter.fillRect(Unknown Source)
at sun.java2d.pipe.ValidatePipe.fillRect(Unknown Source)
at sun.java2d.SunGraphics2D.fillRect(Unknown Source)
at stencyl.sw.editors.snippet.designer.Block.paintNotchBlock(Block.java:3397)
at stencyl.sw.editors.snippet.designer.Block.paintComponent(Block.java:3157)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JComponent.paintChildren(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JComponent.paintToOffscreen(Unknown Source)
at javax.swing.RepaintManager$PaintManager.paintDoubleBuffered(Unknown Source)
at javax.swing.RepaintManager$PaintManager.paint(Unknown Source)
at javax.swing.BufferStrategyPaintManager.paint(Unknown Source)
at javax.swing.RepaintManager.paint(Unknown Source)
at javax.swing.JComponent._paintImmediately(Unknown Source)
at javax.swing.JComponent.paintImmediately(Unknown Source)
at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
at javax.swing.RepaintManager.prePaintDirtyRegions(Unknown Source)
at javax.swing.RepaintManager.access$700(Unknown Source)
at javax.swing.RepaintManager$ProcessingRunnable.run(Unknown Source)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$000(Unknown Source)
at java.awt.EventQueue$1.run(Unknown Source)
at java.awt.EventQueue$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)

Apparently I can't even get back to my game after the error shows up ( The Oops window doesn't disapear after I click ok, and clicking on Don't show this again just allows the app to freeze properly)

9
Guides & How-To's / [Guide] How to use FlashDevelop with Stencyl
« on: March 30, 2015, 01:03:31 pm »
How to use FlashDevelop to code for Stencyl

This post will show you what are the steps needed to use FlashDevelop to code your behaviors.
We will NOT simply use FlashDevelop to edit the behavior files, we will have all the advantages of using a proper IDE, and that means proper code completion and hints (Intellisense), code generation, debugging, compiling, and of course syntax highlighting.

What we assume
  • This guide assumes FlashDevelop and haxe are not installed.
  • This guide assumes the use of a Windows based OS
  • This guide assumes that the user can change the system path without problems
  • This guide assumes that a new blank game will be used to test things
  • This guide assumes the user will use the correct paths if he uses this guide
  • This guide assumes that the user can find the games-generated folder
  • This guide assumes that if any of the above will fail, then the user will not read any further
What do we need to do ?
First install FlashDevelop, but do NOT install any package when you're presented with a window to install additional content.

When the installation completes close FlashDevelop, because we need to add 2 locations to the system path:
D:\Program Files (x86)\Stencyl\plaf\neko-win\ and D:\Program Files (x86)\Stencyl\plaf\haxe\
Replace with the correct path for your system

Create a new game (I named mine design), with a scene and a code mode scene behavior (make sure the behavior is attached to the scene) and TEST THAT GAME inside Stencyl. Testing the  game will create the necessary directory structure in the games-generated folder, and so there is no need to actually add something in the behavior created above. Do remember the name of the game as it will be needed in the next step.

Setup FlashDevelop

Open FlashDevelop and create a new Project. In the New Project window you must pick an Empty haxe Project, and for the name you must type the name of the game you created in Stencyl. The Location MUST point at the games-generated folder.


After you press ok you'll get a warning that you can ignore (something's actually wrong if you don't get that warning), and in the side view you should see the entire directory structure that Stencyl created when we tested the game.


Let's tell FlashDevelop where haxe is installed

In Flashdevelop go to Project -> SDK -> Manage
In the window that pops up open InstalledSDK[] Array and you should get the following window where you must add the path to the haxe folder:

The Name and Version do not matter so use whatever you want for those.

I restarted FlashDevelop after this step.

 Back to FlashDevelop

Let's continue to setup FlashDevelop to make it recognize all the classes available in Stencyl, so let's go back to the Project Properties:
 - In the Output tab select Lime as the Platform and project.xml in the Output field:

Don't worry about the Dimensions, color and framerate. They will get set automatically

 - In the Classpath tab click on Edit Global Classpaths... and from there click on Add Classpath. Locate the following folder and add it in the path:


At this point I restarted Flashdevelop again and now we can compile the game from within Flashdevelop:

 but...


 Almost there

We're currently working in the games-generated folder, so any file that we edit now (located in Source -> scripts)will be deleted the next time we test the game from within Stencyl.

To fix that, we will copy all the files from the scripts folder back into the games folder. To do that we must create a text file   that will be placed in the C:\ drive. So create a text file, name it exclude.txt and paste the following inside it:
Code: [Select]
Design
SceneEvents_0
MyAssets
MyScripts
StencylPreloader

And for the last time (for this project) we need to go back into the Project Properties into the Build tab and add the following into the Post-Build Command Line:
Code: [Select]
c:\windows\system32\cmd.exe /C copy "$(ProjectDir)\Source\scripts\Design*.hx" "$(ProjectDir)\..\..\games\$(ProjectName)\snippets\"
c:\windows\system32\cmd.exe /C xcopy "$(ProjectDir)\Source\scripts\*.hx" "$(ProjectDir)\..\..\games\$(ProjectName)\code\" /Y /exclude:c:\exclude.txt



From now on you can add code and compile the game without the need to have Stencyl opened.

 The Problems:

 - You must follow this tutorial for every game you want to work on.
 - The change to any design mode behavior will not be permanent or it will not work. Only work on code mode behaviors.
 - Any new class that you wish to attach to a scene or actor must be created in Stencyl and the game must be tested in Stencyl first.
 - After the creation of a new Scene you must test the game in Stencyl.
 Contributors:

This was possible thanks to the following contributors :
 - Hectate
 - Justin
 - MdotEdot

10
Chit-Chat / I'm finally among the pro's :)
« on: March 19, 2015, 10:51:57 am »
 I'm one of the few :)




EDIT: Added another pro :)

11
I keep getting a few OOPS messages when I save my code in notepad++
Code: [Select]
Unexpected problem on thread AWT-EventQueue-0: null
java.lang.NullPointerException
at stencyl.sw.editors.snippet.code.SnippetPanel.getCodeEditor(SnippetPanel.java:364)
at stencyl.sw.app.filewatcher.CodeSyncTask$1.run(CodeSyncTask.java:55)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$000(Unknown Source)
at java.awt.EventQueue$1.run(Unknown Source)
at java.awt.EventQueue$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)

I'm using build 8068 if that makes a difference.

12
I wanted to use edgeShapes in one of my tests, and to avoid getting an error when an actor collides with an edge I had to modify B2ContactListener.hx:

At line 83 I had this:
Code: [Select]
a1.addContact(contact);
a2.addContact(contact);
I had to do this:
Code: [Select]
if (contact.getFixtureA().getUserData() != null)
a1.addContact(contact);
if (contact.getFixtureB().getUserData())
a2.addContact(contact);

At line 150 I had this:
Code: [Select]
a1.removeContact(contact);
a2.removeContact(contact);
I added this as well:
Code: [Select]
if (contact.getFixtureA().getUserData() != null)
a1.removeContact(contact);
if (contact.getFixtureB().getUserData() != null)
a2.removeContact(contact);

I don't think it's the right way to solve the collision issue, but it worked for me.
None of the above is needed if the I manually add an actor as the userData to the fixture, but I don't know what I'd need to do when multiple actors are involved, so I kept my hacky approach.

13
Journals / [Tech Demo] Dynamic Hills Terrain
« on: January 05, 2015, 08:52:51 am »
I was asked to create a terrain that would resemble what Tiny Wings had, and since there were a few tutorials out there I created this tech demo:  http://www.stencyl.com/game/play/29340
(Press Enter to turn on Debug Draw and remove the color from the terrain, or R to restart)

The scene has 15000 tiles in length, the terrain gets created dynamically and it gets deleted after it goes to the left side of the screen.

14
Suggestion Archives / Blank game extra option?
« on: December 08, 2014, 08:37:27 am »
How about an option to be able to choose the extensions that we need in a game when we create a blank one? (It could be an "Advanced options" dropdown menu somewhere)

15
Bug Archives / Log viewer Always On Top bug
« on: November 15, 2014, 07:58:58 am »
The Always on top part in the log viewer fails if you do the following:
Open Stencyl, Open a game, open the log viewer, enable Always on top, Close the game. The Close/Save dialog appears below the log viewer, so if you click on the log viewer window, the dialog gets on top. Save (or not), and the log window fails to remain on top from that point on.
(Build 7937)

Pages: 1 2 3 4