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 - captaincomic

Pages: 1 2 3 4 5
31
Extensions / Joints Extension
« on: May 09, 2014, 11:02:45 am »
This extension will only work with Stencyl 3.1 or newer (build >= 7261).
The pulley joint block needs Stencyl 3.2 or newer (build >= 7754).


Joints Extension
This extension should work on every platform. I have only tested it on Flash, if you any issues with it let me know.

This extension provides blocks to create and destroy joints, and to modify their parameters.
To see what you can do with it, check out this Demo and the Ragdoll Test.  You can also find them on StencylForge as "Joints Sandbox" and "Ragdoll Test 3x".

There are currently blocks for all joints (that are implemented in the haxe port of Box2D) except for gear joints and friction joints.

To learn more about Box2D joints in general, take a look at the Box2D manual (PDF).

Download this Extension. (For instructions see How to Install and Update an Extension.)

Usage Notes
When a joint block expects coordinates for an anchor point of an actor, the coordinates are relative to their origin point of the actor (by default the center of the actor). If you want to attach a joint to the center of an actor, use ( x: 0, y: 0 ).

The blocks that only expect coordinates for one anchor point, calculate the coordinates of the second anchor point based on the position of the actors.

Use the blocks only for the type of joint that they are meant for. If you use a block on the wrong type of joint, you will get an error, like "Type Coercion failed: cannot convert box2D.dynamics.joints::B2RevoluteJoint@f1eae359 to box2D.dynamics.joints.B2DistanceJoint".

To specify the axis for line joints and prismatic joints, enter the coordinates of vector pointing in the desired direction, and make sure that the length of the vector is shorter than or equal to 1. For example, to create a line joint that restricts an actor to horizontal motion, you would enter ( x: 1 y: 0 ). For a 45° diagonal, you can enter ( x: sqrt(2)/2 y: sqrt(2)/2 ), which has length 1, or for example ( x: 0.5 y: 0.5 ), which is shorter than 1.

Most values of a newly created joint are 0 (or false) by default. This means that, for example, to turn on a motor, you need to enable the motor, set the maximum force and set the motor speed. Otherwise it will do nothing.

There is also a block to return the last created joint, a joint selected from the scene, or a joint attribute. Normally you won't need to use this block, as you get the same dropdown for the joint fields in the other blocks and attributes, but sometimes it can be useful, for example, for storing joints in a list.

Mouse Joints
Mouse joints are useful to drag actors in a game with physics, since the mouse joint will drag the actor towards the mouse and thus works well with collisions (unlike setting actor coordinates directly). Usually you will want to set the target of the mouse joint to the current mouse coordinates in every frame. Make sure to set the maximum force (1000 * mass of the actor is a good starting point), otherwise the mouse joint won't have an effect.

Distance Joints
A distance joint fixes the distance between two actors, or one actor and a point on the scene.
* Stick joints created in the scene editor are distance joints internally.

Line Joints
A line joint restricts the motion of the actor to a given axis. Rotation is still allowed.
* Slide joints created in the scene editor are line joints internally.

Prismatic Joints
Like a line joint, a prismatic joint restricts the motion of the actor to a given axis, but rotation is also restricted.

Revolute Joints
A revolute joint constrains two bodies to share a common point while they are free to rotate about that point.
There are four different blocks to create a revolute joint, to connect two actors, or to attach an actor to the scene, and with one anchor point (the other one calculated automatically) or two anchor points, respectively.
* Hinge joints created in the scene editor are revolute joints internally. 

Weld Joints
A weld joint glues two actors together, or glues one actor to the scene. This can be useful for creating an object made out of multiple pieces that can fall apart (when you destroy the weld joints that held the pieces together).

Pulley Joints
A pulley joints connects two actors with a rope and a pulley (or two) defined by the anchor points.

Version History
1.0: Initial version, with blocks for mouse joints and revolute joints
1.1: Updated to use joint attributes
1.2: Added blocks for distance, line, prismatic and weld joints
1.3: Fixed set/get length of distance joints not accounting for physics scale
1.4: Added blocks for pulley joints

32
Extension Ideas / Z-Index Extension [Now part of Stencyl 3.2+]
« on: April 16, 2014, 06:51:47 pm »
Starting with Stencyl 3.1 (or build 7160) these blocks are in the core palette under Actor->Draw->Layer. The extension is not needed anymore.

Z-Index Extension
This extension should work on every platform. I have only tested it on Flash, if you any issues with it let me know.

