Username or E-mail
Password (Forgot?)
New? Sign Up
Join or Sign In
Forums Stencylpedia Stencyl TV Translations Go Pro - Plans & Pricing Download Stencyl


Switch to Book Layout

1: Getting Started

  • Getting Started
  • Crash Course
  • Crash Course 2
  • StencylForge

2: Building Logic

  • What is a Behavior?
  • Creating a Behavior
  • Attributes
  • Game Attributes
  • Attribute Types
  • Events
  • Our Behaviors

3: Actors

  • What are Actors?
  • Animations
  • Motion & Forces
  • Physics
  • Controls
  • Collisions & Groups
  • Killing vs. Recycling
  • Tweening
  • Effects
  • Chapter 3 Challenge

4: Scenes

  • Scene Basics
  • The Camera
  • Tilesets
  • Regions
  • Drawing Text & HUDs
  • Changing Scenes
  • Music, Sounds & Channels
  • Backgrounds
  • Customizing Actors
  • Chapter 4 Challenge

5: Game Mechanics

  • Saving
  • Pausing
  • 3rd Party Services
  • Web Requests

6: Advanced Topics

  • Get/Set Attributes
  • Custom Events
  • Blending Modes
  • Lists
  • Custom Blocks
  • Continuous Collisions

7: Testing & Tuning

  • Testing Games
  • Optimizing Performance 1
  • Optimizing Performance 2

8: The Last 10%

  • Flash Publishing
  • Standalone Apps
  • iOS App Store
  • Chrome Store
  • Making Money

M1: Mobile - Intro

  • Getting Started
  • Testing on your Device
  • Flash -> iOS Guide

M2: Mobile - Basics

  • Atlases
  • Drawing Text
  • Retina Display
  • Accelerometer
  • Joystick
  • Universal Games

M3: Mobile - Services

  • iAds
  • Game Center
  • In-App Purchases

M4: Mobile - Publishing

  • Debugging
  • Publishing to the App Store
  • Optimizing Performance
  • Promoting your Game

A: Troubleshooting

  • Showstoppers
  • General FAQ
  • iOS FAQ
  • The 90% Memory Warning
  • Recovering Broken Games
  • Can't Export to SWF
  • Reloading Documents
  • Generating Logs
  • Flash Security Settings
  • How to Report Bugs

B: How-To Guides

  • Importing Assets
  • Scene Designer
  • Code Mode
  • Font Editor
  • Pencyl (Image Editor)
  • Tile Editor (Shapes)
  • Game Cleaner

C: Reference

  • Glossary
  • Block Reference
  • Useful Shortcuts
  • Stencyl API

D: Resources

  • Stencyl TV
  • Abigayl's Guides
  • Giving Critiques
  • Creating Extensions
  • Translating Stencyl
  • Credits

3.0 Drafts (In Progress)

  • What's New in Stencyl 3.0?
  • Setup (Android)
  • Setup (Desktop)
  • Setup (iOS) - Concepts
  • Setup (iOS) - Mac
  • Setup (iOS) - Windows
  • Testing iOS on Windows
  • iOS Troubleshooter

  • Mobile App Scaling
  • Full Screen Mode
  • Simple Physics
  • Backgrounding an App

  • iOS App Store
  • Mac App Store
  • Windows Store
  • Google Play
  • HTML5

  • Android Ads
  • Android Purchases (WIP)
  • 4" Form Factor (iPhone 5)
  • Mobile Input
  • Mobile Features

  • Extending the Engine
  • iOS / Android Extensions
  • Developing the Official Extensions
  • Developing the Engine

  • iAds (Revised)
  • Game Center (Revised)
  • iOS Purchases (Revised)
  • Atlases (Revised)
  • Drawing Text (Revised)
  • Joystick (Revised)
  • Accelerometer (Revised)
  • Sounds (Revised, WIP)
  • Debugging (Revised, WIP)
  • iOS Performance (Revised)
Level: Beginner

