Games [XUI2D] Space Shooter

Erel

Administrator
Staff member
Licensed User

Interesting points:

- The world size is based on the screen size. The world width is constant. This is different than in other examples.
- The movement in B4A and B4i is done with a motor that moves the ship to the target point. In B4J we apply forces based on the input keys.

Example is included in the examples pack.

https://www.b4x.com/android/forum/threads/xui2d-example-pack.96454/#content

Credits

Resources were extracted from this open source project: https://github.com/tasdikrahman/spaceShooter
License:

Copyright © 2015 Tasdik Rahman

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

The images used in the game are taken from [http://opengameart.org/](http://opengameart.org/), more particulary from the [Space shooter content pack](http://opengameart.org/content/space-shooter-redux) from [@kenney](http://opengameart.org/users/kenney).

License for them is in `Public Domain`

The game sounds were again taken from [http://opengameart.org/](http://opengameart.org/). The game music, [Frozen Jam](http://opengameart.org/content/frozen-jam-seamless-loop) by [tgfcoder](https://twitter.com/tgfcoder) licensed under [CC-BY-3](http://creativecommons.org/licenses/by/3.0/)
The MIT License (MIT)
 

Erel

Administrator
Staff member
Licensed User
I've uploaded a new version. There was an issue related to the Start sub where it could have been called multiple times concurrently. It happened because this is a resumable sub (it waits for the "get ready" message to disappear).

The solution is:
B4X:
Public Sub Start
   If X2.IsRunning Then Return
   StartIndex = StartIndex + 1
   Dim MyIndex As Int = StartIndex
   Wait For (ShowMessage("Get Ready...")) Complete (Success As Boolean)
   If MyIndex <> StartIndex Then Return 'this means that the game was started again while the message appeared.
 
Top