This extension provides blocks to change the drawing order (z-index) of actors within a layer.
This is useful if you need fine grained control over the drawing order of your actors, so you don't need to create a layer for each actor.

Download this Extension. Use Stencyl 3.1 instead. (If you have to use 3.0 and want to use this extension, drop me a message. Although I would really recommend to use 3.1.)

move actor [  ] [to the bottom/to the top/down/up] within the layer

These blocks change the drawing order of the actor within a layer.

z-index of actor [  ] within the layer

This block returns the current z-index of the actor.  The z-index is an integer in the range of 0 to <number of actors within the layer>-1. A z-index of 0 means that the actor is at the bottom.
This block can be useful to check whether the actor is in front or in the back of another actor: if the z-index of an actor is larger than the z-index of another actor, it is in front of the other actor.

number of actors within the same layer as [  ]

Returns the total number of actors within the same layer as the specified actor. Can be useful to check if an actor is at the top of the layer. An actor is drawn on top of the layer if the z-index of an actor is equal to the number of actors in the layer minus one.

Version History
1.0: Initial Version
1.1: Combined the "move" blocks to a single block with dropdown. Added the "number of actors" block.

33
Extensions / Custom Controls Extension
« on: April 16, 2014, 05:13:41 pm »
Custom Controls Extension
This extension should work on every platform. I have only tested it on Flash, if you any issues with it let me know.

This extension provides blocks to change the game controls at runtime.
For example, to switch between arrow keys and WASD for movement. 

Download this Extension. (For instructions see How to Install and Update an Extension.)

You can change the keys of existing controls:

Or you can add additional keys:


To keep the key configuration between sessions, you can store the current configuration within a game attribute before saving the game.

Then the configuration can be restored after loading the game.


To get/apply the control config, you need Stencyl 3.1 or build >= b7140.

Usage Notes

set control [  ] to key with name: [  ]
Sets the key for the selected control (no other keys will be assigned to that control afterwards). The names of the keys are the same as the fields in the Keyboard class (i.e. all upper case).

add to control [  ] key with name: [  ]
Adds a key to the selected control (any keys that have been assigned to that control will still work afterwards).
The parameters are the same as for the previous block.

set control [  ] to key code: [  ]
Sets the key for the selected control (no other keys will be assigned to that control afterwards). Expects the key code instead of the key name. Use for example with the "key code" block from the "Any Key".

add to control [  ] key code: [  ]
Adds a key to the selected control (any keys that have been assigned to that control will still work afterwards).
The parameters are the same as for the previous block.

