├── .gitignore ├── LICENSE ├── Makefile ├── README.md ├── cmd ├── assetconvert │ └── main.go └── xship │ └── main.go ├── go.mod ├── go.sum ├── images ├── asset.png └── screenshoot1.jpg └── internal ├── constant └── constant.go ├── device ├── buttons.go ├── joystick.go ├── neo.go ├── setup.go ├── sound.go └── tft.go ├── entity ├── badguy │ ├── entity.go │ ├── entity1.go │ ├── entity2.go │ ├── entityCommon.go │ └── entityMissile.go ├── missile │ └── entity.go ├── stars │ └── entity.go └── xship │ └── entity.go ├── game.go ├── img ├── asset.go └── sprite.go ├── imgdata ├── asset.go └── sprite.go ├── intro_stage.go ├── loose_stage.go ├── play_stage.go ├── wave └── wave.go └── win_stage.go /.gitignore: -------------------------------------------------------------------------------- 1 | .vscode 2 | .idea/* 3 | !/.idea/runConfigurations 4 | pkged.go 5 | *-packr.go 6 | *.DS_Store 7 | src -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: install asset 2 | 3 | install: 4 | tinygo flash -target=pygamer cmd/xship/main.go 5 | 6 | asset: 7 | go run ./cmd/assetconvert 8 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # xship 2 | 3 | A shoot'em up built with [tinygo](https://tinygo.org/) for the [pygamer](https://www.adafruit.com/product/4242) 4 | 5 | ![screenshoot1](images/screenshoot1.jpg) 6 | 7 | *Maybe a good template to learn tinygo with microcontrollers*. 8 | 9 | ## Installation (Linux) 10 | 11 | Install tinygo >= 0.22.0. 12 | 13 | Connect your pygamer to a USB port. 14 | 15 | ```bash 16 | git clone git@github.com:jypelle/xship.git 17 | cd xship 18 | go get -u tinygo.org/x/drivers 19 | make install 20 | ``` 21 | 22 | Enjoy! 23 | 24 | ### Installation with new game asset 25 | 26 | If you have updated [game asset](images/asset.png): 27 | 28 | Install go >= 1.17 29 | 30 | ```bash 31 | make asset 32 | make install 33 | ``` 34 | -------------------------------------------------------------------------------- /cmd/assetconvert/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "image" 6 | "image/color" 7 | _ "image/png" 8 | "os" 9 | ) 10 | 11 | func main() { 12 | pngFile, err := os.Open("./images/asset.png") 13 | if err != nil { 14 | panic(err) 15 | } 16 | defer pngFile.Close() 17 | 18 | img, _, err := image.Decode(pngFile) 19 | if err != nil { 20 | panic(err) 21 | } 22 | 23 | size := img.Bounds().Size() 24 | 25 | goFile, err := os.Create("./internal/imgdata/asset.go") 26 | if err != nil { 27 | panic(err) 28 | } 29 | defer goFile.Close() 30 | 31 | goFile.WriteString(fmt.Sprintf(`package imgdata 32 | 33 | import "../img" 34 | 35 | var asset1 = img.Asset{ 36 | Width: %d, 37 | Height: %d, 38 | Data: []byte("`, size.X, size.Y)) 39 | 40 | for y := 0; y < size.Y; y++ { 41 | for x := 0; x < size.X; x++ { 42 | if (x > 0 || y > 0) && (y*size.X+x)%14 == 0 { 43 | goFile.WriteString(`" + 44 | "`) 45 | } 46 | c565 := RGBATo565(img.At(x, y)) 47 | //goFile.WriteString(fmt.Sprintf("%d,%d,", byte(c565), byte(c565 >> 8))) 48 | goFile.WriteString(fmt.Sprintf("\\%03o\\%03o", byte(c565), byte(c565>>8))) 49 | } 50 | } 51 | 52 | goFile.WriteString(`"), 53 | } 54 | `) 55 | } 56 | 57 | func RGBATo565(c color.Color) uint16 { 58 | r, g, b, _ := c.RGBA() 59 | return uint16((r & 0xF800) + 60 | ((g & 0xFC00) >> 5) + 61 | ((b & 0xF800) >> 11)) 62 | } 63 | -------------------------------------------------------------------------------- /cmd/xship/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "time" 5 | 6 | "github.com/jypelle/xship/internal" 7 | ) 8 | 9 | var iterationStartTime time.Time 10 | 11 | func main() { 12 | 13 | // led.Configure(machine.PinConfig{Mode: machine.PinOutput}) 14 | // Setup devices 15 | internal.Setup() 16 | 17 | // Start main loop 18 | var duration time.Duration 19 | for { 20 | iterationStartTime = time.Now() 21 | 22 | internal.Update() 23 | 24 | internal.Draw() 25 | 26 | duration = 32*time.Millisecond - time.Now().Sub(iterationStartTime) 27 | if duration > 0 { 28 | time.Sleep(duration) 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /go.mod: -------------------------------------------------------------------------------- 1 | module github.com/jypelle/xship 2 | 3 | go 1.17 4 | 5 | require tinygo.org/x/drivers v0.19.0 6 | -------------------------------------------------------------------------------- /go.sum: -------------------------------------------------------------------------------- 1 | github.com/bgould/http v0.0.0-20190627042742-d268792bdee7/go.mod h1:BTqvVegvwifopl4KTEDth6Zezs9eR+lCWhvGKvkxJHE= 2 | github.com/eclipse/paho.mqtt.golang v1.2.0/go.mod h1:H9keYFcgq3Qr5OUJm/JZI/i6U7joQ8SYLhZwfeOo6Ts= 3 | github.com/frankban/quicktest v1.10.2/go.mod h1:K+q6oSqb0W0Ininfk863uOk1lMy69l/P6txr3mVT54s= 4 | github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= 5 | github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= 6 | github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= 7 | github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= 8 | github.com/valyala/fastjson v1.6.3/go.mod h1:CLCAqky6SMuOcxStkYQvblddUtoRxhYMGLrsQns1aXY= 9 | golang.org/x/net v0.0.0-20210614182718-04defd469f4e/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= 10 | golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 11 | golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 12 | golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= 13 | golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= 14 | golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= 15 | golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 16 | tinygo.org/x/drivers v0.14.0/go.mod h1:uT2svMq3EpBZpKkGO+NQHjxjGf1f42ra4OnMMwQL2aI= 17 | tinygo.org/x/drivers v0.15.1/go.mod h1:uT2svMq3EpBZpKkGO+NQHjxjGf1f42ra4OnMMwQL2aI= 18 | tinygo.org/x/drivers v0.16.0/go.mod h1:uT2svMq3EpBZpKkGO+NQHjxjGf1f42ra4OnMMwQL2aI= 19 | tinygo.org/x/drivers v0.19.0 h1:x/TIC8SFWeGViJvcYO1ATjgwSNF7hHN2ouAyjMUXI2Q= 20 | tinygo.org/x/drivers v0.19.0/go.mod h1:uJD/l1qWzxzLx+vcxaW0eY464N5RAgFi1zTVzASFdqI= 21 | tinygo.org/x/tinyfont v0.2.1/go.mod h1:eLqnYSrFRjt5STxWaMeOWJTzrKhXqpWw7nU3bPfKOAM= 22 | tinygo.org/x/tinyfs v0.1.0/go.mod h1:ysc8Y92iHfhTXeyEM9+c7zviUQ4fN9UCFgSOFfMWv20= 23 | tinygo.org/x/tinyterm v0.1.0/go.mod h1:/DDhNnGwNF2/tNgHywvyZuCGnbH3ov49Z/6e8LPLRR4= 24 | -------------------------------------------------------------------------------- /images/asset.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jypelle/xship/cafaf1ccdd249941cc0585eaf35b04524ee29b98/images/asset.png -------------------------------------------------------------------------------- /images/screenshoot1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jypelle/xship/cafaf1ccdd249941cc0585eaf35b04524ee29b98/images/screenshoot1.jpg -------------------------------------------------------------------------------- /internal/constant/constant.go: -------------------------------------------------------------------------------- 1 | package constant 2 | 3 | const SCREEN_WIDTH int32 = 160 4 | const SCREEN_HEIGHT int32 = 128 5 | 6 | const BOARD_XOFFSET int32 = 0 7 | const BOARD_YOFFSET int32 = 0 8 | 9 | const BOARD_WIDTH int32 = 160 10 | const BOARD_HEIGHT int32 = 128 11 | 12 | const MISSILE_ENTITY_MAX = 12 13 | const BAD_GUY_ENTITY_MAX = 20 14 | 15 | const WHITE_STARS_MAX = 75 16 | const BLUE_STARS_MAX = 50 17 | -------------------------------------------------------------------------------- /internal/device/buttons.go: -------------------------------------------------------------------------------- 1 | package device 2 | 3 | import ( 4 | "machine" 5 | 6 | "tinygo.org/x/drivers/shifter" 7 | ) 8 | 9 | type buttonsDev struct { 10 | buttonsShifter shifter.Device 11 | previousButtonsId, buttonsId uint8 12 | } 13 | 14 | func NewButtonsDevice() *buttonsDev { 15 | return &buttonsDev{ 16 | buttonsShifter: shifter.New(shifter.EIGHT_BITS, machine.BUTTON_LATCH, machine.BUTTON_CLK, machine.BUTTON_OUT), 17 | } 18 | } 19 | 20 | func (d *buttonsDev) configure() { 21 | d.buttonsShifter.Configure() 22 | } 23 | 24 | func (d *buttonsDev) RefreshState() { 25 | d.previousButtonsId = d.buttonsId 26 | d.buttonsId, _ = d.buttonsShifter.Read8Input() 27 | } 28 | 29 | func (d *buttonsDev) IsAtLeastOneButtonPressed() bool { 30 | return d.previousButtonsId == 0 && d.buttonsId != 0 31 | } 32 | 33 | func (d *buttonsDev) IsButtonSelectPressed() bool { 34 | return d.previousButtonsId&machine.BUTTON_SELECT_MASK == 0 && d.buttonsId&machine.BUTTON_SELECT_MASK != 0 35 | } 36 | 37 | func (d *buttonsDev) IsButtonStartPressed() bool { 38 | return d.previousButtonsId&machine.BUTTON_START_MASK == 0 && d.buttonsId&machine.BUTTON_START_MASK != 0 39 | } 40 | 41 | func (d *buttonsDev) IsButtonAPressed() bool { 42 | return d.previousButtonsId&machine.BUTTON_A_MASK == 0 && d.buttonsId&machine.BUTTON_A_MASK != 0 43 | } 44 | 45 | func (d *buttonsDev) IsButtonBPressed() bool { 46 | return d.previousButtonsId&machine.BUTTON_B_MASK == 0 && d.buttonsId&machine.BUTTON_B_MASK != 0 47 | } 48 | 49 | func (d *buttonsDev) IsButtonSelectReleased() bool { 50 | return d.previousButtonsId&machine.BUTTON_SELECT_MASK != 0 && d.buttonsId&machine.BUTTON_SELECT_MASK == 0 51 | } 52 | 53 | func (d *buttonsDev) IsButtonStartReleased() bool { 54 | return d.previousButtonsId&machine.BUTTON_START_MASK != 0 && d.buttonsId&machine.BUTTON_START_MASK == 0 55 | } 56 | 57 | func (d *buttonsDev) IsButtonAReleased() bool { 58 | return d.previousButtonsId&machine.BUTTON_A_MASK != 0 && d.buttonsId&machine.BUTTON_A_MASK == 0 59 | } 60 | 61 | func (d *buttonsDev) IsButtonBReleased() bool { 62 | return d.previousButtonsId&machine.BUTTON_B_MASK != 0 && d.buttonsId&machine.BUTTON_B_MASK == 0 63 | } 64 | 65 | func (d *buttonsDev) IsButtonSelectHold() bool { 66 | return d.buttonsId&machine.BUTTON_SELECT_MASK != 0 67 | } 68 | 69 | func (d *buttonsDev) IsButtonStartHold() bool { 70 | return d.buttonsId&machine.BUTTON_START_MASK != 0 71 | } 72 | 73 | func (d *buttonsDev) IsButtonAHold() bool { 74 | return d.buttonsId&machine.BUTTON_A_MASK != 0 75 | } 76 | 77 | func (d *buttonsDev) IsButtonBHold() bool { 78 | return d.buttonsId&machine.BUTTON_B_MASK != 0 79 | } 80 | -------------------------------------------------------------------------------- /internal/device/joystick.go: -------------------------------------------------------------------------------- 1 | package device 2 | 3 | import ( 4 | "machine" 5 | ) 6 | 7 | type joystickDev struct { 8 | x machine.ADC 9 | y machine.ADC 10 | } 11 | 12 | func NewJoystickDevice() *joystickDev { 13 | return &joystickDev{x: machine.ADC{machine.JOYX}, y: machine.ADC{machine.JOYY}} 14 | } 15 | 16 | func (d *joystickDev) configure() { 17 | d.x.Configure(machine.ADCConfig{}) 18 | d.y.Configure(machine.ADCConfig{}) 19 | } 20 | 21 | func (d *joystickDev) Xaxis() int { 22 | x := d.x.Get() 23 | switch { 24 | case x > 58768: 25 | return 2 26 | case x > 38768: 27 | return 1 28 | case x > 26768: 29 | return 0 30 | case x > 6768: 31 | return -1 32 | default: 33 | return -2 34 | } 35 | } 36 | 37 | func (d *joystickDev) Yaxis() int { 38 | x := d.y.Get() 39 | switch { 40 | case x > 58768: 41 | return 2 42 | case x > 38768: 43 | return 1 44 | case x > 26768: 45 | return 0 46 | case x > 6768: 47 | return -1 48 | default: 49 | return -2 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /internal/device/neo.go: -------------------------------------------------------------------------------- 1 | package device 2 | 3 | import ( 4 | "machine" 5 | 6 | "tinygo.org/x/drivers/ws2812" 7 | ) 8 | 9 | type neoDev struct { 10 | ws2812.Device 11 | } 12 | 13 | func NewNeoDevice(pin machine.Pin) *neoDev { 14 | return &neoDev{ 15 | Device: ws2812.New(pin), 16 | } 17 | } 18 | 19 | func (d *neoDev) configure() { 20 | d.Pin.Configure(machine.PinConfig{Mode: machine.PinOutput}) 21 | } 22 | -------------------------------------------------------------------------------- /internal/device/setup.go: -------------------------------------------------------------------------------- 1 | package device 2 | 3 | import ( 4 | "machine" 5 | 6 | "github.com/jypelle/xship/internal/constant" 7 | ) 8 | 9 | var NeoDevice = NewNeoDevice(machine.NEOPIXELS) 10 | var ButtonsDevice = NewButtonsDevice() 11 | var JoystickDevice = NewJoystickDevice() 12 | var TftDevice = NewTftDevice(constant.SCREEN_WIDTH, constant.SCREEN_HEIGHT) 13 | var SoundDevice = NewSoundDevice(machine.A0) 14 | 15 | func Setup() { 16 | machine.InitADC() 17 | 18 | // Neopixel 19 | NeoDevice.configure() 20 | 21 | // Buttons 22 | ButtonsDevice.configure() 23 | 24 | // Joystick 25 | JoystickDevice.configure() 26 | 27 | // Tft 28 | TftDevice.configure() 29 | 30 | // Sound 31 | SoundDevice.configure() 32 | } 33 | -------------------------------------------------------------------------------- /internal/device/sound.go: -------------------------------------------------------------------------------- 1 | package device 2 | 3 | import ( 4 | "machine" 5 | 6 | "tinygo.org/x/drivers/buzzer" 7 | ) 8 | 9 | type soundDev struct { 10 | buzzer.Device 11 | } 12 | 13 | func NewSoundDevice(pin machine.Pin) *soundDev { 14 | return &soundDev{ 15 | Device: buzzer.New(pin), 16 | } 17 | } 18 | 19 | func (d *soundDev) configure() { 20 | speaker := machine.SPEAKER_ENABLE 21 | speaker.Configure(machine.PinConfig{Mode: machine.PinOutput}) 22 | speaker.Set(true) 23 | 24 | machine.A0.Configure(machine.PinConfig{Mode: machine.PinOutput}) 25 | } 26 | -------------------------------------------------------------------------------- /internal/device/tft.go: -------------------------------------------------------------------------------- 1 | package device 2 | 3 | import ( 4 | "image/color" 5 | "machine" 6 | 7 | "github.com/jypelle/xship/internal/img" 8 | "tinygo.org/x/drivers/st7735" 9 | ) 10 | 11 | type tftDev struct { 12 | st7735.Device 13 | tft565Buffer []uint8 14 | width, height int32 15 | } 16 | 17 | func NewTftDevice(width, height int32) *tftDev { 18 | return &tftDev{ 19 | Device: st7735.New(machine.SPI1, machine.TFT_RST, machine.TFT_DC, machine.TFT_CS, machine.TFT_LITE), 20 | tft565Buffer: make([]uint8, height*width*2), 21 | width: width, 22 | height: height, 23 | } 24 | } 25 | 26 | func (d *tftDev) configure() { 27 | machine.SPI1.Configure(machine.SPIConfig{ 28 | Frequency: 16000000, 29 | SCK: machine.SPI1_SCK_PIN, 30 | SDO: machine.SPI1_SDO_PIN, 31 | SDI: machine.SPI1_SDI_PIN, 32 | }) 33 | d.Device.Configure(st7735.Config{ 34 | Rotation: st7735.ROTATION_90, 35 | Model: st7735.GREENTAB, 36 | }) 37 | d.FillScreen(color.RGBA{}) 38 | } 39 | 40 | func (d *tftDev) SetPixel(x, y int32, color color.RGBA) { 41 | if color.A > 0 && x >= 0 && x < d.width && y >= 0 && y < d.height { 42 | c565 := st7735.RGBATo565(color) 43 | d.tft565Buffer[(y*d.width+x)*2] = uint8(c565 >> 8) 44 | d.tft565Buffer[(y*d.width+x)*2+1] = uint8(c565) 45 | } 46 | } 47 | 48 | var blackC565 = st7735.RGBATo565(color.RGBA{R: 0, G: 0, B: 0, A: 255}) 49 | 50 | func (d *tftDev) DrawImageFromAsset(imageAsset img.ImageAsset, offset img.Position, frame int) { 51 | fullXOffset := imageAsset.Offset[frame%len(imageAsset.Offset)].X 52 | fullYOffset := imageAsset.Offset[frame%len(imageAsset.Offset)].Y 53 | var pixelOffset int32 54 | for y := int32(0); y < imageAsset.Height; y++ { 55 | for x := int32(0); x < imageAsset.Width; x++ { 56 | pixelOffset = ((fullYOffset+y)*imageAsset.Asset.Width + fullXOffset + x) * 2 57 | d.SetPixelFromC565Alpha( 58 | int32(offset.X)+x, int32(offset.Y)+y, 59 | uint16(imageAsset.Asset.Data[pixelOffset])|uint16(imageAsset.Asset.Data[pixelOffset+1])<<8, 60 | ) 61 | } 62 | } 63 | } 64 | 65 | func (d *tftDev) SetPixelFromC565(x, y int32, c565 uint16) { 66 | if x >= 0 && x < d.width && y >= 0 && y < d.height { 67 | d.tft565Buffer[(y*d.width+x)*2] = uint8(c565 >> 8) 68 | d.tft565Buffer[(y*d.width+x)*2+1] = uint8(c565) 69 | } 70 | } 71 | 72 | func (d *tftDev) SetPixelFromC565Alpha(x, y int32, c565 uint16) { 73 | if c565 > 0 && x >= 0 && x < d.width && y >= 0 && y < d.height { 74 | d.tft565Buffer[(y*d.width+x)*2] = uint8(c565 >> 8) 75 | d.tft565Buffer[(y*d.width+x)*2+1] = uint8(c565) 76 | } 77 | } 78 | 79 | func (d *tftDev) Clear() { 80 | for y := int32(0); y < d.height; y++ { 81 | for x := int32(0); x < d.width; x++ { 82 | d.SetPixelFromC565(x, y, blackC565) 83 | } 84 | } 85 | } 86 | 87 | func (d *tftDev) Refresh() error { 88 | 89 | // Set window 90 | d.Tx([]uint8{st7735.CASET}, true) 91 | d.Tx([]uint8{uint8(0 >> 8), uint8(0), uint8((d.width - 1) >> 8), uint8(d.width - 1)}, false) 92 | d.Tx([]uint8{st7735.RASET}, true) 93 | d.Tx([]uint8{uint8(0 >> 8), uint8(0), uint8((d.height - 1) >> 8), uint8(d.height - 1)}, false) 94 | d.Command(st7735.RAMWR) 95 | 96 | // Send pixels data 97 | d.Tx(d.tft565Buffer, false) 98 | 99 | return nil 100 | } 101 | 102 | func (d *tftDev) Width() int32 { 103 | return d.width 104 | } 105 | 106 | func (d *tftDev) Height() int32 { 107 | return d.height 108 | } 109 | -------------------------------------------------------------------------------- /internal/entity/badguy/entity.go: -------------------------------------------------------------------------------- 1 | package badguy 2 | 3 | import ( 4 | "github.com/jypelle/xship/internal/entity/missile" 5 | "github.com/jypelle/xship/internal/entity/xship" 6 | "github.com/jypelle/xship/internal/img" 7 | ) 8 | 9 | type Type uint8 10 | 11 | const ( 12 | BadGuy1Type Type = iota 13 | BadGuy2Type 14 | MissileType 15 | ) 16 | 17 | type State int8 18 | 19 | const ( 20 | BadGuyDisabledState State = iota 21 | BadGuyExplodingState 22 | BadGuyEnabledState 23 | ) 24 | 25 | type Entity interface { 26 | Type() Type 27 | State() State 28 | Position() img.Position 29 | 30 | Move() 31 | Update(xshipEntity *xship.Entity, missileEntities []*missile.Entity, score *int) (newBadGuys []Entity) 32 | Draw() 33 | } 34 | -------------------------------------------------------------------------------- /internal/entity/badguy/entity1.go: -------------------------------------------------------------------------------- 1 | package badguy 2 | 3 | import ( 4 | "github.com/jypelle/xship/internal/device" 5 | "github.com/jypelle/xship/internal/entity/missile" 6 | "github.com/jypelle/xship/internal/entity/xship" 7 | "github.com/jypelle/xship/internal/img" 8 | "github.com/jypelle/xship/internal/imgdata" 9 | "tinygo.org/x/drivers/buzzer" 10 | ) 11 | 12 | type entity1 struct { 13 | entityCommon 14 | yref int32 15 | } 16 | 17 | func NewEntity1(position img.Position) *entity1 { 18 | e := &entity1{ 19 | entityCommon: NewEntityCommon(position), 20 | yref: position.Y, 21 | } 22 | return e 23 | } 24 | 25 | func (e *entity1) Type() Type { 26 | return BadGuy1Type 27 | } 28 | 29 | func (e *entity1) Move() { 30 | e.entityCommon.Move() 31 | 32 | if e.state == BadGuyEnabledState { 33 | e.position.X -= 2 34 | // e.position.Y = e.yref + int32(5.0*math.Cos(float64(e.tickCount)/3.0)) 35 | } else if e.state == BadGuyExplodingState { 36 | e.position.X -= 2 37 | } 38 | } 39 | 40 | func (e *entity1) Update(xshipEntity *xship.Entity, missileEntities []*missile.Entity, score *int) (newBadGuys []Entity) { 41 | if e.state == BadGuyEnabledState { 42 | if e.position.X < -40 { 43 | e.state = BadGuyDisabledState 44 | if *score > 0 { 45 | *score-- 46 | } 47 | } else { 48 | // Xship collision 49 | if xshipEntity.IsVulnerable() && img.IsCollided(&imgdata.XshipSprite.HitBox, xshipEntity.Position(), &imgdata.BadGuy1Sprite.HitBox, e.position) { 50 | e.explode() 51 | xshipEntity.Hit(1) 52 | } else { 53 | // Missile collision 54 | for id := range missileEntities { 55 | if missileEntities[id] != nil { 56 | if img.IsCollided(&imgdata.MissileSprite.HitBox, missileEntities[id].Position, &imgdata.BadGuy1Sprite.HitBox, e.Position()) { 57 | e.explode() 58 | missileEntities[id] = nil 59 | device.SoundDevice.Tone(buzzer.B1, 0.008) 60 | *score += 5 61 | } 62 | } 63 | } 64 | 65 | // BadGuy shoot a BadGuyMissile 66 | if (e.tickCount-1)%4 == 0 && ((e.tickCount-1)/16)%3 == 0 { 67 | newBadGuys = append(newBadGuys, NewEntityMissile(img.Position{ 68 | X: e.position.X - 2, 69 | Y: e.position.Y + 7, 70 | })) 71 | } 72 | } 73 | } 74 | } else if e.state == BadGuyExplodingState { 75 | if e.tickCount/2 > 2 { 76 | e.state = BadGuyDisabledState 77 | } 78 | } 79 | 80 | return 81 | 82 | } 83 | 84 | func (e *entity1) Draw() { 85 | if e.state == BadGuyEnabledState { 86 | device.TftDevice.DrawImageFromAsset(imgdata.BadGuy1Sprite.ImageAsset, e.position, (e.tickCount/4)%3) 87 | } else if e.state == BadGuyExplodingState { 88 | device.TftDevice.DrawImageFromAsset(imgdata.ExplodedBadGuy1Sprite.ImageAsset, e.position, (e.tickCount/2)%3) 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /internal/entity/badguy/entity2.go: -------------------------------------------------------------------------------- 1 | package badguy 2 | 3 | import ( 4 | "github.com/jypelle/xship/internal/device" 5 | "github.com/jypelle/xship/internal/entity/missile" 6 | "github.com/jypelle/xship/internal/entity/xship" 7 | "github.com/jypelle/xship/internal/img" 8 | "github.com/jypelle/xship/internal/imgdata" 9 | "tinygo.org/x/drivers/buzzer" 10 | ) 11 | 12 | type entity2 struct { 13 | entityCommon 14 | } 15 | 16 | func NewEntity2(position img.Position) *entity2 { 17 | e := &entity2{ 18 | NewEntityCommon(position), 19 | } 20 | return e 21 | } 22 | 23 | func (e *entity2) Type() Type { 24 | return BadGuy2Type 25 | } 26 | 27 | func (e *entity2) Move() { 28 | e.entityCommon.Move() 29 | 30 | if e.state == BadGuyEnabledState { 31 | e.position.X -= 5 32 | } else if e.state == BadGuyExplodingState { 33 | e.position.X -= 2 34 | } 35 | } 36 | 37 | func (e *entity2) Update(xshipEntity *xship.Entity, missileEntities []*missile.Entity, score *int) (newBadGuys []Entity) { 38 | if e.state == BadGuyEnabledState { 39 | if e.position.X < -40 { 40 | e.state = BadGuyDisabledState 41 | if *score > 0 { 42 | *score-- 43 | } 44 | } else { 45 | // Xship collision 46 | if xshipEntity.IsVulnerable() && img.IsCollided(&imgdata.XshipSprite.HitBox, xshipEntity.Position(), &imgdata.BadGuy2Sprite.HitBox, e.position) { 47 | e.explode() 48 | xshipEntity.Hit(2) 49 | } else { 50 | // Missile collision 51 | for id := range missileEntities { 52 | if missileEntities[id] != nil { 53 | if img.IsCollided(&imgdata.MissileSprite.HitBox, missileEntities[id].Position, &imgdata.BadGuy2Sprite.HitBox, e.Position()) { 54 | e.explode() 55 | missileEntities[id] = nil 56 | device.SoundDevice.Tone(buzzer.B1, 0.008) 57 | *score += 50 58 | } 59 | } 60 | } 61 | } 62 | } 63 | } else if e.state == BadGuyExplodingState { 64 | if e.tickCount/2 > 2 { 65 | e.state = BadGuyDisabledState 66 | } 67 | } 68 | 69 | return 70 | } 71 | 72 | func (e *entity2) Draw() { 73 | if e.state == BadGuyEnabledState { 74 | device.TftDevice.DrawImageFromAsset(imgdata.BadGuy2Sprite.ImageAsset, e.position, (e.tickCount/4)%3) 75 | } else if e.state == BadGuyExplodingState { 76 | device.TftDevice.DrawImageFromAsset(imgdata.ExplodedBadGuy2Sprite.ImageAsset, e.position, (e.tickCount/2)%3) 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /internal/entity/badguy/entityCommon.go: -------------------------------------------------------------------------------- 1 | package badguy 2 | 3 | import ( 4 | "github.com/jypelle/xship/internal/img" 5 | ) 6 | 7 | func NewEntityCommon(position img.Position) entityCommon { 8 | e := entityCommon{ 9 | state: BadGuyEnabledState, 10 | position: position, 11 | tickCount: 0, 12 | } 13 | return e 14 | } 15 | 16 | type entityCommon struct { 17 | state State 18 | position img.Position 19 | tickCount int 20 | } 21 | 22 | func (e *entityCommon) State() State { 23 | return e.state 24 | } 25 | 26 | func (e *entityCommon) Position() img.Position { 27 | return e.position 28 | } 29 | 30 | func (e *entityCommon) explode() { 31 | e.tickCount = 0 32 | e.state = BadGuyExplodingState 33 | } 34 | 35 | func (e *entityCommon) Move() { 36 | e.tickCount++ 37 | } 38 | -------------------------------------------------------------------------------- /internal/entity/badguy/entityMissile.go: -------------------------------------------------------------------------------- 1 | package badguy 2 | 3 | import ( 4 | "github.com/jypelle/xship/internal/device" 5 | "github.com/jypelle/xship/internal/entity/missile" 6 | "github.com/jypelle/xship/internal/entity/xship" 7 | "github.com/jypelle/xship/internal/img" 8 | "github.com/jypelle/xship/internal/imgdata" 9 | ) 10 | 11 | type entityMissile struct { 12 | entityCommon 13 | } 14 | 15 | func NewEntityMissile(position img.Position) *entityMissile { 16 | e := &entityMissile{ 17 | NewEntityCommon(position), 18 | } 19 | return e 20 | } 21 | 22 | func (e *entityMissile) Type() Type { 23 | return MissileType 24 | } 25 | 26 | func (e *entityMissile) Move() { 27 | e.entityCommon.Move() 28 | e.position.X -= 5 29 | } 30 | 31 | func (e *entityMissile) Update(xshipEntity *xship.Entity, missileEntities []*missile.Entity, score *int) (newBadGuys []Entity) { 32 | if e.state == BadGuyEnabledState { 33 | if e.position.X < -40 { 34 | e.state = BadGuyDisabledState 35 | } else { 36 | // Xship collision 37 | if xshipEntity.IsVulnerable() && img.IsCollided(&imgdata.XshipSprite.HitBox, xshipEntity.Position(), &imgdata.MissileSprite.HitBox, e.position) { 38 | e.explode() 39 | xshipEntity.Hit(1) 40 | } 41 | } 42 | } 43 | 44 | return 45 | } 46 | 47 | func (e *entityMissile) Draw() { 48 | frame := e.tickCount / 2 49 | if frame >= 2 { 50 | frame = 2 51 | } 52 | device.TftDevice.DrawImageFromAsset(imgdata.BadMissileSprite.ImageAsset, e.position, frame) 53 | } 54 | -------------------------------------------------------------------------------- /internal/entity/missile/entity.go: -------------------------------------------------------------------------------- 1 | package missile 2 | 3 | import ( 4 | "github.com/jypelle/xship/internal/device" 5 | "github.com/jypelle/xship/internal/img" 6 | "github.com/jypelle/xship/internal/imgdata" 7 | ) 8 | 9 | type Entity struct { 10 | img.Position 11 | tickCount int 12 | } 13 | 14 | func (e *Entity) Move() { 15 | e.tickCount++ 16 | e.X += 5 17 | } 18 | 19 | func (e *Entity) Draw() { 20 | device.TftDevice.DrawImageFromAsset(imgdata.MissileSprite.ImageAsset, e.Position, 0) 21 | } 22 | -------------------------------------------------------------------------------- /internal/entity/stars/entity.go: -------------------------------------------------------------------------------- 1 | package stars 2 | 3 | import ( 4 | "image/color" 5 | "math/rand" 6 | 7 | "github.com/jypelle/xship/internal/constant" 8 | "github.com/jypelle/xship/internal/device" 9 | "github.com/jypelle/xship/internal/img" 10 | "github.com/jypelle/xship/internal/imgdata" 11 | "tinygo.org/x/drivers/st7735" 12 | ) 13 | 14 | type Entity struct { 15 | enabled bool 16 | intensity float64 17 | offsetX int32 18 | glowingTick int32 19 | glowingId int32 20 | blueStarPositions []img.Position 21 | whiteStarPositions []img.Position 22 | } 23 | 24 | func NewStarsEntity() *Entity { 25 | s := Entity{ 26 | blueStarPositions: make([]img.Position, constant.BLUE_STARS_MAX), 27 | whiteStarPositions: make([]img.Position, constant.WHITE_STARS_MAX), 28 | } 29 | 30 | // Create starBackground 31 | for i := 0; i < 50; i++ { 32 | s.blueStarPositions[i] = img.Position{ 33 | X: rand.Int31n(constant.BOARD_WIDTH), 34 | Y: rand.Int31n(constant.BOARD_HEIGHT), 35 | } 36 | } 37 | for i := 0; i < 75; i++ { 38 | s.whiteStarPositions[i] = img.Position{ 39 | X: rand.Int31n(constant.BOARD_WIDTH), 40 | Y: rand.Int31n(constant.BOARD_HEIGHT), 41 | } 42 | } 43 | s.Reset() 44 | return &s 45 | } 46 | 47 | func (s *Entity) Reset() { 48 | s.intensity = 0 49 | s.offsetX = 0 50 | s.enabled = true 51 | s.glowingTick = -1 52 | s.glowingId = -1 53 | } 54 | 55 | func (s *Entity) Move() { 56 | // Move background stars 57 | s.offsetX = (s.offsetX + 1) % (4 * constant.BOARD_WIDTH) 58 | s.glowingTick = (s.glowingTick + 1) % (4 * 9) 59 | if s.glowingTick == 0 { 60 | s.glowingId = rand.Int31n(constant.WHITE_STARS_MAX) 61 | } 62 | } 63 | 64 | func (s *Entity) Draw() { 65 | // Draw blue stars 66 | for i := 0; i < constant.BLUE_STARS_MAX; i++ { 67 | device.TftDevice.SetPixelFromC565( 68 | constant.BOARD_XOFFSET+(constant.BOARD_WIDTH+int32(s.blueStarPositions[i].X)-s.offsetX/4)%constant.BOARD_WIDTH, 69 | constant.BOARD_YOFFSET+int32(s.blueStarPositions[i].Y), 70 | st7735.RGBATo565(color.RGBA{R: uint8(s.intensity * float64(130)), G: uint8(s.intensity * float64(130)), B: uint8(s.intensity * float64(200)), A: 255}), 71 | ) 72 | } 73 | // Draw white stars 74 | for i := int32(0); i < constant.WHITE_STARS_MAX; i++ { 75 | if !(i == s.glowingId && s.glowingTick/4 > 0) { 76 | device.TftDevice.SetPixelFromC565( 77 | constant.BOARD_XOFFSET+(constant.BOARD_WIDTH*4+s.whiteStarPositions[i].X-s.offsetX/2)%constant.BOARD_WIDTH, 78 | constant.BOARD_YOFFSET+int32(s.whiteStarPositions[i].Y), 79 | st7735.RGBATo565(color.RGBA{R: uint8(s.intensity * float64(200)), G: uint8(s.intensity * float64(200)), B: uint8(s.intensity * float64(200)), A: 255}), 80 | ) 81 | } else { 82 | device.TftDevice.DrawImageFromAsset( 83 | imgdata.GlowingWhiteStarSprite.ImageAsset, 84 | img.Position{ 85 | X: constant.BOARD_XOFFSET + (constant.BOARD_WIDTH*4+s.whiteStarPositions[i].X-s.offsetX/2)%constant.BOARD_WIDTH - 4, 86 | Y: constant.BOARD_YOFFSET + s.whiteStarPositions[i].Y - 4, 87 | }, 88 | int(s.glowingTick/4-1), 89 | ) 90 | } 91 | } 92 | } 93 | 94 | func (s *Entity) Intensity() float64 { 95 | return s.intensity 96 | } 97 | 98 | func (s *Entity) AddIntensity(i float64) { 99 | s.intensity += i 100 | } 101 | -------------------------------------------------------------------------------- /internal/entity/xship/entity.go: -------------------------------------------------------------------------------- 1 | package xship 2 | 3 | import ( 4 | "github.com/jypelle/xship/internal/constant" 5 | "github.com/jypelle/xship/internal/device" 6 | "github.com/jypelle/xship/internal/entity/missile" 7 | "github.com/jypelle/xship/internal/img" 8 | "github.com/jypelle/xship/internal/imgdata" 9 | "tinygo.org/x/drivers/buzzer" 10 | ) 11 | 12 | type Entity struct { 13 | position img.Position 14 | remainingBlinkTick int 15 | healthPoint int 16 | isMoving bool 17 | autoFire bool 18 | autoFireTick int 19 | } 20 | 21 | func NewEntity() *Entity { 22 | e := Entity{ 23 | position: img.Position{X: 0, Y: 56}, 24 | remainingBlinkTick: 60, 25 | } 26 | return &e 27 | } 28 | 29 | func (e *Entity) Position() img.Position { 30 | return e.position 31 | } 32 | 33 | func (e *Entity) IsVulnerable() bool { 34 | return e.remainingBlinkTick == 0 35 | } 36 | 37 | func (e *Entity) IntroMove() { 38 | e.isMoving = true 39 | e.position.X++ 40 | } 41 | 42 | func (e *Entity) Move() { 43 | e.isMoving = false 44 | if device.JoystickDevice.Xaxis() < 0 { 45 | e.isMoving = true 46 | e.position.X-- 47 | if device.JoystickDevice.Xaxis() == -2 { 48 | e.position.X -= 2 49 | } 50 | if e.position.X < 0 { 51 | e.position.X = 0 52 | } 53 | } 54 | if device.JoystickDevice.Xaxis() > 0 { 55 | e.isMoving = true 56 | e.position.X++ 57 | if device.JoystickDevice.Xaxis() == 2 { 58 | e.position.X += 3 59 | } 60 | if e.position.X > constant.BOARD_WIDTH-30 { 61 | e.position.X = constant.BOARD_WIDTH - 30 62 | } 63 | } 64 | if device.JoystickDevice.Yaxis() < 0 { 65 | e.isMoving = true 66 | e.position.Y-- 67 | if device.JoystickDevice.Yaxis() == -2 { 68 | e.position.Y -= 3 69 | } 70 | if e.position.Y < 0 { 71 | e.position.Y = 0 72 | } 73 | } 74 | if device.JoystickDevice.Yaxis() > 0 { 75 | e.isMoving = true 76 | e.position.Y++ 77 | if device.JoystickDevice.Yaxis() == 2 { 78 | e.position.Y += 3 79 | } 80 | if e.position.Y > constant.BOARD_HEIGHT-16 { 81 | e.position.Y = constant.BOARD_HEIGHT - 16 82 | } 83 | } 84 | if e.autoFire { 85 | e.autoFireTick++ 86 | } 87 | 88 | } 89 | 90 | func (e *Entity) IntroUpdate() { 91 | if e.remainingBlinkTick > 0 { 92 | e.remainingBlinkTick-- 93 | } 94 | } 95 | 96 | func (e *Entity) Update(missilesIdx *int, missileEntities []*missile.Entity) { 97 | // Enable/disable autofire 98 | if device.ButtonsDevice.IsButtonAPressed() { 99 | e.autoFire = true 100 | e.autoFireTick = 0 101 | } 102 | if device.ButtonsDevice.IsButtonAReleased() { 103 | e.autoFire = false 104 | } 105 | 106 | // Generate 1 missile each 4 ticks when autofire is enabled 107 | if e.autoFire && e.autoFireTick%4 == 0 { 108 | device.SoundDevice.Tone(buzzer.B3, 0.008) 109 | missileEntities[*missilesIdx] = &missile.Entity{ 110 | Position: img.Position{ 111 | X: e.position.X + 22, 112 | Y: e.position.Y + 9, 113 | }, 114 | } 115 | *missilesIdx = (*missilesIdx + 1) % constant.MISSILE_ENTITY_MAX 116 | } 117 | 118 | if e.remainingBlinkTick > 0 { 119 | e.remainingBlinkTick-- 120 | } 121 | } 122 | 123 | func (e *Entity) Draw() { 124 | if e.remainingBlinkTick == 0 || e.remainingBlinkTick%4 < 2 { 125 | if e.isMoving { 126 | device.TftDevice.DrawImageFromAsset(imgdata.XshipSprite.ImageAsset, e.position, 1) 127 | } else { 128 | device.TftDevice.DrawImageFromAsset(imgdata.XshipSprite.ImageAsset, e.position, 0) 129 | } 130 | } 131 | } 132 | 133 | func (e *Entity) Hit(hitPoint int) { 134 | e.remainingBlinkTick = 60 135 | device.SoundDevice.Tone(buzzer.B1, 0.008) 136 | e.healthPoint -= hitPoint 137 | } 138 | 139 | func (e *Entity) SetHealthPoint(hp int) { 140 | e.healthPoint = hp 141 | if e.healthPoint > 5 { 142 | e.healthPoint = 5 143 | } 144 | } 145 | 146 | func (e *Entity) HealthPoint() int { 147 | return e.healthPoint 148 | } 149 | -------------------------------------------------------------------------------- /internal/game.go: -------------------------------------------------------------------------------- 1 | package internal 2 | 3 | import ( 4 | "image/color" 5 | 6 | "github.com/jypelle/xship/internal/device" 7 | "github.com/jypelle/xship/internal/entity/stars" 8 | "github.com/jypelle/xship/internal/entity/xship" 9 | ) 10 | 11 | // Buffers 12 | var neoLeds [5]color.RGBA 13 | 14 | var hpColors = []color.RGBA{ 15 | {R: 8, G: 0, B: 0, A: 255}, 16 | {R: 6, G: 2, B: 0, A: 255}, 17 | {R: 4, G: 4, B: 0, A: 255}, 18 | {R: 2, G: 6, B: 0, A: 255}, 19 | {R: 0, G: 8, B: 0, A: 255}, 20 | } 21 | 22 | var blackColor = color.RGBA{R: 0, G: 0, B: 0, A: 255} 23 | 24 | type GameStage int 25 | 26 | const ( 27 | UndefinedStage GameStage = iota 28 | IntroStage 29 | PlayStage 30 | WinStage 31 | LooseStage 32 | ) 33 | 34 | var gameStage = UndefinedStage 35 | var nextGameStage = IntroStage 36 | 37 | var xshipEntity *xship.Entity 38 | var starsEntity *stars.Entity 39 | var score int 40 | 41 | func Setup() { 42 | 43 | // Setup devices 44 | device.Setup() 45 | 46 | starsEntity = stars.NewStarsEntity() 47 | } 48 | 49 | func Update() { 50 | device.ButtonsDevice.RefreshState() 51 | 52 | if nextGameStage != gameStage { 53 | gameStage = nextGameStage 54 | 55 | switch gameStage { 56 | case IntroStage: 57 | IntroStageReset() 58 | case PlayStage: 59 | PlayStageReset() 60 | case WinStage: 61 | WinStageReset() 62 | case LooseStage: 63 | LooseStageReset() 64 | } 65 | } 66 | 67 | switch gameStage { 68 | case IntroStage: 69 | IntroStageUpdate() 70 | case PlayStage: 71 | PlayStageUpdate() 72 | case WinStage: 73 | WinStageUpdate() 74 | case LooseStage: 75 | LooseStageUpdate() 76 | } 77 | 78 | } 79 | 80 | func Draw() { 81 | 82 | // Clear Screen 83 | device.TftDevice.Clear() 84 | 85 | switch gameStage { 86 | case IntroStage: 87 | IntroStageDraw() 88 | case PlayStage: 89 | PlayStageDraw() 90 | case WinStage: 91 | WinStageDraw() 92 | case LooseStage: 93 | LooseStageDraw() 94 | } 95 | 96 | // Send image to tftDevice screen 97 | device.TftDevice.Refresh() 98 | 99 | } 100 | -------------------------------------------------------------------------------- /internal/img/asset.go: -------------------------------------------------------------------------------- 1 | package img 2 | 3 | type Position struct { 4 | X int32 5 | Y int32 6 | } 7 | 8 | type Asset struct { 9 | Width int32 10 | Height int32 11 | Data []byte 12 | } 13 | 14 | type ImageAsset struct { 15 | Asset *Asset 16 | Offset []Position 17 | Width int32 18 | Height int32 19 | } 20 | -------------------------------------------------------------------------------- /internal/img/sprite.go: -------------------------------------------------------------------------------- 1 | package img 2 | 3 | type HitBox struct { 4 | Offset Position 5 | Width int32 6 | Height int32 7 | } 8 | 9 | type Sprite struct { 10 | ImageAsset 11 | HitBox HitBox 12 | } 13 | 14 | func IsCollided(hitBox1 *HitBox, position1 Position, hitBox2 *HitBox, position2 Position) bool { 15 | return (position1.X+hitBox1.Offset.X)+hitBox1.Width > position2.X+hitBox2.Offset.X && position1.X+hitBox1.Offset.X < (position2.X+hitBox2.Offset.X+hitBox2.Width) && 16 | (position1.Y+hitBox1.Offset.Y)+hitBox1.Height > position2.Y+hitBox2.Offset.Y && position1.Y+hitBox1.Offset.Y < (position2.Y+hitBox2.Height) 17 | } 18 | -------------------------------------------------------------------------------- /internal/imgdata/asset.go: -------------------------------------------------------------------------------- 1 | package imgdata 2 | 3 | import "github.com/jypelle/xship/internal/img" 4 | 5 | var asset1 = img.Asset{ 6 | Width: 70, 7 | Height: 116, 8 | Data: []byte("\000\000\244\030\244\030\244\030\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 9 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\244\030" + 10 | "\244\030\244\030\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 11 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 12 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 13 | "\000\000\244\030\241\364\246\375\244\030\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 14 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\244\030" + 15 | "\241\364\246\375\244\030\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 16 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 17 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 18 | "\000\000\244\030\241\364\241\364\246\375\244\030\000\000\000\000\244\030\244\030\244\030\244\030\244\030\000\000" + 19 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\244\030" + 20 | "\241\364\241\364\246\375\244\030\000\000\000\000\244\030\244\030\244\030\244\030\244\030\000\000\000\000\000\000" + 21 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 22 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 23 | "\000\000\244\030\200\273\241\364\241\364\246\375\244\030\244\030\136\057\136\057\136\057\377\377\377\377\244\030" + 24 | "\244\030\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\244\030" + 25 | "\200\273\241\364\241\364\246\375\244\030\244\030\136\057\136\057\136\057\377\377\377\377\244\030\244\030\000\000" + 26 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 27 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 28 | "\000\000\000\000\244\030\200\273\200\273\200\273\244\030\021\003\333\004\333\004\333\004\333\004\333\004\136\057" + 29 | "\377\377\244\030\244\030\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 30 | "\244\030\200\273\200\273\200\273\244\030\021\003\333\004\333\004\333\004\333\004\333\004\136\057\377\377\244\030" + 31 | "\244\030\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 32 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 33 | "\000\000\000\000\244\030\200\273\244\030\244\030\244\030\244\030\244\030\021\003\021\003\021\003\021\003\333\004" + 34 | "\333\004\333\004\333\004\244\030\244\030\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 35 | "\244\030\200\273\244\030\244\030\244\030\244\030\244\030\021\003\021\003\021\003\021\003\333\004\333\004\333\004" + 36 | "\333\004\244\030\244\030\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 37 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 38 | "\000\000\244\030\244\030\244\030\244\030\244\030\241\364\246\375\246\375\244\030\244\030\244\030\244\030\244\030" + 39 | "\244\030\244\030\244\030\244\030\244\030\244\030\244\030\244\030\244\030\000\000\000\000\000\000\000\000\244\030" + 40 | "\244\030\244\030\244\030\244\030\241\364\246\375\246\375\244\030\244\030\244\030\244\030\244\030\244\030\244\030" + 41 | "\244\030\244\030\244\030\244\030\244\030\244\030\244\030\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 42 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 43 | "\244\030\121\133\244\030\246\375\246\375\246\375\244\030\200\273\200\273\244\030\246\375\246\375\246\375\246\375" + 44 | "\246\375\244\030\244\030\244\030\246\375\241\364\241\364\246\375\246\375\244\030\000\000\000\000\244\030\051\146" + 45 | "\244\030\246\375\246\375\246\375\244\030\200\273\200\273\244\030\246\375\246\375\246\375\246\375\246\375\244\030" + 46 | "\244\030\244\030\246\375\241\364\241\364\246\375\246\375\244\030\000\000\000\000\000\000\000\000\000\000\000\000" + 47 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 48 | "\244\030\121\133\244\030\241\364\241\364\241\364\246\375\244\030\244\030\377\377\244\030\244\030\244\030\244\030" + 49 | "\244\030\133\306\133\306\377\377\244\030\200\273\200\273\244\030\244\030\244\030\244\030\000\000\244\030\355\207" + 50 | "\244\030\241\364\241\364\241\364\246\375\244\030\244\030\377\377\244\030\244\030\244\030\244\030\244\030\133\306" + 51 | "\133\306\377\377\244\030\200\273\200\273\244\030\244\030\244\030\244\030\000\000\000\000\000\000\000\000\000\000" + 52 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 53 | "\244\030\244\030\244\030\241\364\241\364\241\364\377\377\246\375\244\030\326\214\244\030\002\152\136\057\136\057" + 54 | "\002\152\244\030\133\306\133\306\133\306\244\030\244\030\377\377\377\377\377\377\377\377\244\030\244\030\244\030" + 55 | "\244\030\241\364\241\364\241\364\377\377\246\375\244\030\326\214\244\030\002\152\136\057\136\057\002\152\244\030" + 56 | "\133\306\133\306\133\306\244\030\244\030\377\377\377\377\377\377\377\377\244\030\000\000\000\000\000\000\000\000" + 57 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 58 | "\244\030\244\030\121\133\244\030\200\273\377\377\377\377\241\364\244\030\326\214\244\030\200\273\002\152\333\004" + 59 | "\002\152\244\030\326\214\133\306\326\214\244\030\121\133\133\306\133\306\133\306\133\306\244\030\244\030\244\030" + 60 | "\121\133\244\030\200\273\377\377\377\377\241\364\244\030\326\214\244\030\200\273\002\152\333\004\002\152\244\030" + 61 | "\326\214\133\306\326\214\244\030\121\133\133\306\133\306\133\306\133\306\244\030\000\000\000\000\000\000\000\000" + 62 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 63 | "\244\030\121\133\244\030\244\030\244\030\241\364\241\364\241\364\244\030\326\214\244\030\002\152\021\003\021\003" + 64 | "\002\152\244\030\326\214\326\214\326\214\244\030\244\030\244\030\121\133\121\133\244\030\000\000\244\030\355\207" + 65 | "\244\030\244\030\244\030\241\364\241\364\241\364\244\030\326\214\244\030\002\152\021\003\021\003\002\152\244\030" + 66 | "\326\214\326\214\326\214\244\030\244\030\244\030\121\133\121\133\244\030\000\000\000\000\000\000\000\000\000\000" + 67 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 68 | "\244\030\121\133\244\030\241\364\244\030\200\273\200\273\200\273\244\030\121\133\244\030\244\030\244\030\244\030" + 69 | "\244\030\121\133\121\133\121\133\244\030\241\364\246\375\244\030\244\030\244\030\000\000\000\000\244\030\051\146" + 70 | "\244\030\241\364\244\030\200\273\200\273\200\273\244\030\121\133\244\030\244\030\244\030\244\030\244\030\121\133" + 71 | "\121\133\121\133\244\030\241\364\246\375\244\030\244\030\244\030\000\000\000\000\000\000\000\000\000\000\000\000" + 72 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 73 | "\000\000\244\030\244\030\200\273\200\273\244\030\244\030\244\030\244\030\244\030\244\030\200\273\200\273\241\364" + 74 | "\246\375\244\030\244\030\244\030\200\273\200\273\200\273\200\273\244\030\000\000\000\000\000\000\000\000\244\030" + 75 | "\244\030\200\273\200\273\244\030\244\030\244\030\244\030\244\030\244\030\200\273\200\273\241\364\246\375\244\030" + 76 | "\244\030\244\030\200\273\200\273\200\273\200\273\244\030\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 77 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 78 | "\000\000\000\000\000\000\244\030\200\273\200\273\200\273\241\364\241\364\241\364\241\364\244\030\244\030\244\030" + 79 | "\244\030\244\030\244\030\244\030\244\030\244\030\244\030\244\030\000\000\000\000\000\000\000\000\000\000\000\000" + 80 | "\000\000\244\030\200\273\200\273\200\273\241\364\241\364\241\364\241\364\244\030\244\030\244\030\244\030\244\030" + 81 | "\244\030\244\030\244\030\244\030\244\030\244\030\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 82 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 83 | "\000\000\000\000\000\000\000\000\244\030\244\030\244\030\244\030\244\030\244\030\244\030\000\000\000\000\000\000" + 84 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 85 | "\000\000\000\000\244\030\244\030\244\030\244\030\244\030\244\030\244\030\000\000\000\000\000\000\000\000\000\000" + 86 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 87 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 88 | "\136\057\136\057\136\057\136\057\136\057\136\057\136\057\136\057\136\057\000\000\000\000\000\000\000\000\000\000" + 89 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 90 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 91 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 92 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 93 | "\000\000\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\136\057\000\000\000\000\000\000\000\000" + 94 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 95 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 96 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 97 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 98 | "\136\057\136\057\136\057\136\057\136\057\136\057\136\057\136\057\136\057\000\000\000\000\000\000\000\000\000\000" + 99 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 100 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 101 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 102 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 103 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 104 | "\000\000\244\030\244\030\244\030\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 105 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\244\030\244\030\244\030\000\000\000\000\000\000" + 106 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 107 | "\000\000\244\030\244\030\244\030\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 108 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\244\030" + 109 | "\244\030\022\174\356\122\120\143\244\030\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 110 | "\000\000\000\000\000\000\000\000\000\000\000\000\244\030\244\030\022\174\356\122\120\143\244\030\000\000\000\000" + 111 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\244\030" + 112 | "\244\030\022\174\356\122\120\143\244\030\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 113 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\244\030\244\030\244\030\244\030\365\234" + 114 | "\365\224\353\061\321\163\016\315\151\243\244\030\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 115 | "\000\000\000\000\244\030\244\030\244\030\244\030\365\234\365\224\353\061\321\163\016\315\151\243\244\030\000\000" + 116 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\244\030\244\030\244\030\244\030\365\234" + 117 | "\365\224\353\061\321\163\016\315\151\243\244\030\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 118 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\244\030\244\030\110\341\321\353\312\351\007\330\045\260" + 119 | "\211\111\014\062\013\072\061\214\247\344\012\132\244\030\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 120 | "\244\030\244\030\110\341\321\353\312\351\007\330\045\260\211\111\014\062\013\072\061\214\247\344\012\132\244\030" + 121 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\244\030\244\030\110\341\321\353\312\351\007\330\045\260" + 122 | "\211\111\014\062\013\072\061\214\247\344\012\132\244\030\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 123 | "\000\000\000\000\000\000\000\000\000\000\244\030\244\030\153\232\126\245\364\234\324\224\314\162\355\132\362\163" + 124 | "\215\112\054\072\255\122\214\112\260\163\211\111\147\151\000\000\000\000\000\000\000\000\000\000\244\030\244\030" + 125 | "\153\232\126\245\364\234\324\224\314\162\355\132\362\163\215\112\054\072\255\122\214\112\260\163\211\111\147\151" + 126 | "\000\000\000\000\000\000\000\000\000\000\244\030\244\030\153\232\126\245\364\234\324\224\314\162\355\132\362\163" + 127 | "\215\112\054\072\255\122\214\112\260\163\211\111\147\151\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 128 | "\000\000\244\030\244\030\244\030\244\030\122\214\163\214\163\214\163\214\066\235\365\234\365\234\122\214\122\214" + 129 | "\163\214\157\153\117\143\114\102\052\142\151\332\216\263\000\000\244\030\244\030\244\030\244\030\122\214\163\214" + 130 | "\163\214\163\214\066\235\365\234\365\234\122\214\122\214\163\214\157\153\117\143\114\102\052\142\151\332\216\263" + 131 | "\000\000\244\030\244\030\244\030\244\030\122\214\163\214\163\214\163\214\066\235\365\234\365\234\122\214\122\214" + 132 | "\163\214\157\153\117\143\114\102\052\142\151\332\216\263\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 133 | "\244\030\012\072\054\072\056\143\126\245\365\224\224\204\224\204\224\214\224\204\265\214\224\204\325\214\265\214" + 134 | "\224\204\022\164\151\051\110\041\046\131\107\171\147\171\244\030\012\072\054\072\056\143\126\245\365\224\224\204" + 135 | "\224\204\224\214\224\204\265\214\224\204\325\214\265\214\224\204\022\164\151\051\110\041\046\131\107\171\147\171" + 136 | "\244\030\012\072\054\072\056\143\126\245\365\224\224\204\224\204\224\214\224\204\265\214\224\204\325\214\265\214" + 137 | "\224\204\022\164\151\051\110\041\046\131\107\171\147\171\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 138 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\256\112\356\322\056\373\051\342\210\344\044\344" + 139 | "\351\323\044\334\243\302\307\251\256\112\356\122\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 140 | "\000\000\256\112\044\334\243\302\307\251\356\322\056\373\051\342\210\344\044\344\351\323\256\112\356\122\000\000" + 141 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\256\112\210\344\044\344\351\323\044\334\243\302" + 142 | "\307\251\356\322\056\373\051\342\256\112\356\122\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 143 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\256\112\316\322\056\373\051\342\150\344\004\344" + 144 | "\351\313\004\334\243\302\247\251\256\112\356\122\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 145 | "\000\000\256\112\004\334\243\302\247\251\316\322\056\373\051\342\150\344\004\344\351\313\256\112\356\122\000\000" + 146 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\256\112\150\344\004\344\351\313\004\334\243\302" + 147 | "\247\251\316\322\056\373\051\342\256\112\356\122\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 148 | "\244\030\012\072\054\072\056\143\126\245\026\235\264\214\264\214\265\214\264\214\325\214\264\214\365\224\325\214" + 149 | "\264\214\062\174\151\051\110\041\046\131\107\171\147\171\244\030\012\072\054\072\056\143\126\245\026\235\264\214" + 150 | "\264\214\265\214\264\214\325\214\264\214\365\224\325\214\264\214\062\174\151\051\110\041\046\131\107\171\147\171" + 151 | "\244\030\012\072\054\072\056\143\126\245\026\235\264\214\264\214\265\214\264\214\325\214\264\214\365\224\325\214" + 152 | "\264\214\062\174\151\051\110\041\046\131\107\171\147\171\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 153 | "\000\000\244\030\244\030\244\030\244\030\062\204\122\204\122\204\122\204\026\235\324\234\365\234\122\204\122\204" + 154 | "\122\204\117\143\117\143\114\112\052\132\151\332\216\263\000\000\244\030\244\030\244\030\244\030\062\204\122\204" + 155 | "\122\204\122\204\026\235\324\234\365\234\122\204\122\204\122\204\117\143\117\143\114\112\052\132\151\332\216\263" + 156 | "\000\000\244\030\244\030\244\030\244\030\062\204\122\204\122\204\122\204\026\235\324\234\365\234\122\204\122\204" + 157 | "\122\204\117\143\117\143\114\112\052\132\151\332\216\263\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 158 | "\000\000\000\000\000\000\000\000\000\000\244\030\244\030\213\232\126\245\364\234\264\224\254\162\315\132\362\163" + 159 | "\215\112\054\072\255\122\215\112\260\163\211\111\147\151\000\000\000\000\000\000\000\000\000\000\244\030\244\030" + 160 | "\213\232\126\245\364\234\264\224\254\162\315\132\362\163\215\112\054\072\255\122\215\112\260\163\211\111\147\151" + 161 | "\000\000\000\000\000\000\000\000\000\000\244\030\244\030\213\232\126\245\364\234\264\224\254\162\315\132\362\163" + 162 | "\215\112\054\072\255\122\215\112\260\163\211\111\147\151\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 163 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\244\030\244\030\111\341\361\353\312\351\007\330\045\250" + 164 | "\211\111\014\062\013\072\061\214\247\344\012\132\244\030\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 165 | "\244\030\244\030\111\341\361\353\312\351\007\330\045\250\211\111\014\062\013\072\061\214\247\344\012\132\244\030" + 166 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\244\030\244\030\111\341\361\353\312\351\007\330\045\250" + 167 | "\211\111\014\062\013\072\061\214\247\344\012\132\244\030\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 168 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\244\030\244\030\244\030\244\030\025\235" + 169 | "\026\235\353\061\321\163\016\305\152\243\244\030\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 170 | "\000\000\000\000\244\030\244\030\244\030\244\030\025\235\026\235\353\061\321\163\016\305\152\243\244\030\000\000" + 171 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\244\030\244\030\244\030\244\030\025\235" + 172 | "\026\235\353\061\321\163\016\305\152\243\244\030\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 173 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\244\030" + 174 | "\244\030\022\174\356\122\120\143\244\030\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 175 | "\000\000\000\000\000\000\000\000\000\000\000\000\244\030\244\030\022\174\356\122\120\143\244\030\000\000\000\000" + 176 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\244\030" + 177 | "\244\030\022\174\356\122\120\143\244\030\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 178 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 179 | "\000\000\244\030\244\030\244\030\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 180 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\244\030\244\030\244\030\000\000\000\000\000\000" + 181 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 182 | "\000\000\244\030\244\030\244\030\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 183 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 184 | "\000\000\305\373\305\373\305\373\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 185 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\305\373\305\373\305\373\000\000\000\000\000\000" + 186 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 187 | "\000\000\305\373\305\373\305\373\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 188 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\305\373" + 189 | "\305\373\305\373\305\373\305\373\305\373\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 190 | "\000\000\000\000\000\000\000\000\000\000\000\000\305\373\305\373\305\373\305\373\305\373\000\000\000\000\000\000" + 191 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\305\373" + 192 | "\000\000\000\000\000\000\305\373\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 193 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\305\373\305\373\305\373\305\373\305\373" + 194 | "\305\373\305\373\305\373\305\373\305\373\305\373\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 195 | "\000\000\000\000\000\000\000\000\305\373\305\373\305\373\305\373\246\372\305\373\305\373\305\373\305\373\000\000" + 196 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\305\373\305\373\305\373" + 197 | "\305\373\246\372\305\373\305\373\305\373\305\373\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 198 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\305\373\305\373\305\373\305\373\305\373\305\373\305\373" + 199 | "\305\373\305\373\305\373\305\373\305\373\305\373\305\373\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 200 | "\305\373\305\373\305\373\246\372\305\373\305\373\305\373\305\373\305\373\246\372\305\373\305\373\305\373\305\373" + 201 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\305\373\305\373\305\373\246\372\305\373\305\373\305\373" + 202 | "\305\373\305\373\246\372\305\373\305\373\305\373\305\373\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 203 | "\000\000\000\000\000\000\000\000\000\000\305\373\305\373\305\373\305\373\305\373\305\373\305\373\305\373\305\373" + 204 | "\305\373\305\373\305\373\305\373\305\373\305\373\305\373\000\000\000\000\000\000\000\000\000\000\305\373\305\373" + 205 | "\305\373\305\373\246\372\246\372\305\373\305\373\246\372\246\372\305\373\305\373\305\373\000\000\000\000\000\000" + 206 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\305\373\246\372" + 207 | "\246\372\305\373\305\373\305\373\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 208 | "\000\000\305\373\305\373\305\373\305\373\305\373\305\373\305\373\305\373\305\373\305\373\305\373\305\373\305\373" + 209 | "\305\373\305\373\305\373\305\373\305\373\305\373\305\373\000\000\305\373\305\373\305\373\305\373\305\373\246\372" + 210 | "\246\372\305\373\305\373\305\373\305\373\305\373\305\373\305\373\305\373\305\373\305\373\000\000\000\000\000\000" + 211 | "\000\000\305\373\305\373\305\373\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\305\373\305\373" + 212 | "\000\000\305\373\305\373\305\373\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 213 | "\305\373\305\373\305\373\305\373\305\373\305\373\305\373\305\373\305\373\305\373\305\373\305\373\305\373\305\373" + 214 | "\305\373\305\373\305\373\305\373\305\373\305\373\305\373\305\373\305\373\305\373\305\373\305\373\305\373\305\373" + 215 | "\305\373\305\373\305\373\305\373\305\373\246\372\305\373\305\373\305\373\246\372\305\373\305\373\305\373\305\373" + 216 | "\000\000\000\000\000\000\305\373\305\373\305\373\305\373\305\373\305\373\305\373\305\373\305\373\246\372\305\373" + 217 | "\305\373\305\373\246\372\305\373\305\373\305\373\305\373\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 218 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\256\112\356\322\056\373\051\342\210\344\044\344" + 219 | "\351\323\044\334\243\302\307\251\305\373\305\373\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 220 | "\000\000\305\373\305\373\246\372\305\373\305\373\305\373\305\373\246\372\305\373\305\373\305\373\305\373\000\000" + 221 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\305\373\305\373\246\372\305\373\305\373\305\373" + 222 | "\305\373\246\372\305\373\305\373\305\373\305\373\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 223 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\256\112\316\322\056\373\051\342\150\344\004\344" + 224 | "\351\313\004\334\243\302\247\251\305\373\305\373\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 225 | "\000\000\305\373\305\373\305\373\305\373\305\373\305\373\246\372\305\373\305\373\305\373\305\373\305\373\000\000" + 226 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\305\373\305\373\305\373\000\000\000\000\000\000" + 227 | "\246\372\305\373\305\373\305\373\305\373\305\373\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 228 | "\305\373\305\373\305\373\305\373\305\373\305\373\305\373\305\373\305\373\305\373\305\373\305\373\305\373\305\373" + 229 | "\305\373\305\373\305\373\305\373\305\373\305\373\305\373\305\373\305\373\305\373\305\373\305\373\305\373\305\373" + 230 | "\305\373\305\373\305\373\000\000\000\000\305\373\305\373\305\373\305\373\305\373\305\373\246\372\305\373\305\373" + 231 | "\000\000\000\000\000\000\000\000\000\000\305\373\305\373\305\373\305\373\305\373\305\373\000\000\000\000\000\000" + 232 | "\305\373\305\373\305\373\305\373\246\372\305\373\305\373\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 233 | "\000\000\305\373\305\373\305\373\305\373\305\373\305\373\305\373\305\373\305\373\305\373\305\373\305\373\305\373" + 234 | "\305\373\305\373\305\373\305\373\305\373\305\373\305\373\000\000\305\373\305\373\305\373\305\373\305\373\246\372" + 235 | "\246\372\305\373\305\373\305\373\246\372\246\372\305\373\246\372\305\373\305\373\305\373\305\373\305\373\305\373" + 236 | "\000\000\000\000\000\000\305\373\305\373\305\373\246\372\246\372\305\373\305\373\305\373\000\000\000\000\000\000" + 237 | "\246\372\305\373\305\373\305\373\305\373\305\373\305\373\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 238 | "\000\000\000\000\000\000\000\000\000\000\305\373\305\373\305\373\305\373\305\373\305\373\305\373\305\373\305\373" + 239 | "\305\373\305\373\305\373\305\373\305\373\305\373\305\373\000\000\000\000\000\000\000\000\000\000\246\372\246\372" + 240 | "\000\000\305\373\305\373\305\373\246\372\246\372\305\373\305\373\305\373\246\372\305\373\305\373\305\373\305\373" + 241 | "\000\000\000\000\000\000\000\000\000\000\246\372\246\372\000\000\305\373\305\373\305\373\246\372\000\000\000\000" + 242 | "\000\000\000\000\000\000\000\000\000\000\305\373\305\373\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 243 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\305\373\305\373\305\373\305\373\305\373\305\373\305\373" + 244 | "\305\373\305\373\305\373\305\373\305\373\305\373\305\373\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 245 | "\000\000\305\373\305\373\305\373\305\373\305\373\305\373\305\373\305\373\305\373\305\373\246\372\246\372\305\373" + 246 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\305\373\305\373\305\373\305\373\000\000\000\000" + 247 | "\000\000\000\000\000\000\000\000\000\000\246\372\305\373\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 248 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\305\373\305\373\305\373\305\373\305\373" + 249 | "\305\373\305\373\305\373\305\373\305\373\305\373\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 250 | "\000\000\000\000\305\373\246\372\305\373\305\373\305\373\246\372\305\373\305\373\305\373\246\372\305\373\000\000" + 251 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\305\373\246\372\305\373\000\000\000\000" + 252 | "\000\000\000\000\000\000\000\000\000\000\305\373\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 253 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\305\373" + 254 | "\305\373\305\373\305\373\305\373\305\373\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 255 | "\000\000\000\000\000\000\000\000\000\000\000\000\305\373\305\373\305\373\305\373\305\373\305\373\000\000\000\000" + 256 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\305\373" + 257 | "\305\373\305\373\305\373\305\373\305\373\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 258 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 259 | "\000\000\305\373\305\373\305\373\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 260 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\305\373\305\373\305\373\000\000\000\000\000\000" + 261 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 262 | "\000\000\305\373\305\373\305\373\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 263 | "\000\000\000\370\000\370\000\370\000\370\000\370\000\370\000\370\000\370\000\370\000\370\000\370\000\370\000\370" + 264 | "\000\370\000\370\000\370\000\370\000\370\000\370\000\370\000\370\000\370\000\370\000\370\000\370\000\370\000\370" + 265 | "\000\370\000\370\000\370\000\370\000\370\000\370\000\370\000\370\000\370\000\370\000\370\000\370\000\370\000\370" + 266 | "\000\370\000\370\000\000\000\000\312\126\312\126\312\126\312\126\312\126\312\126\312\126\312\126\312\126\312\126" + 267 | "\312\126\312\126\312\126\312\126\312\126\312\126\312\126\312\126\312\126\312\126\312\126\000\000\000\000\000\000" + 268 | "\000\370\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 269 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 270 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 271 | "\000\000\000\000\000\370\312\126\244\030\244\030\244\030\244\030\244\030\244\030\244\030\244\030\244\030\244\030" + 272 | "\244\030\244\030\244\030\244\030\244\030\244\030\244\030\244\030\244\030\244\030\244\030\312\126\000\000\000\000" + 273 | "\000\370\000\000\000\370\000\370\000\000\000\000\000\370\000\370\000\000\000\000\000\370\000\370\000\370\000\000" + 274 | "\000\370\000\370\000\370\000\000\000\370\000\370\000\370\000\000\000\000\000\000\000\370\000\370\000\370\000\000" + 275 | "\000\370\000\370\000\370\000\000\000\000\000\370\000\000\000\000\000\370\000\370\000\000\000\000\000\370\000\370" + 276 | "\000\370\000\000\000\370\312\126\244\030\312\126\312\126\244\030\244\030\244\030\312\126\244\030\244\030\312\126" + 277 | "\244\030\312\126\244\030\312\126\312\126\312\126\244\030\312\126\312\126\312\126\244\030\312\126\000\000\000\000" + 278 | "\000\370\000\000\000\370\000\000\000\370\000\000\000\370\000\000\000\370\000\000\000\370\000\000\000\000\000\000" + 279 | "\000\370\000\000\000\000\000\000\000\370\000\000\000\000\000\000\000\000\000\000\000\370\000\000\000\000\000\000" + 280 | "\000\000\000\370\000\000\000\000\000\370\000\000\000\370\000\000\000\370\000\000\000\370\000\000\000\000\000\370" + 281 | "\000\000\000\000\000\370\312\126\244\030\312\126\244\030\312\126\244\030\312\126\244\030\312\126\244\030\312\126" + 282 | "\244\030\312\126\244\030\312\126\244\030\244\030\244\030\312\126\244\030\244\030\244\030\312\126\000\000\000\000" + 283 | "\000\370\000\000\000\370\000\370\000\000\000\000\000\370\000\370\000\000\000\000\000\370\000\370\000\000\000\000" + 284 | "\000\370\000\370\000\370\000\000\000\370\000\370\000\370\000\000\000\000\000\000\000\370\000\370\000\370\000\000" + 285 | "\000\000\000\370\000\000\000\000\000\370\000\370\000\370\000\000\000\370\000\370\000\000\000\000\000\000\000\370" + 286 | "\000\000\000\000\000\370\312\126\244\030\312\126\312\126\244\030\244\030\312\126\312\126\312\126\244\030\312\126" + 287 | "\244\030\312\126\244\030\312\126\312\126\312\126\244\030\312\126\312\126\244\030\244\030\312\126\000\000\000\000" + 288 | "\000\370\000\000\000\370\000\000\000\000\000\000\000\370\000\000\000\370\000\000\000\370\000\000\000\000\000\000" + 289 | "\000\000\000\000\000\370\000\000\000\000\000\000\000\370\000\000\000\000\000\000\000\000\000\000\000\370\000\000" + 290 | "\000\000\000\370\000\000\000\000\000\370\000\000\000\370\000\000\000\370\000\000\000\370\000\000\000\000\000\370" + 291 | "\000\000\000\000\000\370\312\126\244\030\312\126\244\030\244\030\244\030\312\126\244\030\312\126\244\030\312\126" + 292 | "\244\030\312\126\244\030\244\030\244\030\312\126\244\030\312\126\244\030\244\030\244\030\312\126\000\000\000\000" + 293 | "\000\370\000\000\000\370\000\000\000\000\000\000\000\370\000\000\000\370\000\000\000\370\000\370\000\370\000\000" + 294 | "\000\370\000\370\000\370\000\000\000\370\000\370\000\370\000\000\000\000\000\000\000\370\000\370\000\370\000\000" + 295 | "\000\000\000\370\000\000\000\000\000\370\000\000\000\370\000\000\000\370\000\000\000\370\000\000\000\000\000\370" + 296 | "\000\000\000\000\000\370\312\126\244\030\312\126\244\030\244\030\244\030\312\126\244\030\312\126\244\030\312\126" + 297 | "\312\126\312\126\244\030\312\126\312\126\312\126\244\030\312\126\312\126\312\126\244\030\312\126\000\000\000\000" + 298 | "\000\370\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 299 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 300 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 301 | "\000\000\000\000\000\370\312\126\244\030\244\030\244\030\244\030\244\030\244\030\244\030\244\030\244\030\244\030" + 302 | "\244\030\244\030\244\030\244\030\244\030\244\030\244\030\244\030\244\030\244\030\244\030\312\126\000\000\000\000" + 303 | "\000\000\000\370\000\370\000\370\000\370\000\370\000\370\000\370\000\370\000\370\000\370\000\370\000\370\000\370" + 304 | "\000\370\000\370\000\370\000\370\000\370\000\370\000\370\000\370\000\370\000\370\000\370\000\370\000\370\000\370" + 305 | "\000\370\000\370\000\370\000\370\000\370\000\370\000\370\000\370\000\370\000\370\000\370\000\370\000\370\000\370" + 306 | "\000\370\000\370\000\000\000\000\312\126\312\126\312\126\312\126\312\126\312\126\312\126\312\126\312\126\312\126" + 307 | "\312\126\312\126\312\126\312\126\312\126\312\126\312\126\312\126\312\126\312\126\312\126\000\000\000\000\000\000" + 308 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\370\000\370\000\370\000\370" + 309 | "\000\370\000\370\000\370\000\370\000\370\000\370\000\320\000\320\000\370\000\370\000\000\000\000\000\000\000\000" + 310 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\370\000\370\000\370\000\000\000\370\000\000\000\370\000\370" + 311 | "\000\370\000\370\000\370\000\370\000\370\000\000\000\370\000\370\000\370\000\370\000\370\000\370\000\370\000\370" + 312 | "\000\370\000\370\000\370\000\370\000\370\000\370\000\370\000\370\000\000\000\000\000\000\000\000\000\000\000\000" + 313 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\370\000\370\000\370\000\370" + 314 | "\000\370\000\370\000\370\000\370\000\370\000\370\000\320\000\320\000\370\000\370\000\000\000\000\000\000\000\000" + 315 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\370\000\000\000\370\000\000\000\370\000\000\000\000\000\000" + 316 | "\000\370\000\000\000\000\000\370\000\370\000\000\000\370\000\370\000\000\000\000\000\370\000\000\000\000\000\000" + 317 | "\000\000\000\370\000\370\000\000\000\370\000\370\000\000\000\370\000\000\000\000\000\000\000\000\000\000\000\000" + 318 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\370\000\370\000\370\000\370\200\372\200\372" + 319 | "\000\370\000\370\000\370\000\370\000\320\000\320\000\320\000\320\000\320\000\320\000\370\000\370\000\000\000\000" + 320 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\370\000\000\000\370\000\000\000\370\000\000\000\000\000\370" + 321 | "\000\000\000\000\000\370\000\000\000\370\000\370\000\370\000\370\000\370\000\370\000\370\000\370\000\370\000\000" + 322 | "\000\000\000\370\000\370\000\370\000\370\000\370\000\370\000\370\000\000\000\000\000\000\000\000\000\000\000\000" + 323 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\370\000\370\000\370\000\370\200\372\200\372" + 324 | "\000\370\000\370\000\370\000\370\000\320\000\320\000\320\000\320\000\320\000\320\000\370\000\370\000\000\000\000" + 325 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\370\000\000\000\370\000\000\000\370\000\000\000\370\000\000" + 326 | "\000\000\000\000\000\000\000\370\000\000\000\000\000\370\000\000\000\000\000\370\000\370\000\000\000\370\000\000" + 327 | "\000\000\000\370\000\370\000\000\000\370\000\000\000\000\000\370\000\000\000\000\000\000\000\000\000\000\000\000" + 328 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\370\000\370\000\370\000\370\200\372\200\372\000\370\000\370" + 329 | "\000\370\000\370\000\370\000\370\000\370\000\370\000\370\000\370\000\320\000\320\000\320\000\320\000\250\000\250" + 330 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\370\000\370\000\370\000\000\000\370\000\000\000\370\000\370" + 331 | "\000\370\000\370\000\370\000\370\000\000\000\000\000\370\000\370\000\370\000\370\000\370\000\370\000\370\000\000" + 332 | "\000\000\000\370\000\370\000\370\000\370\000\370\000\370\000\370\000\000\000\000\000\000\000\000\000\000\000\000" + 333 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\370\000\370\000\370\000\370\200\372\200\372\000\370\000\370" + 334 | "\000\370\000\370\000\370\000\370\000\370\000\370\000\370\000\370\000\320\000\320\000\320\000\320\000\250\000\250" + 335 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 336 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 337 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\121\214\000\000\000\000\000\000\000\000" + 338 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\370\000\370\200\372\200\372\200\372\200\372\000\370\000\370" + 339 | "\000\370\000\370\000\370\000\370\000\370\000\370\000\370\000\370\000\370\000\370\000\320\000\320\000\250\000\250" + 340 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 341 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 342 | "\121\214\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\272\326\000\000\000\000\000\000\000\000" + 343 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\370\000\370\200\372\200\372\200\372\200\372\000\370\000\370" + 344 | "\000\370\000\370\000\370\000\370\000\370\000\370\000\370\000\370\000\370\000\370\000\320\000\320\000\250\000\250" + 345 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 346 | "\000\000\000\000\000\000\000\000\000\000\121\214\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 347 | "\272\326\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\074\347\000\000\000\000\000\000\000\000" + 348 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\220\000\220\000\370\000\370\000\320\000\320\000\000\000\000" + 349 | "\000\320\000\320\000\370\000\370\000\320\000\320\000\000\000\000\000\370\000\370\000\370\000\370\000\220\000\220" + 350 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\121\214\000\000\000\000\000\000" + 351 | "\000\000\000\000\000\000\000\000\000\000\272\326\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 352 | "\074\347\000\000\000\000\000\000\000\000\000\000\000\000\000\000\272\326\377\377\272\326\000\000\000\000\000\000" + 353 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\220\000\220\000\370\000\370\000\320\000\320\000\000\000\000" + 354 | "\000\320\000\320\000\370\000\370\000\320\000\320\000\000\000\000\000\370\000\370\000\370\000\370\000\220\000\220" + 355 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\121\214\377\377\121\214\000\000\000\000" + 356 | "\000\000\000\000\000\000\121\214\272\326\377\377\272\326\121\214\000\000\000\000\000\000\121\214\272\326\074\347" + 357 | "\377\377\074\347\272\326\121\214\000\000\121\214\272\326\074\347\377\377\377\377\377\377\074\347\272\326\121\214" + 358 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\220\000\220\000\370\000\370\000\000\000\000\000\000\000\000" + 359 | "\000\000\000\000\000\370\000\370\000\000\000\000\000\000\000\000\000\000\000\000\000\250\000\250\000\220\000\220" + 360 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\121\214\000\000\000\000\000\000" + 361 | "\000\000\000\000\000\000\000\000\000\000\272\326\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 362 | "\074\347\000\000\000\000\000\000\000\000\000\000\000\000\000\000\272\326\377\377\272\326\000\000\000\000\000\000" + 363 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\220\000\220\000\370\000\370\000\000\000\000\000\000\000\000" + 364 | "\000\000\000\000\000\370\000\370\000\000\000\000\000\000\000\000\000\000\000\000\000\250\000\250\000\220\000\220" + 365 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 366 | "\000\000\000\000\000\000\000\000\000\000\121\214\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 367 | "\272\326\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\074\347\000\000\000\000\000\000\000\000" + 368 | "\000\000\000\000\000\370\000\370\000\000\000\000\000\250\000\250\000\370\000\370\000\000\000\000\000\000\000\000" + 369 | "\000\250\000\250\000\370\000\370\000\370\000\370\000\000\000\000\000\000\000\000\000\250\000\250\000\250\000\250" + 370 | "\000\000\000\000\000\370\000\370\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 371 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 372 | "\121\214\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\272\326\000\000\000\000\000\000\000\000" + 373 | "\000\000\000\000\000\370\000\370\000\000\000\000\000\250\000\250\000\370\000\370\000\000\000\000\000\000\000\000" + 374 | "\000\250\000\250\000\370\000\370\000\370\000\370\000\000\000\000\000\000\000\000\000\250\000\250\000\250\000\250" + 375 | "\000\000\000\000\000\370\000\370\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 376 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 377 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\121\214\000\000\000\000\000\000\000\000" + 378 | "\000\370\000\370\000\370\000\370\000\000\000\000\000\000\000\000\000\370\000\370\000\370\000\370\000\250\000\250" + 379 | "\000\370\000\370\000\000\000\000\000\320\000\320\000\250\000\250\000\250\000\250\000\250\000\250\000\000\000\000" + 380 | "\000\000\000\000\000\320\000\320\000\250\000\250\000\000\000\000\000\000\000\000\000\000\354\346\000\000\000\000" + 381 | "\000\000\150\326\150\326\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 382 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 383 | "\000\370\000\370\000\370\000\370\000\000\000\000\000\000\000\000\000\370\000\370\000\370\000\370\000\250\000\250" + 384 | "\000\370\000\370\000\000\000\000\000\320\000\320\000\250\000\250\000\250\000\250\000\250\000\250\000\000\000\000" + 385 | "\000\000\000\000\000\320\000\320\000\250\000\250\000\000\366\377\000\000\000\000\354\346\370\377\354\346\000\000" + 386 | "\150\326\366\377\366\377\150\326\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 387 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 388 | "\000\000\000\000\000\000\000\000\000\370\000\370\000\000\000\000\000\000\000\000\000\000\000\000\000\320\000\320" + 389 | "\000\320\000\320\000\320\000\320\000\320\000\320\000\320\000\320\000\000\000\000\000\000\000\000\000\000\000\000" + 390 | "\000\320\000\320\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\354\346\000\000\000\000" + 391 | "\150\326\366\377\366\377\150\326\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 392 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 393 | "\000\000\000\000\000\000\000\000\000\370\000\370\000\000\000\000\000\000\000\000\000\000\000\000\000\320\000\320" + 394 | "\000\320\000\320\000\320\000\320\000\320\000\320\000\320\000\320\000\000\000\000\000\000\000\000\000\000\000\000" + 395 | "\000\320\000\320\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 396 | "\000\000\150\326\150\326\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 397 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 398 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\200\372\200\372" + 399 | "\000\000\000\000\200\372\200\372\000\000\000\000\200\372\200\372\000\000\000\000\000\000\000\000\000\000\000\000" + 400 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 401 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 402 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 403 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\200\372\200\372" + 404 | "\000\000\000\000\200\372\200\372\000\000\000\000\200\372\200\372\000\000\000\000\000\000\000\000\000\000\000\000" + 405 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 406 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 407 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 408 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 409 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 410 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 411 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 412 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 413 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 414 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 415 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 416 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 417 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 418 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\200\372\200\372\000\000\000\000" + 419 | "\200\372\200\372\000\000\000\000\200\372\200\372\000\000\000\000\200\372\200\372\000\000\000\000\000\000\000\000" + 420 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 421 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 422 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 423 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\200\372\200\372\000\000\000\000" + 424 | "\200\372\200\372\000\000\000\000\200\372\200\372\000\000\000\000\200\372\200\372\000\000\000\000\000\000\000\000" + 425 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 426 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 427 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 428 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\320\000\320\000\320\000\320" + 429 | "\000\370\000\370\000\370\000\370\000\370\000\370\000\250\000\250\000\250\000\250\000\000\000\000\000\000\000\000" + 430 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 431 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 432 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 433 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\320\000\320\000\320\000\320" + 434 | "\000\370\000\370\000\370\000\370\000\370\000\370\000\250\000\250\000\250\000\250\000\000\000\000\000\000\000\000" + 435 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 436 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 437 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 438 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\320\000\320\000\000\000\000\000\000\000\000\000\320\000\320" + 439 | "\000\370\000\370\000\370\000\370\000\250\000\250\000\250\000\250\000\000\000\000\000\000\000\000\000\320\000\320" + 440 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 441 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 442 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 443 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\320\000\320\000\000\000\000\000\000\000\000\000\320\000\320" + 444 | "\000\370\000\370\000\370\000\370\000\250\000\250\000\250\000\250\000\000\000\000\000\000\000\000\000\320\000\320" + 445 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 446 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 447 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 448 | "\000\000\000\000\000\370\000\370\000\320\000\320\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 449 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 450 | "\000\320\000\320\000\250\000\250\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 451 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 452 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 453 | "\000\000\000\000\000\370\000\370\000\320\000\320\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 454 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 455 | "\000\320\000\320\000\250\000\250\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 456 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 457 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 458 | "\000\000\000\000\000\000\000\000\000\250\000\250\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 459 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 460 | "\000\250\000\250\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 461 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 462 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 463 | "\000\000\000\000\000\000\000\000\000\250\000\250\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 464 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 465 | "\000\250\000\250\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 466 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 467 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 468 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\151\112\151\112\151\112\151\112" + 469 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\151\112\151\112\151\112" + 470 | "\151\112\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\151\112\151\112" + 471 | "\151\112\151\112\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 472 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 473 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\151\112\024\245\024\245\024\245\151\112" + 474 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\151\112\024\245\024\245\024\245" + 475 | "\151\112\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\151\112\024\245\024\245" + 476 | "\024\245\151\112\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 477 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 478 | "\000\000\000\000\000\000\151\112\151\112\151\112\000\000\000\000\317\255\317\255\161\306\161\306\266\357\000\000" + 479 | "\000\000\000\000\000\000\000\000\151\112\151\112\151\112\000\000\000\000\266\357\266\357\317\255\317\255\161\306" + 480 | "\000\000\000\000\000\000\000\000\000\000\151\112\151\112\151\112\000\000\000\000\161\306\161\306\266\357\266\357" + 481 | "\317\255\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 482 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 483 | "\000\000\000\000\151\112\024\245\024\245\151\112\000\000\151\112\024\245\024\245\024\245\024\245\151\112\000\000" + 484 | "\000\000\000\000\000\000\151\112\024\245\024\245\151\112\000\000\151\112\024\245\024\245\024\245\024\245\151\112" + 485 | "\000\000\000\000\000\000\000\000\151\112\024\245\024\245\151\112\000\000\151\112\024\245\024\245\024\245\024\245" + 486 | "\151\112\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 487 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 488 | "\000\000\151\112\024\245\321\032\024\245\151\112\151\112\151\112\151\112\151\112\151\112\151\112\151\112\151\112" + 489 | "\151\112\000\000\151\112\024\245\321\032\024\245\151\112\151\112\151\112\151\112\151\112\151\112\151\112\151\112" + 490 | "\151\112\151\112\000\000\151\112\024\245\321\032\024\245\151\112\151\112\151\112\151\112\151\112\151\112\151\112" + 491 | "\151\112\151\112\151\112\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 492 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 493 | "\151\112\024\245\321\032\321\032\024\245\024\245\070\306\070\306\070\306\070\306\024\245\024\245\024\245\151\112" + 494 | "\051\146\151\112\024\245\321\032\321\032\024\245\024\245\070\306\070\306\070\306\070\306\024\245\024\245\024\245" + 495 | "\151\112\355\207\151\112\024\245\321\032\321\032\024\245\024\245\070\306\070\306\070\306\070\306\024\245\024\245" + 496 | "\024\245\151\112\051\146\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 497 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 498 | "\151\112\070\306\336\113\336\113\024\245\024\245\070\306\070\306\070\306\070\306\024\245\024\245\024\245\151\112" + 499 | "\051\146\151\112\070\306\336\113\336\113\024\245\024\245\070\306\070\306\070\306\070\306\024\245\024\245\024\245" + 500 | "\151\112\051\146\151\112\070\306\336\113\336\113\024\245\024\245\070\306\070\306\070\306\070\306\024\245\024\245" + 501 | "\024\245\151\112\355\207\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 502 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 503 | "\000\000\151\112\070\306\336\113\024\245\151\112\151\112\151\112\151\112\151\112\151\112\151\112\151\112\151\112" + 504 | "\151\112\000\000\151\112\070\306\336\113\024\245\151\112\151\112\151\112\151\112\151\112\151\112\151\112\151\112" + 505 | "\151\112\151\112\000\000\151\112\070\306\336\113\024\245\151\112\151\112\151\112\151\112\151\112\151\112\151\112" + 506 | "\151\112\151\112\151\112\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 507 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 508 | "\000\000\000\000\151\112\070\306\024\245\151\112\000\000\151\112\024\245\024\245\024\245\024\245\151\112\000\000" + 509 | "\000\000\000\000\000\000\151\112\070\306\024\245\151\112\000\000\151\112\024\245\024\245\024\245\024\245\151\112" + 510 | "\000\000\000\000\000\000\000\000\151\112\070\306\024\245\151\112\000\000\151\112\024\245\024\245\024\245\024\245" + 511 | "\151\112\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 512 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 513 | "\000\000\000\000\000\000\151\112\151\112\151\112\000\000\000\000\317\255\317\255\161\306\161\306\266\357\000\000" + 514 | "\000\000\000\000\000\000\000\000\151\112\151\112\151\112\000\000\000\000\266\357\266\357\317\255\317\255\161\306" + 515 | "\000\000\000\000\000\000\000\000\000\000\151\112\151\112\151\112\000\000\000\000\161\306\161\306\266\357\266\357" + 516 | "\317\255\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 517 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 518 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\151\112\024\245\024\245\024\245\151\112" + 519 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\151\112\024\245\024\245\024\245" + 520 | "\151\112\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\151\112\024\245\024\245" + 521 | "\024\245\151\112\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 522 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 523 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\151\112\151\112\151\112\151\112" + 524 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\151\112\151\112\151\112" + 525 | "\151\112\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\151\112\151\112" + 526 | "\151\112\151\112\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 527 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 528 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\305\373\305\373\305\373\305\373" + 529 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\305\373\305\373\305\373" + 530 | "\305\373\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\305\373\000\000" + 531 | "\305\373\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 532 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 533 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\305\373\305\373\305\373\305\373\305\373" + 534 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\305\373\305\373\305\373\305\373" + 535 | "\305\373\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\305\373\305\373\305\373" + 536 | "\000\000\305\373\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 537 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 538 | "\000\000\000\000\000\000\305\373\305\373\305\373\000\000\000\000\305\373\305\373\305\373\305\373\305\373\000\000" + 539 | "\000\000\000\000\000\000\000\000\305\373\305\373\305\373\000\000\000\000\305\373\305\373\000\000\305\373\305\373" + 540 | "\000\000\000\000\000\000\000\000\000\000\305\373\305\373\305\373\000\000\000\000\305\373\000\000\000\000\305\373" + 541 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 542 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 543 | "\000\000\000\000\305\373\305\373\305\373\305\373\000\000\305\373\305\373\305\373\305\373\305\373\305\373\000\000" + 544 | "\000\000\000\000\000\000\305\373\305\373\305\373\305\373\000\000\305\373\305\373\246\372\000\000\305\373\305\373" + 545 | "\000\000\000\000\000\000\000\000\000\000\305\373\000\000\000\000\000\000\305\373\305\373\246\372\000\000\000\000" + 546 | "\305\373\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 547 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 548 | "\000\000\305\373\305\373\305\373\305\373\305\373\305\373\305\373\305\373\305\373\305\373\305\373\305\373\305\373" + 549 | "\305\373\000\000\305\373\305\373\305\373\305\373\305\373\305\373\305\373\305\373\305\373\000\000\305\373\246\372" + 550 | "\305\373\305\373\000\000\000\000\305\373\000\000\000\000\305\373\305\373\305\373\305\373\305\373\000\000\000\000" + 551 | "\000\000\000\000\305\373\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 552 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 553 | "\305\373\305\373\305\373\305\373\305\373\305\373\305\373\305\373\305\373\305\373\305\373\305\373\305\373\305\373" + 554 | "\305\373\305\373\305\373\305\373\305\373\000\000\000\000\305\373\000\000\305\373\305\373\305\373\305\373\246\372" + 555 | "\305\373\305\373\305\373\305\373\000\000\000\000\000\000\000\000\305\373\000\000\000\000\000\000\000\000\000\000" + 556 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 557 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 558 | "\305\373\305\373\305\373\305\373\305\373\305\373\305\373\305\373\305\373\305\373\305\373\305\373\305\373\305\373" + 559 | "\305\373\305\373\246\372\246\372\305\373\305\373\246\372\305\373\305\373\305\373\305\373\305\373\305\373\246\372" + 560 | "\305\373\305\373\305\373\246\372\246\372\305\373\305\373\246\372\305\373\000\000\000\000\000\000\000\000\000\000" + 561 | "\000\000\000\000\305\373\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 562 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 563 | "\000\000\305\373\305\373\305\373\305\373\305\373\305\373\305\373\305\373\305\373\305\373\305\373\305\373\305\373" + 564 | "\305\373\000\000\305\373\000\000\000\000\305\373\305\373\305\373\305\373\305\373\305\373\000\000\000\000\000\000" + 565 | "\305\373\305\373\000\000\305\373\000\000\000\000\305\373\000\000\305\373\305\373\305\373\305\373\000\000\000\000" + 566 | "\000\000\305\373\305\373\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 567 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 568 | "\000\000\000\000\305\373\305\373\305\373\305\373\000\000\305\373\305\373\305\373\305\373\305\373\305\373\000\000" + 569 | "\000\000\000\000\000\000\305\373\305\373\246\372\305\373\000\000\305\373\305\373\305\373\305\373\305\373\305\373" + 570 | "\000\000\000\000\000\000\000\000\305\373\305\373\246\372\305\373\000\000\305\373\305\373\000\000\305\373\305\373" + 571 | "\305\373\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 572 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 573 | "\000\000\000\000\000\000\305\373\305\373\305\373\000\000\000\000\305\373\305\373\305\373\305\373\305\373\000\000" + 574 | "\000\000\000\000\000\000\000\000\305\373\305\373\305\373\000\000\000\000\305\373\305\373\000\000\000\000\305\373" + 575 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\305\373\000\000\000\000\000\000" + 576 | "\305\373\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 577 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 578 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\305\373\305\373\305\373\305\373\305\373" + 579 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\305\373\305\373\000\000\305\373" + 580 | "\305\373\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\305\373\000\000\000\000" + 581 | "\000\000\305\373\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 582 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 583 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\305\373\305\373\305\373\305\373" + 584 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\305\373\246\372\305\373" + 585 | "\246\372\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\305\373\000\000" + 586 | "\000\000\246\372\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" + 587 | "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"), 588 | } 589 | -------------------------------------------------------------------------------- /internal/imgdata/sprite.go: -------------------------------------------------------------------------------- 1 | package imgdata 2 | 3 | import "github.com/jypelle/xship/internal/img" 4 | 5 | var XshipSprite = img.Sprite{ 6 | ImageAsset: img.ImageAsset{ 7 | Asset: &asset1, 8 | Offset: []img.Position{ 9 | { 10 | X: 0, 11 | Y: 0, 12 | }, 13 | { 14 | X: 26, 15 | Y: 0, 16 | }, 17 | }, 18 | Width: 26, 19 | Height: 16, 20 | }, 21 | HitBox: img.HitBox{ 22 | Offset: img.Position{ 23 | X: 1, 24 | Y: 3, 25 | }, 26 | Width: 23, 27 | Height: 12, 28 | }, 29 | } 30 | 31 | var MissileSprite = img.Sprite{ 32 | ImageAsset: img.ImageAsset{ 33 | Asset: &asset1, 34 | Offset: []img.Position{{ 35 | X: 0, 36 | Y: 16, 37 | }}, 38 | Width: 10, 39 | Height: 3, 40 | }, 41 | HitBox: img.HitBox{ 42 | Offset: img.Position{ 43 | X: 1, 44 | Y: 0, 45 | }, 46 | Width: 8, 47 | Height: 3, 48 | }, 49 | } 50 | 51 | var BadGuy1Sprite = img.Sprite{ 52 | ImageAsset: img.ImageAsset{ 53 | Asset: &asset1, 54 | Offset: []img.Position{ 55 | { 56 | X: 0, 57 | Y: 19, 58 | }, 59 | { 60 | X: 21, 61 | Y: 19, 62 | }, 63 | { 64 | X: 42, 65 | Y: 19, 66 | }, 67 | }, 68 | Width: 21, 69 | Height: 16, 70 | }, 71 | HitBox: img.HitBox{ 72 | Offset: img.Position{ 73 | X: 4, 74 | Y: 2, 75 | }, 76 | Width: 16, 77 | Height: 12, 78 | }, 79 | } 80 | 81 | var ExplodedBadGuy1Sprite = img.Sprite{ 82 | ImageAsset: img.ImageAsset{ 83 | Asset: &asset1, 84 | Offset: []img.Position{ 85 | { 86 | X: 0, 87 | Y: 35, 88 | }, 89 | { 90 | X: 21, 91 | Y: 35, 92 | }, 93 | { 94 | X: 42, 95 | Y: 35, 96 | }, 97 | }, 98 | Width: 21, 99 | Height: 16, 100 | }, 101 | } 102 | 103 | var BadGuy2Sprite = img.Sprite{ 104 | ImageAsset: img.ImageAsset{ 105 | Asset: &asset1, 106 | Offset: []img.Position{ 107 | { 108 | X: 0, 109 | Y: 92, 110 | }, 111 | { 112 | X: 15, 113 | Y: 92, 114 | }, 115 | { 116 | X: 30, 117 | Y: 92, 118 | }, 119 | }, 120 | Width: 15, 121 | Height: 12, 122 | }, 123 | HitBox: img.HitBox{ 124 | Offset: img.Position{ 125 | X: 2, 126 | Y: 1, 127 | }, 128 | Width: 12, 129 | Height: 10, 130 | }, 131 | } 132 | 133 | var ExplodedBadGuy2Sprite = img.Sprite{ 134 | ImageAsset: img.ImageAsset{ 135 | Asset: &asset1, 136 | Offset: []img.Position{ 137 | { 138 | X: 0, 139 | Y: 104, 140 | }, 141 | { 142 | X: 15, 143 | Y: 104, 144 | }, 145 | { 146 | X: 30, 147 | Y: 104, 148 | }, 149 | }, 150 | Width: 15, 151 | Height: 12, 152 | }, 153 | } 154 | 155 | var BadMissileSprite = img.Sprite{ 156 | ImageAsset: img.ImageAsset{ 157 | Asset: &asset1, 158 | Offset: []img.Position{ 159 | { 160 | X: 34, 161 | Y: 74, 162 | }, 163 | { 164 | X: 38, 165 | Y: 74, 166 | }, 167 | { 168 | X: 42, 169 | Y: 74, 170 | }, 171 | }, 172 | Width: 4, 173 | Height: 4, 174 | }, 175 | HitBox: img.HitBox{ 176 | Offset: img.Position{ 177 | X: 1, 178 | Y: 1, 179 | }, 180 | Width: 2, 181 | Height: 2, 182 | }, 183 | } 184 | 185 | var PressStartSprite = img.Sprite{ 186 | ImageAsset: img.ImageAsset{ 187 | Asset: &asset1, 188 | Offset: []img.Position{ 189 | { 190 | X: 0, 191 | Y: 51, 192 | }, 193 | }, 194 | Width: 45, 195 | Height: 9, 196 | }, 197 | } 198 | 199 | var SkullSprite = img.Sprite{ 200 | ImageAsset: img.ImageAsset{ 201 | Asset: &asset1, 202 | Offset: []img.Position{ 203 | { 204 | X: 0, 205 | Y: 60, 206 | }, 207 | }, 208 | Width: 34, 209 | Height: 32, 210 | }, 211 | } 212 | 213 | var NumberSprite = img.Sprite{ 214 | ImageAsset: img.ImageAsset{ 215 | Asset: &asset1, 216 | Offset: []img.Position{ 217 | { 218 | X: 34, 219 | Y: 60, 220 | }, 221 | { 222 | X: 37, 223 | Y: 60, 224 | }, 225 | { 226 | X: 40, 227 | Y: 60, 228 | }, 229 | { 230 | X: 43, 231 | Y: 60, 232 | }, 233 | { 234 | X: 46, 235 | Y: 60, 236 | }, 237 | { 238 | X: 49, 239 | Y: 60, 240 | }, 241 | { 242 | X: 52, 243 | Y: 60, 244 | }, 245 | { 246 | X: 55, 247 | Y: 60, 248 | }, 249 | { 250 | X: 58, 251 | Y: 60, 252 | }, 253 | { 254 | X: 61, 255 | Y: 60, 256 | }, 257 | }, 258 | Width: 3, 259 | Height: 5, 260 | }, 261 | } 262 | 263 | var GlowingWhiteStarSprite = img.Sprite{ 264 | ImageAsset: img.ImageAsset{ 265 | Asset: &asset1, 266 | Offset: []img.Position{ 267 | { 268 | X: 34, 269 | Y: 65, 270 | }, 271 | { 272 | X: 43, 273 | Y: 65, 274 | }, 275 | { 276 | X: 52, 277 | Y: 65, 278 | }, 279 | { 280 | X: 61, 281 | Y: 65, 282 | }, 283 | { 284 | X: 61, 285 | Y: 65, 286 | }, 287 | { 288 | X: 52, 289 | Y: 65, 290 | }, 291 | { 292 | X: 43, 293 | Y: 65, 294 | }, 295 | { 296 | X: 34, 297 | Y: 65, 298 | }, 299 | }, 300 | Width: 9, 301 | Height: 9, 302 | }, 303 | } 304 | 305 | var PauseSprite = img.Sprite{ 306 | ImageAsset: img.ImageAsset{ 307 | Asset: &asset1, 308 | Offset: []img.Position{ 309 | { 310 | X: 45, 311 | Y: 51, 312 | }, 313 | }, 314 | Width: 23, 315 | Height: 9, 316 | }, 317 | } 318 | -------------------------------------------------------------------------------- /internal/intro_stage.go: -------------------------------------------------------------------------------- 1 | package internal 2 | 3 | import ( 4 | "math" 5 | 6 | "github.com/jypelle/xship/internal/device" 7 | "github.com/jypelle/xship/internal/entity/xship" 8 | ) 9 | 10 | func IntroStageReset() { 11 | starsEntity.Reset() 12 | xshipEntity = xship.NewEntity() 13 | } 14 | 15 | func IntroStageUpdate() { 16 | // Increase background stars intensity 17 | starsEntity.AddIntensity(1.0 / 60.0) 18 | 19 | // Move background stars 20 | starsEntity.Move() 21 | 22 | // Move ship 23 | xshipEntity.IntroMove() 24 | if xshipEntity.Position().X >= 60 { 25 | nextGameStage = PlayStage 26 | } 27 | 28 | // Increase health point 29 | xshipEntity.SetHealthPoint(int(math.Round(5.0 * starsEntity.Intensity()))) 30 | 31 | // Update ship 32 | xshipEntity.IntroUpdate() 33 | } 34 | 35 | func IntroStageDraw() { 36 | // Refresh Leds 37 | for i := range neoLeds { 38 | if i < xshipEntity.HealthPoint() { 39 | neoLeds[i] = hpColors[i] 40 | } else { 41 | neoLeds[i] = blackColor 42 | } 43 | } 44 | device.NeoDevice.WriteColors(neoLeds[:]) 45 | 46 | // Draw stars 47 | starsEntity.Draw() 48 | 49 | // Draw x-ship 50 | xshipEntity.Draw() 51 | } 52 | -------------------------------------------------------------------------------- /internal/loose_stage.go: -------------------------------------------------------------------------------- 1 | package internal 2 | 3 | import ( 4 | "github.com/jypelle/xship/internal/device" 5 | "github.com/jypelle/xship/internal/img" 6 | "github.com/jypelle/xship/internal/imgdata" 7 | "tinygo.org/x/drivers/buzzer" 8 | ) 9 | 10 | var looseStageTick int 11 | var skullStatus SkullStatus 12 | var looseSong = []float64{ 13 | buzzer.C5, 14 | buzzer.B4, 15 | buzzer.A4, 16 | buzzer.G4, 17 | buzzer.F4, 18 | } 19 | 20 | type SkullStatus struct { 21 | TickSinceLastRebound int 22 | V0 float32 23 | } 24 | 25 | func LooseStageReset() { 26 | looseStageTick = 0 27 | skullStatus = SkullStatus{TickSinceLastRebound: 27, V0: -210} 28 | } 29 | 30 | func LooseStageUpdate() { 31 | if looseStageTick%6 == 0 && looseStageTick/6 < len(looseSong) { 32 | device.SoundDevice.Tone(looseSong[looseStageTick/6], 0.012) 33 | } 34 | 35 | // Update background stars 36 | starsEntity.Move() 37 | 38 | // Buttons actions 39 | if device.ButtonsDevice.IsButtonStartPressed() { 40 | nextGameStage = IntroStage 41 | } 42 | 43 | looseStageTick++ 44 | } 45 | 46 | func LooseStageDraw() { 47 | // Draw stars 48 | starsEntity.Draw() 49 | 50 | // Draw game over skull 51 | skullStatus.TickSinceLastRebound++ 52 | t := float32(skullStatus.TickSinceLastRebound) * .032 53 | y := 56 + int32(skullStatus.V0*t+120.0*t*t) 54 | if y > 56 { 55 | skullStatus.TickSinceLastRebound = 0 56 | skullStatus.V0 = -160 57 | } 58 | device.TftDevice.DrawImageFromAsset(imgdata.SkullSprite.ImageAsset, img.Position{X: 64, Y: y}, 0) 59 | 60 | // Draw press start 61 | if looseStageTick%16 < 8 { 62 | device.TftDevice.DrawImageFromAsset(imgdata.PressStartSprite.ImageAsset, img.Position{X: 58, Y: 100}, 0) 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /internal/play_stage.go: -------------------------------------------------------------------------------- 1 | package internal 2 | 3 | import ( 4 | "math/rand" 5 | 6 | "github.com/jypelle/xship/internal/constant" 7 | "github.com/jypelle/xship/internal/device" 8 | "github.com/jypelle/xship/internal/entity/badguy" 9 | "github.com/jypelle/xship/internal/entity/missile" 10 | "github.com/jypelle/xship/internal/img" 11 | "github.com/jypelle/xship/internal/imgdata" 12 | ) 13 | 14 | var missileEntities = make([]*missile.Entity, constant.MISSILE_ENTITY_MAX) 15 | var missilesIdx int 16 | var badGuyEntities = make([]badguy.Entity, 0, constant.BAD_GUY_ENTITY_MAX) 17 | var playStagePause bool 18 | 19 | func PlayStageReset() { 20 | 21 | playStagePause = false 22 | 23 | // Reset score 24 | score = 0 25 | 26 | // Clean bad guys 27 | badGuyEntities = nil 28 | 29 | // Clean missiles 30 | missilesIdx = 0 31 | for id := range missileEntities { 32 | missileEntities[id] = nil 33 | } 34 | } 35 | 36 | func PlayStageUpdate() { 37 | 38 | if playStagePause { 39 | if device.ButtonsDevice.IsButtonStartPressed() { 40 | playStagePause = false 41 | } 42 | } else { 43 | // Move background stars 44 | starsEntity.Move() 45 | 46 | // Move badguys 47 | for _, badGuyEntity := range badGuyEntities { 48 | if badGuyEntity != nil { 49 | badGuyEntity.Move() 50 | } 51 | } 52 | 53 | // Buttons actions 54 | if device.ButtonsDevice.IsButtonSelectPressed() { 55 | nextGameStage = IntroStage 56 | } 57 | if device.ButtonsDevice.IsButtonStartPressed() { 58 | playStagePause = true 59 | } 60 | 61 | // Move ship 62 | xshipEntity.Move() 63 | 64 | // Move active missileEntities 65 | for _, missileEntity := range missileEntities { 66 | if missileEntity != nil { 67 | missileEntity.Move() 68 | } 69 | } 70 | 71 | // Update ship 72 | xshipEntity.Update(&missilesIdx, missileEntities) 73 | if xshipEntity.HealthPoint() <= 0 { 74 | nextGameStage = LooseStage 75 | } 76 | 77 | // Update missiles 78 | for id := range missileEntities { 79 | if missileEntities[id] != nil { 80 | if missileEntities[id].X > constant.BOARD_WIDTH { 81 | missileEntities[id] = nil 82 | } 83 | } 84 | } 85 | 86 | // Update badguys 87 | newId := 0 88 | var newBadGuys []badguy.Entity 89 | for id, badGuyEntity := range badGuyEntities { 90 | newBadGuys = append(newBadGuys, badGuyEntity.Update(xshipEntity, missileEntities, &score)...) 91 | // Remove disabled badGuy 92 | if badGuyEntity.State() == badguy.BadGuyDisabledState { 93 | badGuyEntities[id] = nil 94 | } else { 95 | badGuyEntities[newId] = badGuyEntity 96 | newId++ 97 | } 98 | } 99 | badGuyEntities = badGuyEntities[:newId] 100 | badGuyEntities = append(badGuyEntities, newBadGuys...) 101 | 102 | // Generate new bad guy 103 | if rand.Intn(30) == 0 { 104 | badGuyEntities = append(badGuyEntities, badguy.NewEntity1(img.Position{ 105 | X: constant.BOARD_WIDTH, 106 | Y: rand.Int31n(constant.BOARD_HEIGHT - imgdata.BadGuy1Sprite.Height), 107 | })) 108 | } 109 | if rand.Intn(140) == 0 { 110 | badGuyEntities = append(badGuyEntities, badguy.NewEntity2(img.Position{ 111 | X: constant.BOARD_WIDTH, 112 | Y: rand.Int31n(constant.BOARD_HEIGHT - imgdata.BadGuy2Sprite.Height), 113 | })) 114 | } 115 | 116 | } 117 | } 118 | 119 | func PlayStageDraw() { 120 | 121 | // Refresh health bar 122 | for i := range neoLeds { 123 | if i < xshipEntity.HealthPoint() { 124 | neoLeds[i] = hpColors[i] 125 | } else { 126 | neoLeds[i] = blackColor 127 | } 128 | } 129 | device.NeoDevice.WriteColors(neoLeds[:]) 130 | 131 | // Draw stars 132 | starsEntity.Draw() 133 | 134 | // Draw missiles 135 | for _, missile := range missileEntities { 136 | if missile != nil { 137 | missile.Draw() 138 | } 139 | } 140 | 141 | // Draw x-ship 142 | xshipEntity.Draw() 143 | 144 | // Draw bad guys 145 | for _, badGuy := range badGuyEntities { 146 | if badGuy != nil { 147 | badGuy.Draw() 148 | } 149 | } 150 | 151 | // Draw score 152 | device.TftDevice.DrawImageFromAsset(imgdata.NumberSprite.ImageAsset, img.Position{X: device.TftDevice.Width() - 3}, score%10) 153 | device.TftDevice.DrawImageFromAsset(imgdata.NumberSprite.ImageAsset, img.Position{X: device.TftDevice.Width() - 7}, score/10%10) 154 | device.TftDevice.DrawImageFromAsset(imgdata.NumberSprite.ImageAsset, img.Position{X: device.TftDevice.Width() - 11}, score/100%10) 155 | device.TftDevice.DrawImageFromAsset(imgdata.NumberSprite.ImageAsset, img.Position{X: device.TftDevice.Width() - 15}, score/1000%10) 156 | device.TftDevice.DrawImageFromAsset(imgdata.NumberSprite.ImageAsset, img.Position{X: device.TftDevice.Width() - 19}, score/10000%10) 157 | device.TftDevice.DrawImageFromAsset(imgdata.NumberSprite.ImageAsset, img.Position{X: device.TftDevice.Width() - 23}, score/100000%10) 158 | 159 | // Draw pause 160 | if playStagePause { 161 | device.TftDevice.DrawImageFromAsset(imgdata.PauseSprite.ImageAsset, img.Position{X: 69, Y: 60}, 0) 162 | } 163 | 164 | } 165 | -------------------------------------------------------------------------------- /internal/wave/wave.go: -------------------------------------------------------------------------------- 1 | package wave 2 | 3 | var waves = []Wave{{}} 4 | 5 | type Wave struct { 6 | tickCount int 7 | } 8 | 9 | func (w *Wave) Move() { 10 | w.tickCount++ 11 | } 12 | -------------------------------------------------------------------------------- /internal/win_stage.go: -------------------------------------------------------------------------------- 1 | package internal 2 | 3 | func WinStageReset() { 4 | 5 | } 6 | 7 | func WinStageUpdate() { 8 | 9 | } 10 | 11 | func WinStageDraw() { 12 | 13 | } 14 | --------------------------------------------------------------------------------