Setting Tile Collision Shapes

Note: If you're coming here from the Tiles and Tilesets article, read on. If you found this through a search, we urge you to read the main Tiles article first.

 

Contents

  • Introduction
  • Setting the Collision Shape
  • Custom Collision Shapes
  • Boxes
  • Polygons

 

Introduction

Tiles can take on more than just square shapes or blank areas. You can define different kinds of boxes, slopes (triangles) or even arbitrary polygons.

 

Setting the Collision Shape

Suppose that we want to set the collision shape for the tile selected below. It's a sloped tile at about a 60 degree grade.

1) To set the collision shape, go over to the Collision Bounds window, scroll using the scroll bars to find the shape you need, and click on it.

Tip: You can edit the collision shapes for multiple tiles at a time if you select multiple tiles in the left (tiles) pane. You can do this by clicking and dragging to expand your selection rectangle.

2) Save your Tileset to confirm the changes.

Tip: If you've placed a tile inside a scene and change its collision bounds, you'll need to open that scene and save it to make the change get reflected.

 

Custom Collision Shapes

Sometimes you will need a custom collision shape for a tile that isn't reflected in any of the standard shapes we provide.

If this is the case, you can define a Custom Collision Shape by clicking on the + button. You can create either a Box or a Polygon.

 

Box Shapes

X and Y dictate the relative position of the box, in case you want it to be shifted off the origin (0,0).

All values are in percentages (0 - 100 inclusive). We do this, so that you don't have to worry about how big the tiles are.

 

Polygon Shapes

Create a Polygon by defining points and setting their x,y values, either through the table or through drag and drop. A polygon must have 3 or more points but no more than 12.

Note: Define points in counter-clockwise order. If you don't, the engine may crash and warn you about a polygon having negative area.

Gotcha: Only convex polygons are supported. Do not enter in a concave polygon.


Last Updated: 2012-04-03 by Jon

10301 have read this article
Disclaimer: The Stencyl Team does not actively monitor comments on articles. If you're seeking help for your game, please ask a question on the forums. Thanks!
6 Comments
esotericbyte
I am working with the example created in the crash courses to evaluate Stencyl.

The provided tiles I used have a square collision shape. I added some platforms and lowered the gravity. You can jump to them and they usually act as you'd expect.

Unfortunately It's possible for the player actor to be trapped in the tiles that should be
solid and there does not seem to be a way to escape.
What conditions do tiles not work and why?
I am thinking maybe they need to be smaller than the actor or something like that.




0 4 months, 2 weeks ago
tinycyborg
Any plans in the future to resolve the convex polygons issue? I am making a top down game and have L shaped "walls" that are bugging out because I am using Convex Polygons...
0 6 months, 1 week ago
Valeriana
Same problem here, but only with the rpg style scenes. To the platformers i dont have the problem

0 7 months, 2 weeks ago
R3M4RK5
I just happened across Stencyl last night and I've had no problems with using tilesets.

You most likely did not tell your Player actor's collision group to collide with Tiles as well as Actors.

0 1 year, 5 months ago
SG2Tiger
Same here. I'm assuming it's a bug. For the time being, I've created actors with invisible frames and set them as 'walls', placing them over the tiles and using those to provide collision. I hope this gets fixed soon, as filling the scene with actors is just going to make things unnecessarily slow.
1 1 year, 11 months ago
Grimreaper
This doesn't work for me I have to get each tile I want and turn them into to actors for them to have collision. I think I got a broken stencyl and it's driving me mad.
1 1 year, 11 months ago



Commenting Guidelines

Sign In to Comment

Make Games

  • What is Stencyl?
  • Roadmap
  • Pricing

Play

  • Arcade
  • Showcase

Community

  • Forums
  • Chat
  • Translations

Help

  • Stencylpedia
  • Stencyl TV

About Us

  • Blog
  • Contact Us
  • Press
  • Privacy
Follow Stencyl on Twitter



© 2013 Stencyl, LLC.