get control config
Returns a list containing all assignments of keys to controls. (It is an array of strings, where each string is in the form "control;key1,[key2,]...", but you don't need to care about that. ) Store this in a game attribute before saving the game if you want to keep the current controls.

apply control config [  ]
Use this to restore the controls to what they have been at the last save. Pass the list that you stored in a game attribute as the only parameter. (Don't pass anything else to this block, unless it has the same format.)

Version History
1.0 Initial version
1.1 Make the blocks green again (extension block now honor the color attribute :) )
1.2 Fix: some keys where not accepted; Add key code blocks.

34
Bundled Behaviors / Behavior Inspector (inspect attributes at runtime)
« on: August 26, 2013, 01:28:12 pm »
A new behavior on StencylForge to aid with debugging. The "Behavior Inspector" behavior allows you to inspect the attributes of any behavior at runtime. Click the Inspect button then and choose which behavior to inspect and you'll see all attributes of the behavior and their values on the screen.

35
Bundled Behaviors / Keyboard Input behavior (detect any key presses)
« on: August 26, 2013, 11:27:01 am »
I put a behavior called "Keyboard Input" on StencylForge to detect keyboard events of any key pressed released.

Unlike usual I wasn't lazy with comments and fully commented it as well ;) so I hope it will be easy to use.

In short: Add the behavior to a scene, then write in any scene behavior custom events called "KeyUp" and "KeyDown", and use the custom block "last pressed key" to check which key has been pressed or released. The custom block "last input character" will return the character generated by the last key-up event. It takes into account modifier keys and should work with any keyboard layout.

38
Bundled Behaviors / Pre-shipped Behavior Showcase
« on: December 19, 2012, 01:53:48 pm »
@everybody and especially those with mobile devices

I uploaded a game with simple test cases for all the pre-shipped behaviors to StencylForge under the name Pre-shipped Behavior Showcase. It would be great if some of you could give it a try to spot bugs either in the behaviors or in the engine. Thanks!

39
Bundled Behaviors / Behavior icons
« on: December 16, 2012, 12:24:16 pm »
Oh Miasmos, where art thou?

I'm not good at making icons. Miasmos used to make the icons for the pre-shipped behaviors, but he doesn't seem to be around at the moment. Is there anybody who would like to make a few icons, preferably in a similar style to the existing ones?

Currently I would be looking for icons for the following behaviors:
-Anchor to Screen (does what the block does)
-Endless Animation (allows splitting up an animation into several animations that are played as if it where a single animation)
-Toggle Button (a button template for a button that can be toggled on/off with 3 animations for on/off each: normal, mouse-over and mouse-down)

(I made icons for Draw Regions and Apply Force but copy/pasting parts of existing behaviors, so the current icons for these could be better as well.)

40
Old Bugs (1.x/2.x) / Large fonts look distorted
« on: December 01, 2012, 03:46:12 am »
Small fonts look fine. Large fonts look like there are parts from other letters drawn for each letter, or in case of a shadow effect, the shadow is cut off in a bounding box.

41
Resolved Questions / No more "repeat" option for events?
« on: November 16, 2012, 11:58:25 am »
I noticed that the blue arrow icon next to events that allowed to toggle the event to "repeat" or "not repeat" is gone in 3.0. Is this a (known) bug?

42
Ask a Question / Resizing the screen/stage (with Flixel)
« on: June 07, 2012, 03:49:06 am »
Hi!

So full-screen mode is working now in the browser (look here if you're interested:
http://community.stencyl.com/index.php/topic,11164.msg67343.html#msg67343)

But it rescales the the game to fit the screen, which is not quite what I hoped for.
Basically I'm trying to do what they do here:
http://www.funstormgames.com/blog/2011/10/flixel-fullscreen-mode-and-resizeable-windows/
Switching to full-screen mode, but keeping the graphics at the same size, and increasing the visible area of the scene. Like zooming out (without showing black borders around the scene.)

The problem is in that tutorial they use FlxCamera which is not available in Flixel 2.32, the version used by Stencyl. Does anyone know of any way to achieve the same without using FlxCamera?

Any help is highly appreciated! :)

43
Ask a Question / Full-screen not working in browser
« on: June 01, 2012, 03:23:54 pm »
I'm trying to get fullscreen mode working for a Flash game.

The "enable full-screen mode" block from Stencyl works when I test in the Flash player, but not when I test in the browser. I checked the source code of the HTML and it does contain the necessary "allowfullscreen" parameter.

It works if I right click to open the context menu and select Enter Full Screen, but that's not really what I need.

The same happens if I use the following code:
Code: [Select]
FlxG.stage.displayState = StageDisplayState.FULL_SCREEN;(So I guess that's what the "enable full-screen mode" block does anyway.)

Does anybody have an idea how to get full-screen working in the browser?
Thanks for any help.

44
Shared Resources / Isometric View [Outdated]
« on: May 13, 2012, 06:16:38 am »
The Isometric View I started a while ago is now on StencylForge.

Use this to show your game in an isometric perspective, while designing the scenes top-down.
(see the sceenshots, the first shows the scene in the scene editor, the second is the scene as shown in the Flash Player.)

The Good. :)
All movement behaviors and collisions will work out of the box as in a top-down game, because everything is simulated as top-down. Only the drawing is done in an isometric perspective. Camera movement works as well.

The Bad. :-[
All the drawing is done manually in the Isometric View behavior. All tiles and actors are sorted every frame based on their position to ensure the correct drawing order. This might have a bad impact on performace.

And the Ugly. :P
If not all actors are the same size, the drawing order cannot be determined correctly. An actor might appear in front of another actor while it should be drawn behind. Therefore all actors should be the same size to prevent this from happening (the same size as the tiles.)

Check out the description of the kit and the behaviors for instructions. If anything is unclear just ask here.

I hope someone finds some use for this. ;)


45
Old Bugs (1.x/2.x) / Simulate key release sometimes not happening
« on: April 30, 2012, 02:36:38 pm »
I noticed that when using the On Screen Button behavior sometimes the simulated key release is not happening.

I made a little test to find out if there's something wrong with the On Screen Button or if it's bug.
It looks like a bug to me. The demo game is attached, it counts how many times the "simulate key press/release" block is called and how many times the key press/release is triggered.

Btw. Why do I see a ">" symbol on the screen when I put a "=" symbol in a "draw text" block?


Pages: 1 2 3 4 5