Rotating a scene

purplelava

  • Posts: 82
I need to rotate an entire scene around the player, in a similar fashion to Super Castlevania

http://www.youtube.com/watch?v=_QPGuzGOgSA

I am first using an ACTOR as the level, so I can spin the actor. Though, I would prefer to spin tiles + actors, or at least a level made of several actors which can then move independently apart from rotating(ex.an opening door, inside the level that rotates). Is this possible at all?

If I have to use a single actor for the level, how do I spin using the player/center of the screen as pivot point, and not the actor's pivot point? If I could use several actors, the level would still need to spin around the center of the screen as pivot point, using the world coordinates and not the actors' coordinates.

« Last Edit: December 22, 2011, 11:46:14 pm by purplelava »

Rob

  • *
  • Posts: 1268
See if this is of any help:

http://community.stencyl.com/index.php/topic,4668.msg30570.html#msg30570

Otherwise, you can check with Alexin or Coleislazy
GOLDEN RULE #1 : SAVE YOUR GAMES FREQUENTLY
IOS/XCODE DEBUGGING
http://www.stencyl.com/help/view/xcode-ios-troubleshoot/
WATCH STENCYLWORKS VIDEO TUTORIAL BY SUNRISEKINGDOM
http://www.youtube.com/watch?v=KDfRfjzr9j4&feature=channel_video_title

purplelava

  • Posts: 82
It's cool to know that I can rotate the whole game, but I guess this will rotate my player actor and maybe the physics too, while I want my gravity to always go down.

ShivaFang

  • Posts: 248
It's cool to know that I can rotate the whole game, but I guess this will rotate my player actor and maybe the physics too, while I want my gravity to always go down.

If it does, you can always change the gravity at the same time.  For example, if you rotate the screen 90 degrees counter-clockwise like in the Castlevania clip (at 2 minutes in), change the gravity to go straight 'left' instead of straight 'down' (because left will be the new down)
Justin "ShivaFang" White
Aquamentos Games - The origin of challenging Strategy and Role-Playing Flash gaming!
Visit our Developer Blog and Google+ Page!

purplelava

  • Posts: 82
Yes but it's going to spin my player too, which absolutely can't happen, and also this gravity change won't allow the gameplay I have in mind. I need to rotate the LAYER individually, and if it must be only tiles or only actors, that's fine by me. It's possible to hide a layer, why not move or spin? or is it?

I'm beginning to think this idea just can't be done in Stencyl.

It would be something like this:
http://www.youtube.com/watch?v=5U-66DD2h60

Unless I just use a big sprite for the whole level, which is quite limited in terms of the level designs I can do.

Rob

  • *
  • Posts: 1268
Check with Austlang per my other post. He has experience with this.
GOLDEN RULE #1 : SAVE YOUR GAMES FREQUENTLY
IOS/XCODE DEBUGGING
http://www.stencyl.com/help/view/xcode-ios-troubleshoot/
WATCH STENCYLWORKS VIDEO TUTORIAL BY SUNRISEKINGDOM
http://www.youtube.com/watch?v=KDfRfjzr9j4&feature=channel_video_title

Weasel8778

  • Posts: 236
One option is to make the entire level an actor which isn't affected by physics and has no collisions, etc. Then, add invisible tiles to make your terrain.

Then you can just rotate all actors except the player character when you need it to rotate.

purplelava

  • Posts: 82
Weasel, I don't understand how this will help. The level with including collisions must rotate. Whether the collisions are in the main terrain sprite or in additional actors, I still need to rotate them all together around the center of the screen.

Imagine in the level there are doors opening, or hazards in motion, and meanwhile I make them revolve around a point together with the level terrain...I don't see this happening. I see this happening with a single actor spinning, maybe with different collision groups if I want dangers distributed in the level, but if I so i cannot make them MOVE at all: either they'd move without spinning, or they'd spin without moving. I hope you understand my point, and I'm not sure whether I understood yours.

