Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question] Need help to use this plugin #16

Closed
shohan4556 opened this issue Feb 24, 2016 · 10 comments
Closed

[Question] Need help to use this plugin #16

shohan4556 opened this issue Feb 24, 2016 · 10 comments
Assignees
Labels

Comments

@shohan4556
Copy link

Hello, I have read readme file but I can not understand how to use this plugin, I added my states in Boot.js file and imported 'phaser-state-transition.min.js' file inside index.html so when I tried to start my states like this 'game.state.start('playState', [outTransition, [inTransition]]);' it shows some error in console.
Please help me to use this plugin I know it will be a great experience.

@cristianbote
Copy link
Owner

Hey there!

Sure thing man. Let me grab some examples and I'll post them here, and add them as well as part of #14.

@cristianbote cristianbote self-assigned this Feb 24, 2016
@cristianbote
Copy link
Owner

Alright, so by default you don't need to instantiate the plugin. Just make sure you're including the dist file.
Moving on.

I notice your quote about how to transition between state, and I realized I haven't done a great job, explaining what I wanted to achieve with the new version, so sorry about that.

Take a look here https://github.com/cristianbote/phaser-state-transition/blob/master/src/index.js#L13
I'm basically overriding the default .start method, and make sure the state is drawn inside the system before saving. I suggest you should explore the src folder.

Bottom line:

game.state.start('yourStateNameGoesHere', Phaser.Plugin.StateTransition.Out.SlideTop, Phaser.Plugin.StateTransition.In.SlideTop

If you're wondering what the hell is Phaser.Plugin.StateTransition.Out.SlideTop check out this file, with the default transitions: https://github.com/cristianbote/phaser-state-transition/blob/master/src/core/StateTransition.js#L43

Let me know if this was of any help.

Cheers

@shohan4556
Copy link
Author

Thanks man it works at last.
I have found some property like 'SlideLeft' ..... I tested those already. can I add my own property then how to do it ?

@cristianbote
Copy link
Owner

Glad that it works. Keep an eye on this repo, for more info.

@JarLowrey
Copy link
Contributor

Can you explain what you mean by

and make sure the state is drawn inside the system before saving

When I transition to my Store state I draw all my sprites in the state's create command. But after the transition finishes they come out all wonky and misplaced.

@cristianbote
Copy link
Owner

Hey,

So, let's start with a code example, on how you're drawing inside the create func. Just post an example, and we'll see how it evolves.
It might be an issue that needs to be fixed, so I think this is the best way to be on the same page.

Looking forward!
Cheers!

@JarLowrey
Copy link
Contributor

JarLowrey commented Aug 23, 2016

The game I am working on is here. You can download the whole thing, run npm install, wait, npm start and it will open in your browser. The issue comes when you click the Play button through the store, transition successfully to the game state, beat the the level, and transition back to the store. It's at this point that the sprites get scattered.

Also included in my project is the phaser-kinetic-scrolling-plugin, but I've tried removing it and problems persist.

The sprites are created in the Store create function here. Thanks for the willingness to help!

@JarLowrey
Copy link
Contributor

PS: theres some major screen shake if you get damaged in-game, so be prepared. Also, the transition doesn't break 100% of the time. It might be a bit less common when kinetic scrolling is removed, but will definitely happen eventually, either way.

@JarLowrey
Copy link
Contributor

JarLowrey commented Aug 24, 2016

OK so I figured out that the issue is related to resizing/repositioning of game.world and/or game.camera. I think this might be my fault, as game.world.y is fine at the beginning of store.create(), but changed afterwards. I'll update when I find out more.

@JarLowrey
Copy link
Contributor

I started a new issue for this to try and prevent any more clutter in this issue. #25

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants