Link to home
Start Free TrialLog in
Avatar of James Hancock
James HancockFlag for United States of America

asked on

Must I do all the device rotation code myself for a Javascript phaser game?

Hi
I'm considering my planning for device rotations in my Javascript Phaser game.
I know there is a rotation listener.
Does everyone start off in portrait and listen for turns?
I can discern the initial rotation by comparing width to height?
My game-object placements (word game) will depend on rotation (landscape vs portrait)
Must I manually rotate the sprites and alter their positions for better aesthetics?

Can Phaser attempt to rotate / align on its own terms?

Thanks
ASKER CERTIFIED SOLUTION
Avatar of lenamtl
lenamtl
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of James Hancock

ASKER

Thanks,
Doubling up on my other question, maybe, I like that page that shows position fixing in an html #body.

I'm worried that some devices wont be influenced by html, and the fixing should be entirely in the javascript. (compiling to native app) I could have a boolean in my drawing method that arranges my graphics objects according to horizontal truth? false implying vertical?

Okay,



Would I get better help and abilities doing native device app coding?

Is Phaser really platform independent? I heard it might be going away? What about Cordova? Is Cordova going away?

Thanks
I would not use Cordova as it is an hybrid apps version, not a native apps so this mean it will be slower and it will not have access to all native features.

Doing a native apps using React Native or any Native code will allow you to have a real apps, be able to use all native device features.

Having a native apps also mean more control of displaying your game in mobile device.

If you plan to make money from your game or display some ads it will be a lot more easier to do your game in native format.
Thanks

I'm reluctant, understandably, I like Phaser, but I can do native format. There seems to be good Google pages out there for the different platforms.
Just to be sure, what are all the devices I must cater for, and their languages?

I am inclined to use iOS for the initial version, coz I like swift. - and my iPhone.
- Android is C++, and I saw a claim of Java somewhere?

What will be needed for tablets? I don't have one. just iOS? - no - Galaxy
Hi,

Using React Native for the kind of game you plan would be my first choice.
You already have Javascript knowledge.
You can use PHASER code / game.
The big advantage is the same code can be use to create Android and IOS apps.
So no need to learn other language and this saved a lot of time.
You game will have access to any native features if needed.
When preparing to compile the code this allow to set screen orientation, so you can force some preferences to fit your needs.

React Native have a learning curve like other options.

Other options will required you to maybe learn 2 new language and 2 interfaces IOS / Android so to my opinion this will take a lot more time.
Thanks
You are right about the more efficient approach. No need to learn new languages! Done that, no need again. DirectX, Java swing, phaser, C, Turbo Pascal; Qbasic, etc,  but it's all the same, rly. - load, create, update, C-style
What should be my first move? Is brackets still the IDE I should stick to? I'll see what they advise, link below.

I really like Udemy lectures. They have what looks like a decent coverage of RN. - IDE setup and such.
I don't know if it covers games, but do you suspect it will be obvious, somewhere inside? The weather app prob contains aspects. It even covers the app store process. There are good links on Google.

here
Hi,

I just bought this book it's seem well written and seem easy to understand

React Native for Mobile Development

https://www.apress.com/us/book/9781484244531

This course seems great (I have not bought yet)
https://www.udemy.com/course/react-native-the-practical-guide/

Before buying check the content  and check user reviews.
These won't cover game / phaser but will help to understand React Native.

But after this will be easier to use expo for Phaser https://github.com/expo/expo-phaser 


Great links.
Thanks
I'm going to start on the ebooks and those classes tomorrow. and comment below. So, I found this minesweeper clone in React / Javascript at "reactjsexample.com" below.


Very promising.
1) It works in a browser.
2) It obviously works on a device.
Will it stretch naturally to a tablet? Is this a good start demo of the 'power of Unity?' I am doing simple games, so mine sweeper will do well to look at.
I basically need a Graphics object for the device / browser div, and the ability to draw and a game loop.

here

It sounds like I must install Unity 2019.
Is there a best link / version  for it?

thanks 

Hi,

Be aware that there are 2 different thing, they are related but differents
React JS which use javascript to be displayed in browser
React Native that compile to native apps to be displayed in mobile device

If you like to learn React JS
I also bouth this book
Pro React 16 https://www.apress.com/us/book/9781484244500

Then you will need to decide:
Create a web game for browser using javascript
or
Create a game Apps that can be displayed in mobile device and use Native feature:
using
 React Native
or
Unity
or other native language

*Note React Native have nothing to do with Unity they are 2 different way to create native apps / game.
**When creating Native APPS you will be able to set orientation and other settings.
***When creating with Javascript you will have orientation and resize settings based on the script.


Thanks

If there's really, no, one-size-fits-all approach, my games are not complicated, so I'm going to watch the 'how to make games with Unity' Udemy video, set up a Unity IDE

Is it (visual studio for Mac?)

and get going.


OKay,
excellent

I tunneled along, and I assume - Is this - below - a best link for Unity on mac? It has unity as a sub-feature-icon.

Should it be pretty straight forward, with all the Udemy and web assistance out there?

here

Thanks

Hi,

The resize options and orientation will depend of the game engine you will used and method JS game or compile game apps..

If you decide to use Unity
Check their documentations https://docs.unity3d.com/2020.2/Documentation/Manual/GettingStartedInstallingUnity.html

If you have precise question about Unity or VS on a MAC then open new questions.