purplelava

  • Posts: 82
Rob, obviously Austlang's game is much easier in execution. He's just making sprites spin, not a level. And Yet It Moves is closer to what I want to do.

If I can't do it in Stencyl I'm gonna grab Unity.

An idea for the Stencyl guys is that I should be able to create GROUPS of actors that are possible to parent to a gizmo I can do anything I want to. Many options would open. Right now it's hard to make truly dynamic levels.

Also a bone system as seen on Flash or Construct would allow for the construction of Castlevania boss-like monster puppets made of several sprites. That would also open for a lot of possibilities. Since Flash has the bones engine, I don't think it would be too hard to implement.

coleislazy

  • *
  • Posts: 2607
Since tiles are locked to a grid, you would have to use actors.  Your best bet would be to add each element you want to rotate to the same collision group, or as few as possible, so you can loop through them easily. You would need to figure out the math required to rotate around an arbitrary point, but it should be doable. The real problem will be optimizing performance. Using actors will slow things down, especially if you need many of them with full physics. Rotation will also cause a performance hit because of the way Flixel renders.

The fastest way would be to rotate the whole scene as mentioned above. You would have to rotate the actor in the opposite direction to make him appear stationary. You would also have to account for this rotation in all his movement code and in the scene gravity. I would not recommend this method.

purplelava

  • Posts: 82
Thanks coleislazy for your expert reply...

second method is out, my actor can't rotate the whole time, it will have physics and be influenced by gravity, I don't see this working.

The first method is a bit too complicated for my programming knowledge, especially the math. The actors of my level wouldn't require physics, but only collision, I know these two things are attached in Stencyl.

Coupled with the fact that it could also not perform well, I guess that's not an idea for Stencyl/Flixel. Unless you want to give it a try yourself to create a behaviour, I'm off to other ideas.

Edit: and I mean a "rotate  multiple actors around center of screen" behavior, or something similar.

« Last Edit: December 24, 2011, 04:17:57 pm by purplelava »

purplelava

  • Posts: 82
Coleislazy, I am not a coder at all, but I found this under FlxObject:

origin (property)
public var origin:FlxPoint

WARNING: The origin of the sprite will default to its center. If you change this, the visuals and the collisions will likely be pretty out-of-sync if you do any rotation.


Could this work for my idea? I now know how to alter groups of actors...I couldn't understand earlier how to modify more than one actor at once. Now, all these actors composing my level should rotate around the same origin point...if they do so, I can test my concept.

I wouldn't know how to implement this Flixel property in my blocks...but first of all surely the actors must KEEP their collisions when they rotate. I don't know if that warning means that it simply wouldn't work.

coleislazy

  • *
  • Posts: 2607
The problem with trying to muck into either Flixel or Box2D by themselves is that neither do anything together. Stencyl is what keeps them in sync, so if you bypass it, you can end up making a lot more work for yourself. For example, if you changed the origin point and rotated everything this way, none of your collision boxes would rotate with it. You'd have to do the same thing again in Box2D, which may be even harder.

austlang

  • Posts: 38
Rob asked me to weigh in here, so I thought I would share my experiences. It is correct in saying that I only rotate simple actors, and not the entire screen.

Since I am still rather new to Stencyl, I have no idea whether or not rotating the "camera" or entire screen is possible, like it is in And Yet it Moves (which is a pretty cool game, I have it on Steam).  There used to be some behaviors on StencylForge that allowed you to attached actors to another, which would probably provide a creative workaround. However, I do not believe they work anymore because of the recent updates to Stencyl (I could be completely wrong don't quote me there).

And lastly, I have a lot of experience with Unity and wholeheartedly embrace its use as well, especially if you're a programmer/scripter.  It has a ton of awesome features and is great with testing/iteration on your devices from what I have seen and done.  However, you would have to create a lot of things from scratch there, and the Pro License is much more expensive than Stencyl's.

purplelava

  • Posts: 82
Thanks Austlang, PMed you with questions.