From 5bb78f4faeba5a266211b50e26a168b22b764a4e Mon Sep 17 00:00:00 2001 From: zyz2875 <116343420+zyz2875@users.noreply.github.com> Date: Thu, 14 Nov 2024 19:35:43 +0800 Subject: [PATCH 1/2] Add files via upload --- teams/Gameboy/LICENSE | 202 +++++++++++++ teams/Gameboy/src/ai.mbt | 99 +++++++ teams/Gameboy/src/cd.mbt | 12 + teams/Gameboy/src/choice.mbt | 128 +++++++++ teams/Gameboy/src/collide.mbt | 56 ++++ teams/Gameboy/src/draw.mbt | 182 ++++++++++++ teams/Gameboy/src/fight.mbt | 359 ++++++++++++++++++++++++ teams/Gameboy/src/game.mbt | 89 ++++++ teams/Gameboy/src/game2.mbt | 131 +++++++++ teams/Gameboy/src/jump.mbt | 63 +++++ teams/Gameboy/src/lib/hello.mbt | 3 + teams/Gameboy/src/lib/hello_test.mbt | 5 + teams/Gameboy/src/lib/moon.pkg.json | 1 + teams/Gameboy/src/lib/w4x/gamepad.mbt | 49 ++++ teams/Gameboy/src/lib/w4x/moon.pkg.json | 5 + teams/Gameboy/src/moon.pkg.json | 20 ++ teams/Gameboy/src/move.mbt | 6 + teams/Gameboy/src/music.mbt | 98 +++++++ teams/Gameboy/src/player.mbt | 48 ++++ teams/Gameboy/src/skills.mbt | 218 ++++++++++++++ teams/Gameboy/src/smart.mbt | 14 + teams/Gameboy/src/sprite.mbt | 94 +++++++ teams/Gameboy/src/start.mbt | 30 ++ teams/Gameboy/src/story.mbt | 227 +++++++++++++++ 24 files changed, 2139 insertions(+) create mode 100644 teams/Gameboy/LICENSE create mode 100644 teams/Gameboy/src/ai.mbt create mode 100644 teams/Gameboy/src/cd.mbt create mode 100644 teams/Gameboy/src/choice.mbt create mode 100644 teams/Gameboy/src/collide.mbt create mode 100644 teams/Gameboy/src/draw.mbt create mode 100644 teams/Gameboy/src/fight.mbt create mode 100644 teams/Gameboy/src/game.mbt create mode 100644 teams/Gameboy/src/game2.mbt create mode 100644 teams/Gameboy/src/jump.mbt create mode 100644 teams/Gameboy/src/lib/hello.mbt create mode 100644 teams/Gameboy/src/lib/hello_test.mbt create mode 100644 teams/Gameboy/src/lib/moon.pkg.json create mode 100644 teams/Gameboy/src/lib/w4x/gamepad.mbt create mode 100644 teams/Gameboy/src/lib/w4x/moon.pkg.json create mode 100644 teams/Gameboy/src/moon.pkg.json create mode 100644 teams/Gameboy/src/move.mbt create mode 100644 teams/Gameboy/src/music.mbt create mode 100644 teams/Gameboy/src/player.mbt create mode 100644 teams/Gameboy/src/skills.mbt create mode 100644 teams/Gameboy/src/smart.mbt create mode 100644 teams/Gameboy/src/sprite.mbt create mode 100644 teams/Gameboy/src/start.mbt create mode 100644 teams/Gameboy/src/story.mbt diff --git a/teams/Gameboy/LICENSE b/teams/Gameboy/LICENSE new file mode 100644 index 0000000..75b5248 --- /dev/null +++ b/teams/Gameboy/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/teams/Gameboy/src/ai.mbt b/teams/Gameboy/src/ai.mbt new file mode 100644 index 0000000..0ddf717 --- /dev/null +++ b/teams/Gameboy/src/ai.mbt @@ -0,0 +1,99 @@ +struct Ai{ + mut skill_state:Bool + mut fight_state:Bool + mut run_state:Int + mut defend_state:Bool + mut jump_state:Bool + ai:Bool + prob:Prob + rng : @random.Rand + think_time:Int + mut think_state:Bool +} +struct Prob{ + mut prob1:Int + mut prob2:Int + mut prob3:Int + mut prob4:Int + mut prob5:Int}//jump +let pro:Prob={prob1:10,prob2:30,prob3:10,prob4:50,prob5:20} +struct Ti { + mut t:Int +} +let ti1:Ti={t:0} +let player_a:Ai={skill_state:false,fight_state:false,run_state:0,defend_state:false,jump_state:false,ai:false,prob:pro,rng:@random.new(),think_time:60,think_state:false} +let player_a1:Ai={skill_state:false,fight_state:false,run_state:0,defend_state:false,jump_state:false,ai:true,prob:pro,rng:@random.new(),think_time:30,think_state:false} +let player_a2:Ai={skill_state:false,fight_state:false,run_state:0,defend_state:false,jump_state:false,ai:true,prob:pro,rng:@random.new(),think_time:30,think_state:false} +let player_a3:Ai={skill_state:false,fight_state:false,run_state:0,defend_state:false,jump_state:false,ai:true,prob:pro,rng:@random.new(),think_time:30,think_state:false} +let player_a4:Ai={skill_state:false,fight_state:false,run_state:0,defend_state:false,jump_state:false,ai:true,prob:pro,rng:@random.new(),think_time:30,think_state:false} + +// fn strength(prob:Int)->Bool { +// if @random.int(player_a1.rng)%100>=player_a1.prob{ +// return true +// } +// else { +// return false +// } + +// } +fn ai_think()->Unit{ +if player_a2.think_state{ + ti1.t+=1 +if ti1.t==player_a2.think_time{ + ti1.t=0 +if @random.int(player_a1.rng)%100>=player_a2.prob.prob1{player_a2.skill_state=false} +else{player_a2.skill_state=true}//技能 +if @random.int(player_a1.rng)%100>=player_a2.prob.prob2{player_a2.fight_state=false} +else{player_a2.fight_state=true}//攻击 +if @random.int(player_a2.rng)%100>player_a2.prob.prob3{player_a2.defend_state=false} +else{player_a2.defend_state=true}//防御 +if @random.int(player_a3.rng)%100>=player_a2.prob.prob4{player_a2.run_state=0} +else{if @random.int(player_a2.rng)%50>=25{ +// @wasm4.text("\{@random.int(player_a2.rng)%50}",10,30) +player_a2.run_state=1} +else{player_a2.run_state=2}}//左右移动 +if @random.int(player_a4.rng)%100>=player_a2.prob.prob5{player_a2.jump_state=false} +else{player_a2.jump_state=true}//跳跃 +player_a2.think_state=false}} +if not(player_a2.think_state){ + ti1.t+=1 +if ti1.t==player_a2.think_time{ + ti1.t=0 +player_a2.think_state=true}}} +fn ai_run()->Unit{ + + if aiplayer.ai.run_state==2&¬(aiplayer.ai.think_state)&& aiplayer.pos.x + 20 < 160{ + if aiplayer.pos.y+35player1.pos.y{aiplayer.pos.x += aiplayer.playermodel.speed} + else{if aiplayer.direction{ aiplayer.pos.x += aiplayer.playermodel.speed} + else{if aiplayer.pos.x=35{ + // if player2.pos.y>=125{ + // phy.v=-15.0 + // phy.t=0.0} + // } + + // else if player2.ai.run_state==1&¬(player2.ai.think_state)&& player2.pos.x + 20 < 160{ + // if player2.pos.y+35player1.pos.y{player2.pos.x += player2.playermodel.speed} + // else{if player2.direction{ player2.pos.x -= player2.playermodel.speed} + // else{if player2.pos.x=35{ + // if player2.pos.y>=125{ + // phy.v=-15.0 + // phy.t=0.0} + // } + else if aiplayer.ai.run_state==1&¬(aiplayer.ai.think_state)&& aiplayer.pos.x >= 0{ + if aiplayer.pos.y+35player1.pos.y{aiplayer.pos.x -= aiplayer.playermodel.speed} + else{if not(aiplayer.direction){ aiplayer.pos.x -= aiplayer.playermodel.speed} + else{if aiplayer.pos.x>player1.pos.x+20{ aiplayer.pos.x -= aiplayer.playermodel.speed}}} + } + + // else{if player2.ai.run_state==2&¬(player2.ai.think_state)&& player2.pos.x + 20 < 160{ + // if player2.pos.y+35player1.pos.y{player2.pos.x += player2.playermodel.speed} + // else{if player2.direction{ player2.pos.x -= player2.playermodel.speed} + // else{if player2.pos.xUnit{ + if player.p{ + if c_cd.cd==10{c_cd.cd=0} + else if c_cd.cd==0{} + else {c_cd.cd+=1} + if @wasm4.get_gamepad(index=player.key).button_up{ + if c_cd.cd ==0{ + c_cd.cd+=1 + c_cd.count+=1 + choiced() + } + } + if c_cd.count==4{c_cd.count=0} + if c1.count==0{if @wasm4.get_gamepad(index=player1.key).button_1{ + choice1() + if c_cd.count==0{player.playermodel=knight_model} + if c_cd.count==1{player.playermodel=tanker_model} + if c_cd.count==2{player.playermodel=scientist_model} + if c_cd.count==3{player.playermodel=stive_model} + // @wasm4.text("READY", 10, 10) + c1.count=1} + @wasm4.set_draw_colors(2, index=1) + @wasm4.set_draw_colors(4, index=2) + if c_cd.count==0{@wasm4.blit(@wasm4.sprite(p1_sprite.data),57,27, 16,8,@wasm4.BlitFlag::{one_bit_per_pixel: true,rotate: false,flip_x: false,flip_y: false,}) + // @wasm4.set_draw_colors(1, index=1) + // @wasm4.set_draw_colors(2, index=2) + // @wasm4.set_draw_colors(3, index=3) + // @wasm4.set_draw_colors(4, index=4) + // @wasm4.blit(@wasm4.sprite(knight_sprite.data),10,20,scientist_sprite.width,scientist_sprite.height, @wasm4.BlitFlag::{one_bit_per_pixel: false,rotate: false,flip_x: false,flip_y: false,}) + } + @wasm4.set_draw_colors(2, index=1) + @wasm4.set_draw_colors(4, index=2) + if c_cd.count==1{@wasm4.blit(@wasm4.sprite(p1_sprite.data),87,27, 16,8,@wasm4.BlitFlag::{one_bit_per_pixel: true,rotate: false,flip_x: false,flip_y: false,}) + // @wasm4.set_draw_colors(1, index=1) + // @wasm4.set_draw_colors(2, index=2) + // @wasm4.set_draw_colors(3, index=3) + // @wasm4.set_draw_colors(4, index=4) + // @wasm4.blit(@wasm4.sprite(tanker_sprite.data),10,20,tanker_sprite.width,tanker_sprite.height,@wasm4.BlitFlag::{one_bit_per_pixel: false,rotate: false,flip_x: false,flip_y: false,}) + } + @wasm4.set_draw_colors(2, index=1) + @wasm4.set_draw_colors(4, index=2) + if c_cd.count==2{@wasm4.blit(@wasm4.sprite(p1_sprite.data),57,82, 16,8,@wasm4.BlitFlag::{one_bit_per_pixel: true,rotate: false,flip_x: false,flip_y: false,}) + // @wasm4.set_draw_colors(1, index=1) + // @wasm4.set_draw_colors(2, index=2) + // @wasm4.set_draw_colors(3, index=3) + // @wasm4.set_draw_colors(4, index=4) + // @wasm4.blit( @wasm4.sprite(scientist_sprite.data),10,20,tanker_sprite.width,tanker_sprite.height,@wasm4.BlitFlag::{one_bit_per_pixel: false,rotate: false,flip_x: false,flip_y: false,}) + } + @wasm4.set_draw_colors(2, index=1) + @wasm4.set_draw_colors(4, index=2) + if c_cd.count==3{@wasm4.blit(@wasm4.sprite(p1_sprite.data),87,82, 16,8,@wasm4.BlitFlag::{one_bit_per_pixel: true,rotate: false,flip_x: false,flip_y: false,}) + // @wasm4.set_draw_colors(1, index=1) + // @wasm4.set_draw_colors(2, index=2) + // @wasm4.set_draw_colors(3, index=3) + // @wasm4.set_draw_colors(4, index=4) + // @wasm4.blit(@wasm4.sprite(stive_sprite.data),10,20, tanker_sprite.width,tanker_sprite.height,@wasm4.BlitFlag::{one_bit_per_pixel: false,rotate: false,flip_x: false,flip_y: false,}) + } +} + @wasm4.set_draw_colors(2, index=1) + @wasm4.set_draw_colors(4, index=2) + } + else{ + if c1_cd.cd==10{c1_cd.cd=0} + else if c1_cd.cd==0{} + else {c1_cd.cd+=1} + if @wasm4.get_gamepad(index=player.key).button_up{ + if c1_cd.cd ==0{ + c1_cd.cd+=1 + c1_cd.count+=1 + choiced() + } + } + if c1_cd.count==4{c1_cd.count=0} + if c1.cd==0{if @wasm4.get_gamepad(index=player2.key).button_1{ + choice1() + if c1_cd.count==0{player.playermodel=knight_model} + if c1_cd.count==1{player.playermodel=tanker_model} + if c1_cd.count==2{player.playermodel=scientist_model} + if c1_cd.count==3{player.playermodel=stive_model} + // @wasm4.text("READY", 130, 10) + c1.cd=1} + if c1_cd.count==0{@wasm4.blit(@wasm4.sprite(p2_sprite.data),57,70, 16,8,@wasm4.BlitFlag::{one_bit_per_pixel: true,rotate: false,flip_x: false,flip_y: false,}) + // @wasm4.set_draw_colors(1, index=1) + // @wasm4.set_draw_colors(2, index=2) + // @wasm4.set_draw_colors(3, index=3) + // @wasm4.set_draw_colors(4, index=4) + // @wasm4.blit(@wasm4.sprite(knight_sprite.data),130, 20,scientist_sprite.width,scientist_sprite.height, @wasm4.BlitFlag::{one_bit_per_pixel: false,rotate: false,flip_x: true,flip_y: false,}) + } + @wasm4.set_draw_colors(2, index=1) + @wasm4.set_draw_colors(4, index=2) + + if c1_cd.count==1{@wasm4.blit(@wasm4.sprite(p2_sprite.data),87,70, 16,8,@wasm4.BlitFlag::{one_bit_per_pixel: true,rotate: false,flip_x: false,flip_y: false,}) + // @wasm4.set_draw_colors(1, index=1) + // @wasm4.set_draw_colors(2, index=2) + // @wasm4.set_draw_colors(3, index=3) + // @wasm4.set_draw_colors(4, index=4) + // @wasm4.blit(@wasm4.sprite(tanker_sprite.data),130, 20,tanker_sprite.width,tanker_sprite.height,@wasm4.BlitFlag::{one_bit_per_pixel: false,rotate: false,flip_x: true,flip_y: false,}) + } + @wasm4.set_draw_colors(2, index=1) + @wasm4.set_draw_colors(4, index=2) + + if c1_cd.count==2{@wasm4.blit(@wasm4.sprite(p2_sprite.data),57,125, 16,8,@wasm4.BlitFlag::{one_bit_per_pixel: true,rotate: false,flip_x: false,flip_y: false,}) + // @wasm4.set_draw_colors(1, index=1) + // @wasm4.set_draw_colors(2, index=2) + // @wasm4.set_draw_colors(3, index=3) + // @wasm4.set_draw_colors(4, index=4) + // @wasm4.blit( @wasm4.sprite(scientist_sprite.data),130, 20,tanker_sprite.width,tanker_sprite.height,@wasm4.BlitFlag::{one_bit_per_pixel: false,rotate: false,flip_x: true,flip_y: false,}) + } + @wasm4.set_draw_colors(2, index=1) + @wasm4.set_draw_colors(4, index=2) + + if c1_cd.count==3{@wasm4.blit(@wasm4.sprite(p2_sprite.data),87,125, 16,8,@wasm4.BlitFlag::{one_bit_per_pixel: true,rotate: false,flip_x: false,flip_y: false,}) + @wasm4.set_draw_colors(1, index=1) + // @wasm4.set_draw_colors(2, index=2) + // @wasm4.set_draw_colors(3, index=3) + // @wasm4.set_draw_colors(4, index=4) + // @wasm4.blit(@wasm4.sprite(stive_sprite.data),130, 20, tanker_sprite.width,tanker_sprite.height,@wasm4.BlitFlag::{one_bit_per_pixel: false,rotate: false,flip_x: true,flip_y: false,}) + } +} + @wasm4.set_draw_colors(2, index=1) + @wasm4.set_draw_colors(4, index=2) + } +if c1.cd==1&&c1.count==1{ent.scene=Game1} +} \ No newline at end of file diff --git a/teams/Gameboy/src/collide.mbt b/teams/Gameboy/src/collide.mbt new file mode 100644 index 0000000..eebc4b1 --- /dev/null +++ b/teams/Gameboy/src/collide.mbt @@ -0,0 +1,56 @@ +fn hit(player:Player,player_:Player)->Unit{ + if player.direction{if player.f_state.x<=0{player.f_live=false} + if player.f_state.x<=player_.pos.x+20&&player.f_state.x>=player_.pos.x&&player.f_state.y<=player_.pos.y+35&&player.f_state.y>=player_.pos.y{ + if not (player_.if_defend)||not(@wasm4.get_gamepad(index=player_.key).button_down){ + fight_s() + player_.hp-=player.demage.fight} + player.f_live=false}} + else{if player.f_state.x>=160{player.f_live=false} + if player.f_state.x<=player_.pos.x+20&&player.f_state.x>=player_.pos.x&&player.f_state.y<=player_.pos.y+35&&player.f_state.y>=player_.pos.y{ + if not (player_.if_defend)||not(@wasm4.get_gamepad(index=player_.key).button_down){ + fight_s() + player_.hp-=player.demage.fight} + player.f_live=false}} +} +fn dash(player:Player,player_:Player)->Unit{ + if player.pos.x<=0||player.pos.x>=140{ + fight_s() + player.hp-=10 + player.state=0} + if player.direction{if player.pos.x=player_.pos.y{ + if not (player_.if_defend)||not(@wasm4.get_gamepad(index=player_.key).button_down){ + fight_s() + player_.hp-=player.demage.skill} + else{ + fight_s() + player_.hp-=player.demage.skill/2} + player.pos.x+=10 + player.state=0}} + else{if player.pos.x>=player_.pos.x-20&&player.pos.y<=player_.pos.y+35&&player.pos.y>=player_.pos.y{ + if not (player_.if_defend)||not(@wasm4.get_gamepad(index=player_.key).button_down){ + fight_s() + player_.hp-=player.demage.skill} + else{ + fight_s() + player_.hp-=player.demage.skill/2} + player.pos.x-=10 + player.state=0}} +} +fn p_hit(player:Player,player_:Player)->Unit{ + if player.direction{if player.f_state.x<=0{player.f_live=false} + if player.f_state.x<=player_.pos.x+20&&player.f_state.x>=player_.pos.x&&player.f_state.y<=player_.pos.y+35&&player.f_state.y>=player_.pos.y{ + if not (player_.if_defend)||not(@wasm4.get_gamepad(index=player_.key).button_down){ + fight_s() + player_.hp-=player.demage.fight} + player.f_live=false + // player_.state=3 + }} + else{if player.f_state.x>=160{player.f_live=false} + if player.f_state.x<=player_.pos.x+20&&player.f_state.x>=player_.pos.x&&player.f_state.y<=player_.pos.y+35&&player.f_state.y>=player_.pos.y{ + if not (player_.if_defend)||not(@wasm4.get_gamepad(index=player_.key).button_down){ + fight_s() + player_.hp-=player.demage.fight} + player.f_live=false + // player_.state=3 + }} +} \ No newline at end of file diff --git a/teams/Gameboy/src/draw.mbt b/teams/Gameboy/src/draw.mbt new file mode 100644 index 0000000..8c15be0 --- /dev/null +++ b/teams/Gameboy/src/draw.mbt @@ -0,0 +1,182 @@ + +enum Scene { + // Welcome + Menus + Game1 + Game2 + Choice + Victory1 + Victory2 + // End +} derive(Eq) +struct Cd{ + mut count:Int + mut cd : Int +} +let m_cd:Cd={cd:0,count:0} + +fn render_system(entities : Entities) -> Unit { + match entities.scene { + // Welcome => render_welcome(entities) + Menus => render_menus(entities) + Game1 => render_game1(entities) + Game2 => render_game2(entities) + Choice => render_choice(entities) + Victory1 => render_victory1(entities) + Victory2 => render_victory2(entities) + // End => render_End(entities) + } +} + +fn render_menus(entities : Entities) -> Unit { + bgm(50,20) + if m_cd.cd==10{m_cd.cd=0} + else if m_cd.cd==0{} + else {m_cd.cd+=1} + @wasm4.set_draw_colors(1, index=1) + @wasm4.set_draw_colors(1, index=2) + @wasm4.rect(0, 0, 160, 160) + @wasm4.set_draw_colors(2, index=1) + @wasm4.set_draw_colors(1, index=2) + // @wasm4.text("->", 4, 10+20*m_cd.count) + @wasm4.rect(14,4+20*m_cd.count,54,18) + @wasm4.set_draw_colors(1, index=1) + @wasm4.set_draw_colors(2, index=2) + @wasm4.rect(16,6+20*m_cd.count,50,14) + @wasm4.set_draw_colors(4, index=1) + @wasm4.set_draw_colors(1, index=2) + @wasm4.text("P1VP2", 20, 10) + @wasm4.text("STORY", 20, 30) + @wasm4.text("MUSIC", 20, 50) + @wasm4.text("EXIST", 20, 70) + @wasm4.set_draw_colors(1, index=1) + @wasm4.set_draw_colors(2, index=2) + @wasm4.set_draw_colors(3, index=3) + @wasm4.set_draw_colors(4, index=4) + @wasm4.blit(@wasm4.sprite(background.data),0,90,background.height,background.width,@wasm4.BlitFlag::{one_bit_per_pixel: false,rotate: false,flip_x: false,flip_y: false,}) + @wasm4.blit(@wasm4.sprite(baimianju.data),128,34,baimianju.height,baimianju.width,@wasm4.BlitFlag::{one_bit_per_pixel: false,rotate: false,flip_x: false,flip_y: false,}) + @wasm4.blit(@wasm4.sprite(title.data),70,5,title.height,title.width,@wasm4.BlitFlag::{one_bit_per_pixel: false,rotate: false,flip_x: false,flip_y: false,}) + if @wasm4.get_gamepad(index=1).button_2{ + choice1() + if m_cd.count==0{ent.scene=Choice} + else if m_cd.count==1{ent.scene=Game2} + else if m_cd.count==2{ent.scene=Menus} + else if m_cd.count==3{ent.scene=Menus} + else{}} + if @wasm4.get_gamepad(index=1).button_up{ + if m_cd.cd ==0{ + m_cd.cd+=1 + m_cd.count+=1 + choice2() + } + } + if m_cd.count==4{m_cd.count=0} + +} +fn render_choice(entities : Entities) -> Unit { + @wasm4.set_draw_colors(1, index=1) + @wasm4.set_draw_colors(1, index=2) + @wasm4.rect(0, 0, 160, 160) + @wasm4.set_draw_colors(2, index=1) + @wasm4.set_draw_colors(1, index=2) + @wasm4.rect(50, 25, 30, 55) + @wasm4.rect(80, 25, 30, 55) + @wasm4.rect(50, 80, 30, 55) + @wasm4.rect(80, 80, 30, 55) + @wasm4.set_draw_colors(1, index=1) + @wasm4.set_draw_colors(2, index=2) + @wasm4.set_draw_colors(3, index=3) + @wasm4.set_draw_colors(4, index=4) + @wasm4.blit(@wasm4.sprite(knight_sprite.data),55,35,scientist_sprite.width,scientist_sprite.height, @wasm4.BlitFlag::{one_bit_per_pixel: false,rotate: false,flip_x: false,flip_y: false,}) + @wasm4.blit(@wasm4.sprite(tanker_sprite.data),85,35,tanker_sprite.width,tanker_sprite.height,@wasm4.BlitFlag::{one_bit_per_pixel: false,rotate: false,flip_x: false,flip_y: false,}) + @wasm4.blit( @wasm4.sprite(scientist_sprite.data),55,90,tanker_sprite.width,tanker_sprite.height,@wasm4.BlitFlag::{one_bit_per_pixel: false,rotate: false,flip_x: false,flip_y: false,}) + @wasm4.blit(@wasm4.sprite(stive_sprite.data),85,90, tanker_sprite.width,tanker_sprite.height,@wasm4.BlitFlag::{one_bit_per_pixel: false,rotate: false,flip_x: false,flip_y: false,}) + @wasm4.set_draw_colors(4, index=1) + @wasm4.set_draw_colors(1, index=2) + @wasm4.text("CHOICE", 64, 5) + @wasm4.text("Press button1", 8, 140) + choice(player1) + choice(player2) +} +fn render_game1(entities : Entities) -> Unit { + bgm2(25,10) + // @wasm4.set_draw_colors(2, index=1) + // @wasm4.set_draw_colors(2, index=2) + // @wasm4.rect(palyer1.direction.x, palyer1.direction.y, 20, 35) + // @wasm4.rect(palyer2.direction.x, palyer2.direction.y, 20, 35) + // if g_cd.cd==player1 + // {g_cd.cd=0} + // else if g_cd.cd==0{} + // else {g_cd.cd+=1} + game_init() + @wasm4.set_draw_colors(0, index=1) + @wasm4.set_draw_colors(2, index=2) + @wasm4.set_draw_colors(3, index=3) + @wasm4.set_draw_colors(4, index=4) + @wasm4.blit( + @wasm4.sprite(player1.playermodel.sprite.data),player1.pos.x,player1.pos.y, + player1.playermodel.sprite.width, + player1.playermodel.sprite.height, + @wasm4.BlitFlag::{ + one_bit_per_pixel: false, + rotate: false, + flip_x: player1.direction, + flip_y: false,}) + @wasm4.blit( + @wasm4.sprite(player2.playermodel.sprite.data),player2.pos.x,player2.pos.y, + player1.playermodel.sprite.width, + player1.playermodel.sprite.height, + @wasm4.BlitFlag::{ + one_bit_per_pixel: false, + rotate: false, + flip_x: player2.direction, + flip_y: false,}) + @wasm4.set_draw_colors(1,index=1) + @wasm4.set_draw_colors(4, index=2) + @wasm4.rect(e_pos.x, e_pos.y, player2.hp, 5) + @wasm4.rect(p_pos.x, p_pos.y, player1.hp, 5) + @wasm4.set_draw_colors(3,index=1) + @wasm4.set_draw_colors(4, index=2) + @wasm4.rect(e_pos.x, e_pos.y, player2.hp, 5) + @wasm4.rect(p_pos.x, p_pos.y, player1.hp, 5) + @wasm4.set_draw_colors(4,index=1) + @wasm4.set_draw_colors(1, index=2) + @wasm4.text("P1",0,0) + @wasm4.text("P2",90,0) + // @wasm4.set_draw_colors(1, index=1) + // @wasm4.set_draw_colors(1, index=2) + // @wasm4.rect(0, 16, 120, 144) + // entities.tanks.each(Character::draw) + // entities.bullets.each(Flayer::draw) +} +fn render_victory1(_entities : Entities) -> Unit { + @wasm4.set_draw_colors(2, index=1) + @wasm4.set_draw_colors(2, index=2) + @wasm4.rect(0, 0, 160, 160) + @wasm4.set_draw_colors(3, index=1) + @wasm4.set_draw_colors(2, index=2) + @wasm4.text("P1 Win!", 30, 10) +} +fn render_victory2(_entities : Entities) -> Unit { + @wasm4.set_draw_colors(2, index=1) + @wasm4.set_draw_colors(2, index=2) + @wasm4.rect(0, 0, 160, 160) + @wasm4.set_draw_colors(3, index=1) + @wasm4.set_draw_colors(2, index=2) + @wasm4.text("P2 Win!", 30, 10) +} +fn lose() -> Unit { + @wasm4.set_draw_colors(2, index=1) + @wasm4.set_draw_colors(2, index=2) + @wasm4.rect(0, 0, 160, 160) + @wasm4.set_draw_colors(3, index=1) + @wasm4.set_draw_colors(2, index=2) + @wasm4.text("You lose", 30, 10) + @wasm4.text("Press R to restart", 0, 20) +} +pub fn start() -> Unit { + @wasm4.set_palette(1, @wasm4.rgb(0xffffff)) + @wasm4.set_palette(2, @wasm4.rgb(0xe5b083)) + @wasm4.set_palette(3, @wasm4.rgb(0xb8043d)) + @wasm4.set_palette(4, @wasm4.rgb(0x000000)) +} \ No newline at end of file diff --git a/teams/Gameboy/src/fight.mbt b/teams/Gameboy/src/fight.mbt new file mode 100644 index 0000000..c99b9ff --- /dev/null +++ b/teams/Gameboy/src/fight.mbt @@ -0,0 +1,359 @@ +fn fightpvp(player : Player) -> Unit { + if player.cd.f2_cd == player.cd.f1_cd { + player.cd.f2_cd = 0 + } else if player.cd.f2_cd == 0 { + + } else { + player.cd.f2_cd += 1 + } + // if @wasm4.get_gamepad(index=1).button_1&& not(@wasm4.get_gamepad(index=1).button_down){ + + // if player.cd.f2_cd ==0{ + // player.cd.f2_cd+=1 + // player.f_state.x=player.pos.x + // player.f_state.y=player.pos.y+10 + // player.f_live=true + if player.p { + fight1(player, player2) + } else { + fight1(player, player1) + } + + +} +fn fightpve(player : Player) -> Unit { + if player.cd.f2_cd == player.cd.f1_cd { + player.cd.f2_cd = 0 + } else if player.cd.f2_cd == 0 { + + } else { + player.cd.f2_cd += 1 + } + // if @wasm4.get_gamepad(index=1).button_1&& not(@wasm4.get_gamepad(index=1).button_down){ + + // if player.cd.f2_cd ==0{ + // player.cd.f2_cd+=1 + // player.f_state.x=player.pos.x + // player.f_state.y=player.pos.y+10 + // player.f_live=true + if player.p { + fight1(player, aiplayer) + } else { + fight1(player, player1) + } + + +} + +fn defend(player : Player) -> Unit { + if player.cd.d2_cd == player.cd.d1_cd { + player.cd.d2_cd = 0 + + } else if player.cd.d2_cd >= 0 && + player.cd.d2_cd <= 60 { + + } else { + player.if_defend=false + player.cd.d2_cd += 1 + } + if player.ai.ai{ + if player_a2.defend_state&¬(player2.ai.think_state){ + if player.cd.d2_cd >= 0 && player.cd.d2_cd <= 60 { + player.cd.d2_cd += 1 + if player.direction{@wasm4.rect(player.pos.x, player.pos.y, 3, 35)} + else{@wasm4.rect(player.pos.x + 20, player.pos.y, 3, 35)} + player.if_defend=true + } + }} + else{if @wasm4.get_gamepad(index=player.key).button_down && + not(@wasm4.get_gamepad(index=player.key).button_1) { + if player.cd.d2_cd >= 0 && player.cd.d2_cd <= 60 { + player.cd.d2_cd += 1 + if player.direction{@wasm4.rect(player.pos.x, player.pos.y, 3, 35)} + else{@wasm4.rect(player.pos.x + 20, player.pos.y, 3, 35)} + player.if_defend=true + }}} + +} + +struct Physic { + mut x_v : Double + mut y_v : Double + g : Double + mut x : Double + mut t : Double +} + +fn fight1(player : Player, player_ : Player) -> Unit { + // match player.playermodel.fight{ + // Short=>@wasm4.rect(player.pos.x-20, player.pos.y+10, 15, 5) + // Long=>@wasm4.rect(player.pos.x-20, player.pos.y+10, 15, 5) + // } + match player.playermodel.fight { + Bullet => { + if player.ai.ai{if player_a2.fight_state&¬(player2.ai.think_state){ + if player.direction{rush.t2=true} + else{rush.t2=false} + if player.cd.f2_cd == 0 { + player.cd.f2_cd += 1 + player.f_state.x = player.pos.x + player.f_state.y = player.pos.y + 10 + player.f_live = true + } + } + if player.f_live == true { + hit(player, player_) + + if rush.t2 {player.f_state.x -= 2 + } else {player.f_state.x += 2} + + @wasm4.rect(player.f_state.x,player.f_state.y,5, + 5, + ) + }} + else{ + if @wasm4.get_gamepad(index=player.key).button_1 && + not(@wasm4.get_gamepad(index=player.key).button_down) { + if player.direction{rush.t2=true} + else{rush.t2=false} + if player.cd.f2_cd == 0 { + player.cd.f2_cd += 1 + player.f_state.x = player.pos.x + player.f_state.y = player.pos.y + 10 + player.f_live = true + } + } + if player.f_live == true { + hit(player, player_) + + if rush.t2 {player.f_state.x -= 2 + } else {player.f_state.x += 2} + + @wasm4.rect(player.f_state.x,player.f_state.y,5, + 5, + ) + } + }} + Fist => + if player.ai.ai{if player_a2.fight_state&¬ (player2.if_defend) { + if player.cd.f2_cd == 0 { + player.cd.f2_cd += 1 + if player.direction{@wasm4.rect(player.pos.x-20, player.pos.y + 10, 20, 5) + if player.pos.x - 20 <= player_.pos.x&&player.pos.y<=player_.pos.y+35&&player.pos.y>=player_.pos.y{ + if not (player_.if_defend)||not(@wasm4.get_gamepad(index=player_.key).button_down){ + fight_m() + player_.hp-=player.demage.fight}} + } + else{@wasm4.rect(player.pos.x + 20, player.pos.y + 10, 20, 5) + if player.pos.x + 40 >= player_.pos.x &&player.pos.y<=player_.pos.y+35&&player.pos.y>=player_.pos.y{ + if not (player_.if_defend)||not(@wasm4.get_gamepad(index=player_.key).button_down){ + fight_m() + player_.hp-=player.demage.fight}} + + }}}} + else{if @wasm4.get_gamepad(index=player.key).button_1 && + not(@wasm4.get_gamepad(index=player.key).button_down) { + if player.cd.f2_cd == 0 { + player.cd.f2_cd += 1 + if player.direction{@wasm4.rect(player.pos.x-20, player.pos.y + 10, 20, 5) + if player.pos.x - 20 <= player_.pos.x&&player.pos.y<=player_.pos.y+35&&player.pos.y>=player_.pos.y{ + if not (player_.if_defend)||not(@wasm4.get_gamepad(index=player_.key).button_down){ + fight_m() + player_.hp-=player.demage.fight}} + } + else{@wasm4.rect(player.pos.x + 20, player.pos.y + 10, 20, 5) + if player.pos.x + 40 >= player_.pos.x &&player.pos.y<=player_.pos.y+35&&player.pos.y>=player_.pos.y{ + if not (player_.if_defend)||not(@wasm4.get_gamepad(index=player_.key).button_down){ + fight_m() + player_.hp-=player.demage.fight}} + + }}}} + + Poke =>if player.ai.ai{if player_a2.fight_state&¬ (player2.if_defend) { + + if player.cd.f2_cd == 0 { + player.cd.f2_cd += 1 + if player.direction{if player.pos.x - 50 <= player_.pos.x &&player.pos.y<=player_.pos.y+35&&player.pos.y>=player_.pos.y{ + if not (player_.if_defend)||not(@wasm4.get_gamepad(index=player_.key).button_down){ + fight_m() + player_.hp-=player.demage.fight}} + @wasm4.rect(player.pos.x -30, player.pos.y + 10, 30, 5) + @wasm4.tone_note_mode((@wasm4.Note::new(60, bend=0), None),@wasm4.ADSR::new(1),@wasm4.ADSRVolume::new(100), @wasm4.ToneFlag::new())} + else{if player.pos.x + 50 >= player_.pos.x &&player.pos.y<=player_.pos.y+35&&player.pos.y>=player_.pos.y{ + if not (player_.if_defend)||not(@wasm4.get_gamepad(index=player_.key).button_down){ + fight_m() + player_.hp-=player.demage.fight}} + @wasm4.rect(player.pos.x + 20, player.pos.y + 10, 30, 5) + @wasm4.tone_note_mode((@wasm4.Note::new(60, bend=0), None),@wasm4.ADSR::new(1),@wasm4.ADSRVolume::new(100), @wasm4.ToneFlag::new())} + } + } + } + else{if @wasm4.get_gamepad(index=player.key).button_1 && + not(@wasm4.get_gamepad(index=player.key).button_down) { + + if player.cd.f2_cd == 0 { + player.cd.f2_cd += 1 + if player.direction{if player.pos.x - 50 <= player_.pos.x &&player.pos.y<=player_.pos.y+35&&player.pos.y>=player_.pos.y{ + if not (player_.if_defend)||not(@wasm4.get_gamepad(index=player_.key).button_down){ + fight_m() + player_.hp-=player.demage.fight}} + @wasm4.rect(player.pos.x -30, player.pos.y + 10, 30, 5) + @wasm4.tone_note_mode((@wasm4.Note::new(60, bend=0), None),@wasm4.ADSR::new(1),@wasm4.ADSRVolume::new(100), @wasm4.ToneFlag::new())} + else{if player.pos.x + 50 >= player_.pos.x &&player.pos.y<=player_.pos.y+35&&player.pos.y>=player_.pos.y{ + if not (player_.if_defend)||not(@wasm4.get_gamepad(index=player_.key).button_down){ + fight_m() + player_.hp-=player.demage.fight}} + @wasm4.rect(player.pos.x + 20, player.pos.y + 10, 30, 5) + @wasm4.tone_note_mode((@wasm4.Note::new(60, bend=0), None),@wasm4.ADSR::new(1),@wasm4.ADSRVolume::new(100), @wasm4.ToneFlag::new())} + } + }} + Bottle =>if player.ai.ai{ + if player_a2.fight_state&¬ (player2.if_defend) { + if player.direction{rush.t2=true} + else{rush.t2=false} + if player.cd.f2_cd == 0 { + player.cd.f2_cd += 1 + player.f_state.x = player.pos.x + player.f_state.y = player.pos.y + 10 + player.f_live = true + } + } + if player.f_live == true { + p_hit(player, player_) + if rush.t2 {player.f_state.x -= 1 + } else {player.f_state.x += 1} + + @wasm4.rect(player.f_state.x,player.f_state.y,10, + 5, + ) + }} + else{if @wasm4.get_gamepad(index=player.key).button_1 && + not(@wasm4.get_gamepad(index=player.key).button_down) { + if player.direction{rush.t2=true} + else{rush.t2=false} + if player.cd.f2_cd == 0 { + player.cd.f2_cd += 1 + player.f_state.x = player.pos.x + player.f_state.y = player.pos.y + 10 + player.f_live = true + } + } + if player.f_live == true { + p_hit(player, player_) + if rush.t2 {player.f_state.x -= 1 + } else {player.f_state.x += 1} + + @wasm4.rect(player.f_state.x,player.f_state.y,10, + 5, + ) + } + } + +}} +// fn fight2(player:Player,player_:Player)-> Unit{ +// match player.playermodel.fight{ +// Bullet=>@wasm4.rect(player.pos.x-20, player.pos.y+10, 15, 5) +// Long=>@wasm4.rect(player.pos.x-20, player.pos.y+10, 15, 5) +// } +// } + +// // pub fn gravity(y:Int) ->Int{ +// // let mut y=y +// // y=y+1 +// // } +// struct Point { +// mut x : Int +// mut y : Int +// } +// let en:Cd={cd:60,count:0} +// let e:Cd={cd:0,count:0} +// let p_pos : Point = { x: 16, y: 0} +// let e_pos : Point = { x: 106, y: 0} +// let palyer1 : Player = { hp :50, mp:100, pos:{ x:0,y:125 },fight_cd:1,skill_cd:10} +// let palyer2 : Player = { hp :50, mp:100, direction:{ x:140,y:125},fight_cd:1,skill_cd:10} +// let ent:Entities={scene:Welcome} +// ////let gamepad1 = @wasm4.get_gamepad() +// // let ent:Entities={a:0} +// pub fn update() -> Unit { + +// if @wasm4.get_gamepad(index=1).button_1{ent.scene=Menus} +// // if @wasm4.get_gamepad(index=1).button_1{ent.scene=Game1} +// // } +// if m_cd.cd==30{m_cd.cd=0} +// else if m_cd.cd==0{} +// else {m_cd.cd+=1} +// render_system(ent) +// // if en.cd==60{en.cd=0} +// // else if en.cd==0{} +// // else {en.cd+=1} +// // @wasm4.set_draw_colors(2, index=1) +// // @wasm4.set_draw_colors(2, index=2) +// // @wasm4.rect(palyer1.direction.x, palyer1.direction.y, 20, 35) +// // @wasm4.rect(palyer2.direction.x, palyer2.direction.y, 20, 35) +// // @wasm4.set_draw_colors(1,index=1) +// // @wasm4.set_draw_colors(3, index=2) +// // @wasm4.rect(e_pos.x, e_pos.y, 50, 5) +// // @wasm4.rect(p_pos.x, p_pos.y, 50, 5) +// // @wasm4.set_draw_colors(2,index=1) +// // @wasm4.set_draw_colors(3, index=2) +// // @wasm4.rect(e_pos.x, e_pos.y, palyer2.hp, 5) +// // @wasm4.rect(p_pos.x, p_pos.y, palyer1.hp, 5) +// // @wasm4.text("P1",0,0) +// // @wasm4.text("P2",100,0) +// if palyer1.direction.y<125{ +// palyer1.direction.y += 1 +// } + +// //@wasm4.rect(palyer1.direction.x+20, palyer1.direction.y+10, 15, 5) +// if @wasm4.get_gamepad(index=1).button_right && palyer1.direction.x + 20 < 160 &&(palyer1.direction.x+20< palyer2.direction.x||palyer1.direction.y<= palyer2.direction.y-35) { +// palyer1.direction.x += 1 +// // } else if @wasm4.get_gamepad(index=1).button_down && pos.y + 8 < 160 { +// // pos.y += 1 +// } +// else if @wasm4.get_gamepad(index=1).button_up&& palyer1.direction.y >=5{ +// if palyer1.direction.y>=125{palyer1.direction.y -= 50} + +// // palyer1.direction.y=y重力 + +// } +// else if @wasm4.get_gamepad(index=1).button_left && palyer1.direction.x >= 0 { +// palyer1.direction.x -= 1 +// } +// // } else if @wasm4.get_gamepad(index=1).button_up && pos.y >= 0 { +// // pos.y -= 1 + +// if @wasm4.get_gamepad(index=1).button_down && palyer1.direction.x + 32 >= palyer2.direction.x&&palyer1.direction.y>= palyer2.direction.y{ +// if en.cd ==0{ +// en.cd+=1 +// palyer2.hp-= 10 +// @wasm4.rect(palyer1.direction.x+20, palyer1.direction.y+10, 15, 5) +// } + +// } +// if palyer1.hp<=0{ +// @wasm4.text("P2 Win!",52,88) +// } +// if palyer2.hp<=0{ +// ent.scene=Victory +// // @wasm4.text("P1 Win!",52,88) +// } +// } + +// // pub fn input(self : Game) -> Unit { +// // let gamepad = @wasm4.get_gamepad(index=1) +// // if gamepad != self.prev_gamepad { +// // // if gamepad.button_down { +// // // self.snake.down() +// // // } +// // // if gamepad.button_left { +// // // self.snake.left() +// // // } +// // // if gamepad.button_right { +// // // self.snake.right() +// // // } +// // // if gamepad.button_up { +// // // self.snake.up() +// // // } +// // } +// // self.prev_gamepad = gamepad +// // } diff --git a/teams/Gameboy/src/game.mbt b/teams/Gameboy/src/game.mbt new file mode 100644 index 0000000..6413fca --- /dev/null +++ b/teams/Gameboy/src/game.mbt @@ -0,0 +1,89 @@ +struct Entities { + // mut a :Int + // character : Array[Character] + // flyers : Array[Flayer] + mut scene : Scene + // player:Player + // pressedpad : @w4x.PressedPad//按键 + // mut levels : Array[Level]//敌人等级 + // mut level_idx : Int + // random_state : @random.Rand +} + +struct Game{ + mut mod:Int +} +let game1:Game={mod:1} +let game2:Game={mod:2} +fn game_init()->Unit{ + move(player1,player2) + if game1.mod==1{ + player1.cd.s1_cd=player1.playermodel.cd.s1_cd + player1.cd.f1_cd=player1.playermodel.cd.f1_cd + player1.cd.d1_cd=player1.playermodel.cd.d1_cd + player1.cd.s2_cd=player1.playermodel.cd.s2_cd + player1.cd.f2_cd=player1.playermodel.cd.f2_cd + player1.cd.d2_cd=player1.playermodel.cd.d2_cd + player1.hp=player1.playermodel.hp + player1.demage.fight=player1.playermodel.demage.fight + player2.cd.s1_cd=player2.playermodel.cd.s1_cd + player2.cd.f1_cd=player2.playermodel.cd.f1_cd + player2.cd.d1_cd=player2.playermodel.cd.d1_cd + player2.cd.s2_cd=player2.playermodel.cd.s2_cd + player2.cd.f2_cd=player2.playermodel.cd.f2_cd + player2.cd.d2_cd=player2.playermodel.cd.d2_cd + player2.hp=player2.playermodel.hp + player2.demage.fight=player2.playermodel.demage.fight + game1.mod=0} + + // player1.pos.y=jump(124) + if @wasm4.get_gamepad(index=1).button_right && player1.pos.x + 20 < 160{ + if player1.pos.y+35player2.pos.y{player1.pos.x += player1.playermodel.speed} + else{if player1.direction{ player1.pos.x += player1.playermodel.speed} + else{if player1.pos.x= 0{ + if player1.pos.y+35player2.pos.y{player1.pos.x -= player1.playermodel.speed} + else{if not(player1.direction){ player1.pos.x -= player1.playermodel.speed} + else{if player1.pos.x>player2.pos.x+20{ player1.pos.x -= player1.playermodel.speed}}} + } + fightpvp(player1) + skills(player1,player2) + defend(player1) + jump(player1,player2,phy1) + + // if player1.hp<=0{ + // @wasm4.text("P2 Win!",52,88) + // } + // if player2.hp<=0{ + // ent.scene=Victory} +////////////////////////////////////////////////////////// + // player2.pos.y=jump(124) + if @wasm4.get_gamepad(index=2).button_right&& player2.pos.x + 20 < 160{ + if player2.pos.y+35player1.pos.y{player2.pos.x += player2.playermodel.speed} + else{if player2.direction{ player2.pos.x += player2.playermodel.speed} + else{if player2.pos.x=35{ + // if player2.pos.y>=125{ + // phy.v=-15.0 + // phy.t=0.0} + // } + else if @wasm4.get_gamepad(index=2).button_left && player2.pos.x >= 0{ + if player2.pos.y+35player1.pos.y{player2.pos.x -= player2.playermodel.speed} + else{if not(player2.direction){ player2.pos.x -= player2.playermodel.speed} + else{if player2.pos.x>player1.pos.x+20{ player2.pos.x -= player2.playermodel.speed}}} + } + fightpvp(player2) + skills(player2,player1) + defend(player2) + jump(player2,player1,phy2) + if player2.hp<=0{ + ent.scene=Victory1 + } + if player1.hp<=0{ + ent.scene=Victory2 + } + +} \ No newline at end of file diff --git a/teams/Gameboy/src/game2.mbt b/teams/Gameboy/src/game2.mbt new file mode 100644 index 0000000..ed11b2e --- /dev/null +++ b/teams/Gameboy/src/game2.mbt @@ -0,0 +1,131 @@ + +fn game2_init()->Unit{ + bgm1(25,10) + + @wasm4.set_draw_colors(0, index=1) + @wasm4.set_draw_colors(2, index=2) + @wasm4.set_draw_colors(3, index=3) + @wasm4.set_draw_colors(4, index=4) + @wasm4.blit( + @wasm4.sprite(player1.playermodel.sprite.data),player1.pos.x,player1.pos.y, + player1.playermodel.sprite.width, + player1.playermodel.sprite.height, + @wasm4.BlitFlag::{ + one_bit_per_pixel: false, + rotate: false, + flip_x: player1.direction, + flip_y: false,}) + if aiplayer.playermodel.sprite.data==mo_sprite.data{ + @wasm4.set_draw_colors(1,index=1) + @wasm4.set_draw_colors(4, index=2) + @wasm4.blit( + @wasm4.sprite(aiplayer.playermodel.sprite.data),aiplayer.pos.x,aiplayer.pos.y, + aiplayer.playermodel.sprite.height, + aiplayer.playermodel.sprite.width, + @wasm4.BlitFlag::{ + one_bit_per_pixel: true, + rotate: false, + flip_x: aiplayer.direction, + flip_y: false,})} + else{@wasm4.blit( + @wasm4.sprite(aiplayer.playermodel.sprite.data),aiplayer.pos.x,aiplayer.pos.y, + aiplayer.playermodel.sprite.height, + aiplayer.playermodel.sprite.width, + @wasm4.BlitFlag::{ + one_bit_per_pixel: false, + rotate: false, + flip_x: not(aiplayer.direction), + flip_y: false,})} + @wasm4.set_draw_colors(1,index=1) + @wasm4.set_draw_colors(4, index=2) + @wasm4.rect(e_pos.x, e_pos.y, aiplayer.hp, 5) + @wasm4.rect(p_pos.x, p_pos.y, player1.hp, 5) + @wasm4.set_draw_colors(3,index=1) + @wasm4.set_draw_colors(4, index=2) + @wasm4.rect(e_pos.x, e_pos.y, aiplayer.hp, 5) + @wasm4.rect(p_pos.x, p_pos.y, player1.hp, 5) + @wasm4.set_draw_colors(4,index=1) + @wasm4.set_draw_colors(1, index=2) + @wasm4.text("P1",0,0) + @wasm4.text("PC",90,0) + move(player1,aiplayer) + if game2.mod==2{ + player1.cd.s1_cd=player1.playermodel.cd.s1_cd + player1.cd.f1_cd=player1.playermodel.cd.f1_cd + player1.cd.d1_cd=player1.playermodel.cd.d1_cd + player1.cd.s2_cd=player1.playermodel.cd.s2_cd + player1.cd.f2_cd=player1.playermodel.cd.f2_cd + player1.cd.d2_cd=player1.playermodel.cd.d2_cd + player1.hp=player1.playermodel.hp + player1.demage.fight=player1.playermodel.demage.fight + aiplayer.cd.s1_cd=aiplayer.playermodel.cd.s1_cd + aiplayer.cd.f1_cd=aiplayer.playermodel.cd.f1_cd + aiplayer.cd.d1_cd=aiplayer.playermodel.cd.d1_cd + aiplayer.cd.s2_cd=aiplayer.playermodel.cd.s2_cd + aiplayer.cd.f2_cd=aiplayer.playermodel.cd.f2_cd + aiplayer.cd.d2_cd=aiplayer.playermodel.cd.d2_cd + aiplayer.hp=aiplayer.playermodel.hp + aiplayer.demage.fight=aiplayer.playermodel.demage.fight + game2.mod=0} + + // @wasm4.text("\{player.demage.fight}",10,30) + // player1.pos.y=jump(124) + if @wasm4.get_gamepad(index=1).button_right && player1.pos.x + 20 < 160{ + if aiplayer.playermodel.sprite.data==dragon_sprite.data{if player1.pos.x + 20 < 110{if player1.pos.y+35aiplayer.pos.y{ + player1.pos.x += player1.playermodel.speed} + else{if player1.direction{ player1.pos.x += player1.playermodel.speed} + else{if player1.pos.xaiplayer.pos.y{ + player1.pos.x += player1.playermodel.speed} + else{if player1.direction{ player1.pos.x += player1.playermodel.speed} + else{if player1.pos.x= 0{ + if player1.pos.y+35aiplayer.pos.y{player1.pos.x -= player1.playermodel.speed} + else{if not(player1.direction){ player1.pos.x -= player1.playermodel.speed} + else{if player1.pos.x>aiplayer.pos.x+20{ player1.pos.x -= player1.playermodel.speed}}} + } + fightpve(player1)//优化点:把按键识别放在函数外 + skills(player1,aiplayer) + defend(player1) + jump(player1,aiplayer,phy1) + + // if player1.hp<=0{ + // @wasm4.text("P2 Win!",52,88) + // } + // if aiplayer.hp<=0{ + // ent.scene=Victory} +////////////////////////////////////////////////////////// + // aiplayer.pos.y=jump(124) + + + ai_run() + fightpve(aiplayer) + skills(aiplayer,player1) + defend(aiplayer) + jump(aiplayer,player1,phy2) + if count.x==2{ + if aiplayer.hp<=0{ + sto.story=Sto2} + + + } + else if count.x==3{ + if aiplayer.hp<=0{ + sto.story=Sto3} + } + else if count.x==4{ + if aiplayer.hp<=0{ + sto.story=Sto4} + } + else if count.x==1{ + if aiplayer.hp<=0{ + sto.story=End} + } + if player1.hp<=0{ + lose()} + +} \ No newline at end of file diff --git a/teams/Gameboy/src/jump.mbt b/teams/Gameboy/src/jump.mbt new file mode 100644 index 0000000..e1135fb --- /dev/null +++ b/teams/Gameboy/src/jump.mbt @@ -0,0 +1,63 @@ +let phy1 : Physic = { x_v: 0,y_v:0, g: 10, x: 125.0, t: 0.0 } +let phy2 : Physic = { x_v: 0,y_v:0, g: 10, x: 125.0, t: 0.0 } +fn jump(player:Player,player_:Player,phy:Physic)->Unit{ + if player.ai.ai{if player.playermodel.sprite.data==dragon_sprite.data{} + else{if player_a2.jump_state&¬(player2.ai.think_state){ + if phy.x>=125{phy.x=124 + phy.y_v=-player.playermodel.jump + phy.t=0.0}} + // @wasm4.rect(30, phy.x.to_int(),10,10) + if phy.x<125{ +// @wasm4.text("\{phy.t}",10,10) +// player1.playermodel.demage.fight +// @wasm4.text("\{player_.pos.y}",10,30) + phy.t=0.1 + if player.direction{if player.pos.x+15>player_.pos.x&&player.pos.x-15player_.pos.y-37&&player.pos.y=85{} + else{} + }} + else{if player.pos.x+15>player_.pos.x&&player.pos.x-15player_.pos.y-37&&player.pos.y=125{ + phy.x=125 + } + player.pos.y=phy.x.to_int()}} + + else{if @wasm4.get_gamepad(index=player.key).button_up{ + if phy.x>=125{phy.x=124 + phy.y_v=-player.playermodel.jump + phy.t=0.0}} + // @wasm4.rect(30, phy.x.to_int(),10,10) + if phy.x<125{ +// @wasm4.text("\{phy.t}",10,10) +// @wasm4.text("\{player1.pos.y}",10,20) +// @wasm4.text("\{player_.pos.y}",10,30) + phy.t=0.1 + if player.direction{if player.pos.x+15>player_.pos.x&&player.pos.x-15player_.pos.y-37&&player.pos.y=85{} + else{} + }} + else{if player.pos.x+15>player_.pos.x&&player.pos.x-15player_.pos.y-37&&player.pos.y=125{ + phy.x=125 + } + player.pos.y=phy.x.to_int()} + +} \ No newline at end of file diff --git a/teams/Gameboy/src/lib/hello.mbt b/teams/Gameboy/src/lib/hello.mbt new file mode 100644 index 0000000..2dc5040 --- /dev/null +++ b/teams/Gameboy/src/lib/hello.mbt @@ -0,0 +1,3 @@ +pub fn hello() -> String { + "Hello, world!" +} diff --git a/teams/Gameboy/src/lib/hello_test.mbt b/teams/Gameboy/src/lib/hello_test.mbt new file mode 100644 index 0000000..016976a --- /dev/null +++ b/teams/Gameboy/src/lib/hello_test.mbt @@ -0,0 +1,5 @@ +test "hello" { + if @lib.hello() != "Hello, world!" { + fail!("@lib.hello() != \"Hello, world!\"") + } +} diff --git a/teams/Gameboy/src/lib/moon.pkg.json b/teams/Gameboy/src/lib/moon.pkg.json new file mode 100644 index 0000000..9e26dfe --- /dev/null +++ b/teams/Gameboy/src/lib/moon.pkg.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/teams/Gameboy/src/lib/w4x/gamepad.mbt b/teams/Gameboy/src/lib/w4x/gamepad.mbt new file mode 100644 index 0000000..6187cd7 --- /dev/null +++ b/teams/Gameboy/src/lib/w4x/gamepad.mbt @@ -0,0 +1,49 @@ +pub struct GamePad { + button_1 : Bool + button_2 : Bool + button_left : Bool + button_right : Bool + button_up : Bool + button_down : Bool +} + +pub fn get_gamepad(~index : UInt = 1) -> GamePad { + @wasm4.get_gamepad(~index) |> from +} + +pub fn GamePad::from(pad : @wasm4.GamePad) -> GamePad { + { + button_1: pad.button_1, + button_2: pad.button_2, + button_left: pad.button_left, + button_right: pad.button_right, + button_up: pad.button_up, + button_down: pad.button_down, + } +} + +pub struct PressedPad { + index : UInt + mut previous : GamePad +} + +pub fn PressedPad::new(~index : UInt = 1) -> PressedPad { + { + index, + previous: get_gamepad(~index), + } +} + +pub fn PressedPad::get_pressed_buttons(self : PressedPad) -> GamePad { + let pad = get_gamepad(index=self.index) + let pressed = { + button_1: pad.button_1 && not(self.previous.button_1), + button_2: pad.button_2 && not(self.previous.button_2), + button_left: pad.button_left && not(self.previous.button_left), + button_right: pad.button_right && not(self.previous.button_right), + button_up: pad.button_up && not(self.previous.button_up), + button_down: pad.button_down && not(self.previous.button_down), + } + self.previous = pad + pressed +} diff --git a/teams/Gameboy/src/lib/w4x/moon.pkg.json b/teams/Gameboy/src/lib/w4x/moon.pkg.json new file mode 100644 index 0000000..13aab9d --- /dev/null +++ b/teams/Gameboy/src/lib/w4x/moon.pkg.json @@ -0,0 +1,5 @@ +{ + "import": [ + "moonbitlang/wasm4" + ] + } \ No newline at end of file diff --git a/teams/Gameboy/src/moon.pkg.json b/teams/Gameboy/src/moon.pkg.json new file mode 100644 index 0000000..b719edd --- /dev/null +++ b/teams/Gameboy/src/moon.pkg.json @@ -0,0 +1,20 @@ +{ + "import": [ + "moonbitlang/wasm4", + "moonbit/game/lib/w4x" + + ], + "link": { + "wasm": { + "exports": [ + "start", + "update" + ], + "import-memory": { + "module": "env", + "name": "memory" + }, + "heap-start-address": 6560 + } + } +} \ No newline at end of file diff --git a/teams/Gameboy/src/move.mbt b/teams/Gameboy/src/move.mbt new file mode 100644 index 0000000..ca2d5dd --- /dev/null +++ b/teams/Gameboy/src/move.mbt @@ -0,0 +1,6 @@ +fn move (player1_:Player,player2_:Player)->Unit{ + if player1_.pos.x>player2_.pos.x{player1_.direction=true + player2_.direction=false} + if player2_.pos.x>player1_.pos.x{player2_.direction=true + player1_.direction=false} +} \ No newline at end of file diff --git a/teams/Gameboy/src/music.mbt b/teams/Gameboy/src/music.mbt new file mode 100644 index 0000000..9327d0c --- /dev/null +++ b/teams/Gameboy/src/music.mbt @@ -0,0 +1,98 @@ +struct T{mut t1:Int + t2:Int } +// struct N{i:Int} +// let n:N={i:10} +fn cure()->Unit{@wasm4.tone_note_mode((@wasm4.Note::new(100, bend=0), None), @wasm4.ADSR::new(release=6,5),@wasm4.ADSRVolume::new(100),@wasm4.ToneFlag::new(channel=Triangle))} +fn angry()->Unit{@wasm4.tone_note_mode((@wasm4.Note::new(58, bend=0), None), @wasm4.ADSR::new(release=6,7),@wasm4.ADSRVolume::new(100),@wasm4.ToneFlag::new(channel=Noise))} +fn rush_m()->Unit{@wasm4.tone_note_mode((@wasm4.Note::new(24, bend=0), None), @wasm4.ADSR::new(release=6,1),@wasm4.ADSRVolume::new(100),@wasm4.ToneFlag::new(channel=Pulse1))} + +fn fight_m()->Unit{@wasm4.tone_note_mode((@wasm4.Note::new(60, bend=0), None), @wasm4.ADSR::new(release=6,7),@wasm4.ADSRVolume::new(100),@wasm4.ToneFlag::new(channel=Noise))} +fn fight_s()->Unit{@wasm4.tone_note_mode((@wasm4.Note::new(51, bend=0), None), @wasm4.ADSR::new(release=6,7),@wasm4.ADSRVolume::new(100),@wasm4.ToneFlag::new(channel=Noise))} +fn choiced()->Unit{@wasm4.tone_note_mode((@wasm4.Note::new(60, bend=0), None), @wasm4.ADSR::new(release=6,10),@wasm4.ADSRVolume::new(100),@wasm4.ToneFlag::new(channel=Triangle))} +fn choice1()->Unit{@wasm4.tone_note_mode((@wasm4.Note::new(72, bend=0), None), @wasm4.ADSR::new(release=6,5),@wasm4.ADSRVolume::new(100),@wasm4.ToneFlag::new(channel=Triangle))} +fn choice2()->Unit{@wasm4.tone_note_mode((@wasm4.Note::new(78, bend=0), None), @wasm4.ADSR::new(release=6,5),@wasm4.ADSRVolume::new(100),@wasm4.ToneFlag::new(channel=Triangle))} + +fn noise(i:UInt)->Unit{if n1.t1==0{@wasm4.tone_note_mode((@wasm4.Note::new(60, bend=0), None), @wasm4.ADSR::new(release=6,4),@wasm4.ADSRVolume::new(i),@wasm4.ToneFlag::new(channel=Noise)) +n1.t1+=1} + else if n1.t1==14{@wasm4.tone_note_mode((@wasm4.Note::new(96, bend=0), None), @wasm4.ADSR::new(release=6,4),@wasm4.ADSRVolume::new(i),@wasm4.ToneFlag::new(channel=Noise)) +n1.t1+=1} + else if n1.t1==n1.t2{n1.t1=0} + else{n1.t1+=1}} +fn pulse(j:UInt)->Unit{if p1.t1==0{@wasm4.tone_note_mode((@wasm4.Note::new(72, bend=88), None), @wasm4.ADSR::new(decay=5,7),@wasm4.ADSRVolume::new(j),@wasm4.ToneFlag::new(mode=Duty_1_4,channel=Pulse1)) +p1.t1+=1} + else if p1.t1==14{@wasm4.tone_note_mode((@wasm4.Note::new(72, bend=88), None), @wasm4.ADSR::new(decay=5,7),@wasm4.ADSRVolume::new(j),@wasm4.ToneFlag::new(mode=Duty_1_4,channel=Pulse1)) +p1.t1+=1} + else if p1.t1==27{@wasm4.tone_note_mode((@wasm4.Note::new(80, bend=88), None), @wasm4.ADSR::new(decay=5,7),@wasm4.ADSRVolume::new(j),@wasm4.ToneFlag::new(mode=Duty_1_4,channel=Pulse1)) +p1.t1+=1} + else if p1.t1==41{@wasm4.tone_note_mode((@wasm4.Note::new(79, bend=88), None), @wasm4.ADSR::new(decay=5,7),@wasm4.ADSRVolume::new(j),@wasm4.ToneFlag::new(mode=Duty_1_4,channel=Pulse1)) +p1.t1+=1} + else if p1.t1==54{@wasm4.tone_note_mode((@wasm4.Note::new(72, bend=88), None), @wasm4.ADSR::new(decay=5,7),@wasm4.ADSRVolume::new(j),@wasm4.ToneFlag::new(mode=Duty_1_4,channel=Pulse1)) +p1.t1+=1} + else if p1.t1==80{@wasm4.tone_note_mode((@wasm4.Note::new(72, bend=88), None), @wasm4.ADSR::new(decay=5,7),@wasm4.ADSRVolume::new(j),@wasm4.ToneFlag::new(mode=Duty_1_4,channel=Pulse1)) +p1.t1+=1} + else if p1.t1==75{@wasm4.tone_note_mode((@wasm4.Note::new(70, bend=88), None), @wasm4.ADSR::new(decay=5,14),@wasm4.ADSRVolume::new(j),@wasm4.ToneFlag::new(mode=Duty_1_4,channel=Pulse1)) +p1.t1+=1} + else if p1.t1==94{@wasm4.tone_note_mode((@wasm4.Note::new(79, bend=88), None), @wasm4.ADSR::new(decay=5,14),@wasm4.ADSRVolume::new(j),@wasm4.ToneFlag::new(mode=Duty_1_4,channel=Pulse1)) +p1.t1+=1} + else if p1.t1==108{@wasm4.tone_note_mode((@wasm4.Note::new(72, bend=88), None), @wasm4.ADSR::new(decay=5,14),@wasm4.ADSRVolume::new(j),@wasm4.ToneFlag::new(mode=Duty_1_4,channel=Pulse1)) +p1.t1+=1} + else if p1.t1==135{@wasm4.tone_note_mode((@wasm4.Note::new(80, bend=88), None), @wasm4.ADSR::new(decay=5,14),@wasm4.ADSRVolume::new(j),@wasm4.ToneFlag::new(mode=Duty_1_4,channel=Pulse1)) +p1.t1+=1} + else if p1.t1==149{@wasm4.tone_note_mode((@wasm4.Note::new(79, bend=88), None), @wasm4.ADSR::new(decay=5,14),@wasm4.ADSRVolume::new(j),@wasm4.ToneFlag::new(mode=Duty_1_4,channel=Pulse1)) +p1.t1+=1} + else if p1.t1==162{@wasm4.tone_note_mode((@wasm4.Note::new(72, bend=88), None), @wasm4.ADSR::new(decay=5,14),@wasm4.ADSRVolume::new(j),@wasm4.ToneFlag::new(mode=Duty_1_4,channel=Pulse1)) +p1.t1+=1} + else if p1.t1==182{@wasm4.tone_note_mode((@wasm4.Note::new(70, bend=88), None), @wasm4.ADSR::new(decay=5,20),@wasm4.ADSRVolume::new(j),@wasm4.ToneFlag::new(mode=Duty_1_4,channel=Pulse1)) +p1.t1+=1} + else if p1.t1==203{@wasm4.tone_note_mode((@wasm4.Note::new(79, bend=88), None), @wasm4.ADSR::new(decay=5,14),@wasm4.ADSRVolume::new(j),@wasm4.ToneFlag::new(mode=Duty_1_4,channel=Pulse1)) +p1.t1+=1} + else if p1.t1==216{p1.t1=0} + else {p1.t1+=1}} +fn pulse1(j:UInt)->Unit{if p1.t1==0{@wasm4.tone_note_mode((@wasm4.Note::new(82, bend=0), None), @wasm4.ADSR::new(decay=5,41),@wasm4.ADSRVolume::new(j),@wasm4.ToneFlag::new(mode=Duty_1_4,channel=Pulse1)) +p1.t1+=1} + else if p1.t1==55{@wasm4.tone_note_mode((@wasm4.Note::new(80, bend=0), None), @wasm4.ADSR::new(decay=5,14),@wasm4.ADSRVolume::new(j),@wasm4.ToneFlag::new(mode=Duty_1_4,channel=Pulse1)) +p1.t1+=1} + else if p1.t1==82{@wasm4.tone_note_mode((@wasm4.Note::new(75, bend=0), None), @wasm4.ADSR::new(decay=5,41),@wasm4.ADSRVolume::new(j),@wasm4.ToneFlag::new(mode=Duty_1_4,channel=Pulse1)) +p1.t1+=1} + else if p1.t1==137{@wasm4.tone_note_mode((@wasm4.Note::new(73, bend=0), None), @wasm4.ADSR::new(decay=5,68),@wasm4.ADSRVolume::new(j),@wasm4.ToneFlag::new(mode=Duty_1_4,channel=Pulse1)) +p1.t1+=1} + else if p1.t1==219{@wasm4.tone_note_mode((@wasm4.Note::new(82, bend=0), None), @wasm4.ADSR::new(decay=5,41),@wasm4.ADSRVolume::new(j),@wasm4.ToneFlag::new(mode=Duty_1_4,channel=Pulse1)) +p1.t1+=1} + else if p1.t1==274{@wasm4.tone_note_mode((@wasm4.Note::new(80, bend=0), None), @wasm4.ADSR::new(decay=5,14),@wasm4.ADSRVolume::new(j),@wasm4.ToneFlag::new(mode=Duty_1_4,channel=Pulse1)) +p1.t1+=1} + else if p1.t1==301{@wasm4.tone_note_mode((@wasm4.Note::new(75, bend=0), None), @wasm4.ADSR::new(decay=5,42),@wasm4.ADSRVolume::new(j),@wasm4.ToneFlag::new(mode=Duty_1_4,channel=Pulse1)) +p1.t1+=1} + else if p1.t1==357{@wasm4.tone_note_mode((@wasm4.Note::new(78, bend=0), None), @wasm4.ADSR::new(decay=5,68),@wasm4.ADSRVolume::new(j),@wasm4.ToneFlag::new(mode=Duty_1_4,channel=Pulse1)) +p1.t1+=1} + else if p1.t1==432{p1.t1=0} + else {p1.t1+=1}} +fn triangle(i:UInt)->Unit{ + if t1.t1==0{@wasm4.tone_note_mode((@wasm4.Note::new(36, bend=0), None),@wasm4.ADSR::new(release=1,14),@wasm4.ADSRVolume::new(50),@wasm4.ToneFlag::new(channel=Triangle)) +t1.t1+=1} + else if t1.t1==27{t1.t1=0} + else{t1.t1+=1}} +// let a:Bytes=demo.w4on2 +let t1:T={t1:0,t2:27} +let n1:T={t1:0,t2:27} +let p1:T={t1:0,t2:216} +let en:T={t1:0,t2:216} +fn bgm(i:UInt,j:UInt)->Unit{ + triangle(i) + noise(i) + pulse(j)} + +fn bgm1(i:UInt,j:UInt)->Unit{ + pulse1(j)} +fn bgm2(i:UInt,j:UInt)->Unit{ + noise(i) + pulse(j)} +fn end()->Unit{ +en.t1=0 +if p1.t1==0{@wasm4.tone_note_mode((@wasm4.Note::new(48, bend=0), None), @wasm4.ADSR::new(decay=5,41),@wasm4.ADSRVolume::new(50),@wasm4.ToneFlag::new(mode=Duty_1_4,channel=Pulse2)) +en.t1+=1} + else if p1.t1==55{@wasm4.tone_note_mode((@wasm4.Note::new(42, bend=0), None), @wasm4.ADSR::new(decay=5,41),@wasm4.ADSRVolume::new(50),@wasm4.ToneFlag::new(mode=Duty_1_4,channel=Pulse2)) +en.t1+=1} + else if p1.t1==110{@wasm4.tone_note_mode((@wasm4.Note::new(45, bend=0), None), @wasm4.ADSR::new(decay=5,41),@wasm4.ADSRVolume::new(50),@wasm4.ToneFlag::new(mode=Duty_1_4,channel=Pulse2)) +en.t1+=1} + else if p1.t1==165{@wasm4.tone_note_mode((@wasm4.Note::new(38, bend=0), None), @wasm4.ADSR::new(decay=5,41),@wasm4.ADSRVolume::new(50),@wasm4.ToneFlag::new(mode=Duty_1_4,channel=Pulse2)) +en.t1+=1}} diff --git a/teams/Gameboy/src/player.mbt b/teams/Gameboy/src/player.mbt new file mode 100644 index 0000000..74c83b0 --- /dev/null +++ b/teams/Gameboy/src/player.mbt @@ -0,0 +1,48 @@ +pub struct Player { + mut ai:Ai + mut if_defend:Bool + p:Bool + key:UInt + mut state:Int//0:无状态,1:冲击状态,2:治疗状态,3:中毒状态,4待定 + mut pos : Point + mut hp:Int + mut f_state:Point + mut f_live:Bool + mut demage:Demage + mut cd:Character_cd + // mut mp :Int + mut direction : Bool + // mut fight_cd :Int + // mut skill_cd :Int + mut playermodel:PlayerModel +} +struct Demage { + mut fight:Int + skill:Int +} +pub struct PlayerModel{ + mut sprite:Sprite + hp:Int + speed:Int + skill:Skills + fight:Fights + cd:Character_cd + demage:Demage + jump:Double +} + +let tanker_model:PlayerModel={sprite:tanker_sprite,hp:48,speed:2,skill:Dash,fight:Bullet,cd:tanker_cd,demage:{fight:10,skill:20},jump:10} +let stive_model:PlayerModel={sprite:stive_sprite,hp:30,speed:1,skill:Fly,fight:Fist,cd:stive_cd,demage:{fight:5,skill:1},jump:41} +let scientist_model:PlayerModel={sprite:scientist_sprite,hp:25,speed:1,skill:Cure,fight:Bottle,cd:scentist_cd,demage:{fight:5,skill:3},jump:40} +let knight_model:PlayerModel={sprite:knight_sprite,hp:40,speed:1,skill:Angry,fight:Poke,cd:knight_cd,demage:{fight:8,skill:10},jump:30} +let tree_model:PlayerModel={sprite:tree_sprite,hp:40,speed:1,skill:Angry,fight:Fist,cd:ai_cd,demage:{fight:8,skill:10},jump:30} +let pig_model:PlayerModel={sprite:pig_sprite,hp:20,speed:1,skill:Angry,fight:Fist,cd:ai_cd,demage:{fight:1,skill:10},jump:10} +let mo_model:PlayerModel={sprite:mo_sprite,hp:40,speed:1,skill:Cure,fight:Poke,cd:ai_cd,demage:{fight:10,skill:10},jump:20} +let dra_model:PlayerModel={sprite:dragon_sprite,hp:100,speed:1,skill:Angry,fight:Poke,cd:ai_cd,demage:{fight:8,skill:10},jump:30} + +enum Fights { + Bullet + Fist + Poke + Bottle +} \ No newline at end of file diff --git a/teams/Gameboy/src/skills.mbt b/teams/Gameboy/src/skills.mbt new file mode 100644 index 0000000..6434466 --- /dev/null +++ b/teams/Gameboy/src/skills.mbt @@ -0,0 +1,218 @@ +enum Skills { + Dash + Cure + Fly + Angry +} + +struct Rush { + mut t1_1 : Bool + mut t1_2 : Bool + mut t2 : Bool +} + +let rush : Rush = { t1_1: true, t1_2: true, t2: true} + +fn skills(player : Player, player_ : Player) -> Unit { + if player.cd.s2_cd == player.cd.s1_cd { + player.cd.s2_cd = 0 + } else if player.cd.s2_cd == 0 { + // else if player.cd.s2_cd == 1 {} + } else { + player.cd.s2_cd += 1 + } + match player.playermodel.skill { + Dash =>{ + if player.ai.ai { + if player.p { + if player.state == 0 { + if player.direction { + rush.t1_1 = true + } else { + rush.t1_1 = false + } + } + if player_a2.skill_state && not(player2.ai.think_state) { + if player.cd.s2_cd == 0 { + player.cd.s2_cd += 1 + player.state = 1 + } + } + + } else { + if player.state == 0 { + if player.direction { + rush.t1_2 = true + } else { + rush.t1_2 = false + } + } + if player_a2.skill_state && not(player2.ai.think_state) { + if player.cd.s2_cd == 0 { + player.cd.s2_cd += 1 + player.state = 1 + } + } + + } + } else if player.p { + if player.state == 0 { + if player.direction { + rush.t1_1 = true + } else { + rush.t1_1 = false + } + } + if @wasm4.get_gamepad(index=player.key).button_2 && + not(@wasm4.get_gamepad(index=player.key).button_down) { + if player.cd.s2_cd == 0 { + player.cd.s2_cd += 1 + player.state = 1 + } + } + if player.state == 1 { + rush_m() + if rush.t1_1 { + player.pos.x -= 4 + } else { + player.pos.x += 4 + } + dash(player, player_) + } + } else { + if player.state == 0 { + if player.direction { + rush.t1_2 = true + } else { + rush.t1_2 = false + } + } + if @wasm4.get_gamepad(index=player.key).button_2 && + not(@wasm4.get_gamepad(index=player.key).button_down) { + if player.cd.s2_cd == 0 { + player.cd.s2_cd += 1 + player.state = 1 + } + } + if player.state == 1 { + rush_m() + if rush.t1_2 { + player.pos.x -= 4 + } else { + player.pos.x += 4 + } + dash(player, player_) + } + }} + Cure =>{ + if player.ai.ai { + if player_a2.skill_state && not(player2.ai.think_state) { + if player.cd.s2_cd == 0 { + player.cd.s2_cd += 1 + player.state = 2 + } + } + + } else { + if @wasm4.get_gamepad(index=player.key).button_2 && + not(@wasm4.get_gamepad(index=player.key).button_down) { + if player.cd.s2_cd == 0 { + player.cd.s2_cd += 1 + player.state = 2 + } + } + + } + if player.state == 2 { + if player.hp < 25 { + cure() + if player.hp <= 22 { + player.hp += player.demage.skill + } else { + player.hp = 25 + } + } + player.state = 0 + }} + Fly => + if player.ai.ai { + if not(player.f_live) { + if player_a2.skill_state && not(player2.ai.think_state) { + // if player.f_live{player.pos.x=player.f_state.x + // player.pos.y=player.f_state.y} + if player.cd.s2_cd == 0 { + player.cd.s2_cd += 1 + player.f_state.x = player.pos.x + player.f_state.y = player.pos.y + player.f_live = true + } + } + } else if player_a2.skill_state && not(player2.ai.think_state) { + if player.cd.s2_cd == 0 { + player.cd.s2_cd += 1 + player.pos.x = player.f_state.x + player.pos.y = player.f_state.y + player.f_live = false + } + } + if player.f_live { + @wasm4.rect(player.f_state.x + 8, player.f_state.y + 30, 5, 5) + } + } else { + if not(player.f_live) { + if @wasm4.get_gamepad(index=player.key).button_2 && + not(@wasm4.get_gamepad(index=player.key).button_down) { + // if player.f_live{player.pos.x=player.f_state.x + // player.pos.y=player.f_state.y} + if player.cd.s2_cd == 0 { + player.cd.s2_cd += 1 + player.f_state.x = player.pos.x + player.f_state.y = player.pos.y + player.f_live = true + } + } + } else if @wasm4.get_gamepad(index=player.key).button_2 && + not(@wasm4.get_gamepad(index=player.key).button_down) { + if player.cd.s2_cd == 0 { + player.cd.s2_cd += 1 + player.pos.x = player.f_state.x + player.pos.y = player.f_state.y + player.f_live = false + } + } + if player.f_live { + @wasm4.rect(player.f_state.x + 8, player.f_state.y + 30, 5, 5) + } + } + Angry => + if player.ai.ai { + // @wasm4.text("Power:\{player.demage.fight}",player.pos.x-16 , player.pos.y -10 ) + if player_a2.skill_state && not(player2.ai.think_state) { + if player.cd.s2_cd == 0 { + player.cd.s2_cd += 1 + player.state = 1 + } + } + if player.state == 1 { + angry() + player.hp = player.hp / 2 + player.demage.fight += 10 + player.state = 0 + } + } else { + if @wasm4.get_gamepad(index=player.key).button_2 && + not(@wasm4.get_gamepad(index=player.key).button_down) { + if player.cd.s2_cd == 0 { + player.cd.s2_cd += 1 + player.state = 1 + } + } + if player.state == 1 { + angry() + player.hp = player.hp / 2 + player.demage.fight += 10 + player.state = 0 + } + } + } +} diff --git a/teams/Gameboy/src/smart.mbt b/teams/Gameboy/src/smart.mbt new file mode 100644 index 0000000..3738def --- /dev/null +++ b/teams/Gameboy/src/smart.mbt @@ -0,0 +1,14 @@ +// fn prob(player_ture:Player,ai_player:Player)->Unit{ +// if ai_player.direction{//移动 +// if ai_player.pos.x>=player_ture.pos.x+90{ai_player.ai.prob.prob4=80}} +// else{if ai_player.pos.x<=player_ture.pos.x-70{ai_player.ai.prob.prob4=80}} +// if ai_player.direction{//攻击 +// if ai_player.pos.x<=player_ture.pos.x+70{ai_player.ai.prob.prob2=50}} +// else{if ai_player.pos.x>=player_ture.pos.x-50{ai_player.ai.prob.prob2=50}} +// if ai_player.direction{//防御 +// if ai_player.pos.x<=player_ture.pos.x+50{ai_player.ai.prob.prob3=30}} +// else{if ai_player.pos.x>=player_ture.pos.x-30{ai_player.ai.prob.prob3=30}} +// if ai_player.direction{//技能 +// if ai_player.pos.x<=player_ture.pos.x+70{ai_player.ai.prob.prob1=20}} +// else{if ai_player.pos.x>=player_ture.pos.x-50{ai_player.ai.prob.prob1=20}} +// } \ No newline at end of file diff --git a/teams/Gameboy/src/sprite.mbt b/teams/Gameboy/src/sprite.mbt new file mode 100644 index 0000000..1412815 --- /dev/null +++ b/teams/Gameboy/src/sprite.mbt @@ -0,0 +1,94 @@ +struct Sprite { + data : Bytes + width : Int + height : Int +} +// enum Character{ +// Stive +// } +// let player_sprite : Sprite =match{ + +// } +let shenwei_sprite :Sprite = { + data: b"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0c\x08\x00\x28\x02\xc0\x22\x04\x00\x00\x06\x08\x00\x24\xf2\x63\xff\xf6\x7f\x80\x00\xff\x1f\xfe\x17\xf8\x22\x83\x40\x80\x1f\x89\x10\x20\x94\x42\x00\xa0\x40\x80\x02\x89\x10\x20\x94\x42\xff\xf8\x40\x80\x06\x89\x1f\xa4\xd4\x42\xbe\x86\x7f\x80\x04\xff\x12\x24\x67\xfb\xa4\xa2\x40\x80\x0f\x89\x1f\xac\x64\x40\xa4\xa0\x40\x80\x15\x89\x14\x98\x24\x43\xbe\xc2\x7f\x80\x14\xff\x14\x98\x67\xf8\xa2\xc2\x40\x80\x04\x89\x37\x12\x54\x40\xbe\x86\x40\x80\x04\x08\x23\xb2\xd4\x41\xa5\x96\x40\x80\x04\x08\x26\xea\x97\xfa\xa5\x54\x7f\x80\x04\x08\x68\xce\x94\x02\xbe\x74\x40\x80\x00\x00\x00\x00\x00\x00\x00\x20\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", + width: 80, + height: 30, +} +let p1_sprite :Sprite = { + data: b"\x00\x00\x23\xec\x22\x24\x22\x24\x23\xe4\xfa\x04\x72\x04\x22\x0e", + width: 16, + height: 8, +} +let p2_sprite :Sprite = { + data: b"\x23\xef\x72\x21\xfa\x21\x23\xef\x22\x08\x22\x08\x22\x0f\x00\x00", + width: 16, + height: 8, +} +let mo_sprite :Sprite = { + data: b"\x00\xff\x00\x00\xff\x00\x00\xff\x00\x00\xcc\x00\x00\xff\x00\x00\xff\x00\x00\xff\x00\x0f\xff\xf0\x0f\xff\xf0\x0f\xff\xf0\x0f\xff\xf0\x0e\xff\x70\x0e\xff\x70\x0e\xff\x70\x0e\xff\x70\x0e\xff\x70\x0e\xff\x70\x0e\xff\x70\x0e\xff\x70\x0e\xe7\x70\x0e\xe7\x70\x0e\xe7\x70\x00\xe7\x00\x00\xe7\x00\x00\xe7\x00\x00\xe7\x00\x00\xe7\x00\x00\xe7\x00\x00\xe7\x00\x00\xe7\x00\x00\xe7\x00\x00\xe7\x00\x00\xe7\x00\x00\xe7\x00\x00\xe7\x00", + width: 35, + height: 24, +} +let pig_sprite :Sprite = { + data: b"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\x08\x00\x00\x00\x55\x54\x00\x00\x00\xc5\x4e\xaa\xaa\xa8\x6a\xa6\x55\x55\x59\x66\x66\x55\x55\x59\x6a\xa6\x55\x55\x58\x55\x56\x55\x55\x58\x00\x02\x55\x55\x58\x00\x02\xaa\xaa\xa8\x00\x00\x58\x05\x80\x00\x00\x58\x05\x80\x00\x00\x58\x05\x80\x00\x00\x58\x05\x80\x00\x00\xfc\x0f\xc0", + width: 35, + height: 20, +} +let tree_sprite :Sprite = { + data: b"\x00\x82\x08\x20\x80\x02\xaa\xaa\xaa\x00\x02\xaa\xaa\xaa\xa0\x0a\xaa\xaa\xaa\x80\x00\xa6\x99\x62\x00\x0a\x86\x5a\xaa\xaa\x02\xaa\x59\x9a\xa8\x28\x29\x6a\x92\xa8\xa0\x2f\xea\xfa\xa8\xa0\xaa\xaa\x6a\xa8\x22\xaa\xa6\x50\xaa\x2a\x86\x96\x98\x2a\xa2\xaa\xaa\x9a\xa0\xaa\xa9\x96\xaa\xa0\xa8\x2a\xaa\xa0\xa0\x02\xaf\xbf\xe8\x28\x0a\x2a\xaa\xaa\xa0\x0a\xa6\xaa\x90\x28\x28\x0a\xaa\xa8\x02\x00\xaa\x65\x5a\xa8\x02\x85\x55\x50\x0a\x00\x05\x55\x50\x00\x00\x0f\xff\xf0\x00\x00\x05\x55\x50\x00\x00\x05\x55\x50\x00\x00\x05\x55\x50\x00\x00\x05\x55\x50\x00\x00\x05\x55\x50\x00\x00\x0f\xff\xf0\x00\x00\x05\x55\x50\x00\x00\x05\x55\x50\x00\x00\x05\x55\x50\x00\x00\x05\x55\x50\x00\x00\x05\x55\x50\x00\x00\x05\x55\x50\x00", + width: 35, + height: 20, +} +let dragon_sprite :Sprite = { + data: b"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0f\xff\x03\xff\xc0\x00\x00\x00\x00\x00\x00\x00\x0f\xff\x03\xff\xc0\x00\x00\x00\x00\x00\x00\x00\x0f\xff\x03\xff\xc0\x00\x00\x00\x00\x00\x00\x00\x0f\xff\x03\xff\xc0\x00\x00\x00\x00\x00\x00\x00\x0f\xff\x03\xff\xc0\x00\x00\x00\x00\x00\x00\x00\x0f\xff\x03\xff\xc0\x00\x00\x00\x00\x00\x00\x00\x05\x55\x55\x55\x40\x00\x00\x00\x00\x00\x00\x00\x0f\xff\xff\xff\xc0\x00\x00\x00\x00\x00\x00\x00\x0f\xff\xff\xff\xc0\x00\x00\x00\x00\x00\x00\x00\x3f\xff\xff\xff\xc0\x00\x00\x00\x00\x00\x00\x00\x3f\xff\xff\xff\xc0\x00\x00\x00\x00\x00\x00\x00\x3f\xff\xf5\x7f\xff\xff\xff\x03\xc0\x3c\x00\x00\x3f\xff\xf6\x7f\xfb\xef\xbe\x03\xc0\x3c\x3f\xff\xff\xff\xf5\x7f\xfe\xfb\xef\x01\xc0\x1c\x3f\xff\xff\xff\xff\xff\xfb\xef\xbe\x3f\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x3f\xff\xff\xff\xff\xff\xff\xff\xff\xfb\xef\xbe\x3f\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xfb\xef\x3f\xff\xff\xff\xff\xff\xff\xff\xff\xfb\xef\xbe\x3f\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x3f\xff\xff\xff\xff\xaf\xff\xff\xff\xfb\xef\xbe\x3f\xff\xff\xff\xff\xef\xff\xff\xff\xfe\xfb\xef\x15\x15\x15\xff\xff\xaf\xff\xff\xff\xfb\xef\xbe\x04\x04\x04\xff\xff\xff\xff\xea\xff\xff\xff\xff\x3f\xff\xff\xff\xff\xff\xff\xfe\xff\xfb\xef\xbe\x3f\xff\xff\xff\xff\xff\xff\xea\xff\xfe\xfb\xef\x3f\xff\xff\xff\xff\xff\xff\xff\xff\xfb\xef\xbe\x3f\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x3f\xff\xff\xff\xff\xff\xf0\x00\x00\x00\x00\x00\x3f\xff\xff\xff\xff\xff\xf0\x00\x00\x00\x00\x00\x3f\xff\xff\xff\xff\xff\xf0\x00\x00\x00\x00\x00\x3f\xff\xff\xff\xff\xff\xf0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", + width: 50, + height: 48, +} +let stive_sprite : Sprite = { + data: b"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0f\xff\xf0\x00\x00\x0f\xff\xf0\x00\x00\x0d\x55\x50\x00\x00\x05\x55\x50\x00\x00\x05\x35\x30\x00\x00\x05\x55\x50\x00\x00\x05\x75\x50\x00\x00\x05\x7f\xd0\x00\x0f\xfd\x55\x7f\xf0\x0f\xff\x55\xff\xf0\x0f\xff\xff\xff\xf0\x0f\xff\xff\xff\xf0\x05\x4f\xff\xf1\x50\x05\x4f\xff\xf1\x50\x05\x4f\xff\xf1\x50\x05\x4f\xff\xf1\x50\x05\x4f\xff\xf1\x50\x05\x4f\xff\xf1\x50\x05\x4a\xbe\xe1\x50\x05\x4f\xff\xf1\x50\x00\x0a\xaa\xa0\x00\x00\x0a\xaa\xa0\x00\x00\x0a\x82\xa0\x00\x00\x0a\x82\xa0\x00\x00\x0a\x82\xa0\x00\x00\x0a\x82\xa0\x00\x00\x0a\x82\xa0\x00\x00\x0a\x82\xa0\x00\x00\x0a\x82\xa0\x00\x00\x0a\x82\xa0\x00\x00\x05\x41\x50\x00\x00\x05\x41\x50\x00", + width: 20, + height: 35, +} +let knight_sprite : Sprite = { + data: b"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xc0\x30\x00\x00\x00\xf0\xf0\x00\x00\x3f\xff\xfc\x00\x00\x35\x55\x5c\x00\x00\x35\x55\x5c\x00\x00\x35\xff\xfc\x00\x00\x35\x5f\x5c\x00\x00\x35\x5f\x5c\x00\x00\x35\x5f\x5c\x00\x00\x3f\xff\xfc\x00\x3f\x02\xaa\x80\xfc\x35\xff\xff\xff\x5c\x35\xd5\x55\x57\x5c\x05\xd5\xaa\x57\x50\x05\xd6\x0c\x97\x50\x05\xd8\x0c\x27\x50\x05\xd8\x0c\x27\x50\x05\xdb\xff\xe7\x50\x05\xd8\x0c\x27\x50\x0f\xd8\x0c\x27\xf0\x0f\xd8\x0c\x27\xf0\x00\xd6\x0c\x97\x00\x00\xd5\xaa\x57\x00\x00\xd5\x55\x57\x00\x00\xd5\x55\x57\x00\x00\xff\xff\xff\x00\x00\x3f\x00\x3f\x00\x00\x3f\x00\x3f\x00\x00\x3f\x00\x3f\x00\x00\x3c\x00\x3c\x00\x00\x3c\x00\x3c\x00", + width: 20, + height: 35, +} +let tanker_sprite : Sprite = { + data: b"\x00\x2a\xaa\x00\x00\x00\x95\xf9\x80\x00\x00\x9a\xf9\x80\x00\x02\x9a\xa9\x90\x0f\x02\x95\x55\x9a\xaf\x02\xaa\xaa\x9a\xaf\x00\xa5\x55\x90\x0f\x00\x2a\xa9\x80\x00\x00\x0f\xff\x00\x00\x00\x0f\xff\x00\x00\x01\x55\x55\x55\x00\x01\x65\x55\x55\x00\x01\x67\xfd\x55\x00\x01\x67\xfd\x55\x00\x01\x67\xfd\x55\x00\x01\x67\xfd\x55\x00\x01\x65\xf5\x55\x00\x01\x65\xf5\x55\x00\x01\x95\xf5\x55\x00\x01\x95\xf5\xf5\x00\x01\x95\xff\xf5\x00\x01\x95\xff\xf5\x00\x01\x95\x55\xf5\x00\x01\x95\x55\x55\x00\x01\xaa\xaa\x95\x00\x01\x55\x55\x55\x00\x00\x55\x55\x54\x00\x00\x3f\xff\xf0\x00\x00\x55\x55\x54\x00\x01\x55\x55\x55\x00\x0a\xaa\xaa\xaa\x80\x2f\xef\xef\xef\xe0\x2d\xed\xed\xed\xe0\x2f\xef\xef\xef\xe0\x0a\xaa\xaa\xaa\x80", + width: 20, + height: 35, +} +let scientist_sprite : Sprite = { + data: b"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x3f\xff\xf0\x00\x03\xfc\x3c\x30\x00\x03\xff\xff\xfc\x00\x03\x55\x55\x5c\x00\x03\x5f\xdf\xdc\x00\x03\x55\xd5\xdc\x00\x03\x55\x5d\x5c\x00\x03\x55\x55\x5c\x00\x00\xd5\x7f\x70\x00\x00\xf5\x55\xf0\x00\x00\x0f\xff\x00\x00\xfc\x3c\x03\x03\xf0\xd7\xfc\x03\xfd\x70\x17\x00\x00\x0d\x40\x17\x00\x0c\x0d\x40\x17\x00\x00\x0d\x40\x17\x00\x00\x0d\x40\x17\x00\x0c\x0d\x40\x17\x00\x00\x0d\x40\x3f\x00\x00\x0f\xd5\x3f\x00\x0c\x0f\xc4\x03\xff\x00\xfc\x15\x03\xeb\x00\xec\x1d\x03\xff\x0c\xfc\x15\x03\x00\x00\x0c\x00\x03\x00\x00\x0c\x00\x03\xff\xff\xfc\x00\x00\xfc\x03\xf0\x00\x00\xfc\x03\xf0\x00\x00\xfc\x03\xf0\x00\x00\xf0\x03\xc0\x00\x00\xf0\x03\xc0\x00", + width: 20, + height: 35, +} +let background : Sprite = { + data: b"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xaa\xaa\xaa\xa8\x00\x00\x00\x00\x00\x03\xff\xff\xff\xfc\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x3f\xff\xff\xff\xf0\x00\x00\x00\x00\x00\x02\xaa\xaa\xaa\xaa\x80\x00\x00\x00\x00\x03\xff\xff\xff\xfc\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x3f\xff\xff\xff\xfc\x00\x00\x00\x00\x00\x03\xff\xff\xff\xff\xe8\x00\x00\x00\x00\x03\xff\xff\xff\xfc\x00\x00\x00\x00\x00\x00\x03\xc0\x00\x3c\x00\x00\x00\x00\x3f\xff\xc0\x3f\x00\xff\x00\x00\x00\x00\x00\x2a\xaa\xaa\xaa\xaa\xa8\x00\x00\x00\x00\x03\xff\xff\xff\xfc\x00\x00\x00\x00\x00\x00\x03\xc0\x00\x3c\x00\x00\x00\x00\x3f\xff\xc0\x3f\x00\xff\x00\x00\x00\x00\x00\x2a\xaa\x95\x55\x55\xa8\x00\x00\x00\x00\x03\xff\xff\xff\xfc\x00\x00\x00\x00\x00\x00\x03\xfc\x03\xfc\x00\x00\x00\x00\x3f\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x2a\xaa\x95\x55\x55\xa8\x00\x00\x00\x00\x03\xff\xff\xff\xfc\x00\x00\x00\x00\x00\x00\x03\xfc\x03\xfc\x00\x00\x00\x00\x3f\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x2a\x6a\x96\xaa\xa5\xa8\x00\x00\x00\x00\x01\x55\x55\x55\x54\x00\x00\x00\x00\x00\x3f\xff\xff\xff\xff\xc0\x00\x00\x00\x3d\x55\x55\x55\x55\x55\x00\x00\x00\x00\x00\x2a\x6a\x97\xff\xf5\xa8\x00\x00\x00\x00\x01\x55\x55\x55\x54\x00\x00\x00\x00\x00\x3f\xff\xff\xff\xff\xc0\x00\x00\x00\x3d\x55\x55\x55\x55\xff\x00\x00\x00\x00\x00\x2a\x6a\x97\xff\xf5\xa8\x00\x00\x00\x00\x01\x55\x55\x54\x3c\x00\x00\x00\x00\x00\x3d\x55\x55\x55\x55\x40\x00\x00\x00\x3d\x55\x55\x55\x55\xff\x00\x00\x00\x00\x00\x2a\x6a\x96\xaa\xa5\xa8\x00\x00\x00\x00\x01\x55\x55\x54\x3c\x00\x00\x00\x00\x00\x3d\x55\x55\x55\xff\xc0\x00\x00\x00\x3d\x55\x55\x55\x55\x55\x00\x00\x00\x00\x00\x2a\xaa\x95\x55\x55\xa8\x00\x00\x00\x00\x01\x55\x55\x55\x54\x00\x00\x00\x00\x00\x3d\x55\x55\x55\xff\xc0\x00\x00\x00\x3d\x55\x55\x55\x55\x5f\x00\x00\x00\x00\x00\x00\xaa\xaa\xaa\xaa\x00\x00\x00\x00\x00\x01\x55\x55\x55\x54\x00\x00\x00\x00\x00\x3d\x55\x55\x55\x57\xc0\x00\x00\x00\x3d\x55\x55\x55\x55\x5f\x00\x00\x00\x00\x00\x00\x0f\xff\xff\xf0\x00\x00\x00\x00\x00\x01\x55\x55\x55\x7c\x00\x00\x00\x00\x00\x3d\x55\x55\x55\x57\xc0\x00\x00\x00\x3d\x55\x55\x55\x55\x55\x00\x00\x00\x00\x00\x00\x0f\xff\xff\xf0\x00\x00\x00\x00\x00\x01\x55\x55\x55\x7c\x00\x00\x00\x00\x00\x3d\x55\x55\x55\x57\xc0\x00\x00\x00\x3d\x55\x55\x55\x55\x55\x00\x00\x00\x00\x00\x00\x0f\xff\xff\xf0\x00\x00\x00\x00\x00\x01\x55\x55\x55\x54\x00\x00\x00\x00\x00\x3d\x55\x55\x55\x57\xc0\x00\x00\x00\x3d\x55\x55\x55\x55\x55\x00\x00\x00\x00\x05\x55\x55\x55\x55\x55\x55\x00\x00\x00\x00\x01\x55\x55\x55\x54\x00\x00\x00\x00\x00\x3d\x55\x55\x55\x57\xc0\x00\x00\x00\x3d\x55\x55\x55\x55\x55\x00\x00\x00\x00\x05\x55\x55\x55\x55\x55\x55\x00\x00\x03\xff\xff\xff\xff\xff\xff\xff\xfc\x00\x00\x00\x3d\x55\x55\x55\x57\xc0\x00\x00\x00\x03\xd5\x55\x55\x55\x54\x00\x00\x00\x00\x05\x55\x55\x55\x55\x5a\x55\x00\x00\x03\xff\xff\xff\xff\xff\xff\xff\xfc\x00\x00\x00\x3d\x55\x55\x55\x55\x40\x00\x00\x00\x03\xd5\x55\x55\x55\x54\x00\x00\x00\x00\x05\x55\x55\x55\x55\x5a\x55\x00\x00\x03\xff\xff\xff\xff\xff\xff\xff\xfc\x00\x00\x00\x3d\x55\x55\x55\x55\x40\x00\x00\x00\x03\xfd\x55\x55\x55\x50\x00\x00\x00\x00\x05\x55\x55\xff\xff\x5a\x55\x00\x00\x03\xff\xff\xff\xff\xff\xff\xff\xfc\x00\x00\x00\x3d\x55\x55\x55\x55\x40\x00\x00\x00\x03\xfd\x55\x55\x55\x50\x00\x00\x00\x00\x05\x55\x55\xff\xff\x5a\x55\x00\x00\x03\xff\xff\xff\xff\xff\xff\xff\xfc\x00\x00\x00\x3f\xff\xff\xff\xff\xc0\x00\x00\x00\x00\x03\xff\xff\xf0\x00\x00\x00\x00\x00\x05\x55\x55\xff\xff\x5a\x55\x00\x00\x03\xff\xff\xff\xff\xff\xff\xff\xfc\x00\x00\x00\x3f\xff\xff\xff\xff\xc0\x00\x00\x00\x00\x03\xff\xff\xf0\x00\x00\x00\x00\x00\x05\x55\x55\xff\xff\x5a\x55\x00\x00\x03\xff\xff\xff\xff\xff\xff\xff\xfc\x00\x3f\xfc\x00\x2a\xaa\xaa\x80\x03\xff\xc3\xff\xc0\x3f\xc0\x00\xf0\x00\xff\xf0\x00\x00\x05\x55\x55\xff\xff\x5a\x55\x00\x00\x03\xff\xff\xff\xff\xff\xff\xff\xfc\x00\x3f\xfc\x00\x2a\xaa\xaa\x80\x03\xff\xc3\xff\xc0\x3f\xc0\x00\xf0\x00\xff\xf0\x00\x00\x05\x55\x55\xff\xff\x5a\x55\x00\x00\x01\x55\x43\xff\xff\xff\xfc\x15\x54\x00\x3d\x57\xff\xff\xff\xff\xff\xfd\x57\xc3\xd5\x7f\xff\xc0\x00\xff\xff\x55\xf0\x00\x00\x05\x55\x55\xff\xff\x5a\x55\x00\x00\x01\x55\x43\xff\xff\xff\xfc\x15\x54\x00\x3d\x57\xff\xff\xff\xff\xff\xfd\x57\xc3\xd5\x7f\xff\xc0\x00\xff\xff\x55\xf0\x00\x00\x05\x55\x55\xff\xff\x5a\x55\x00\x00\x01\x55\x43\xff\xff\xff\xfc\x15\x54\x00\x3d\x57\xd5\xa5\x55\x55\xa5\x7d\x57\xc0\x15\x7c\x00\x00\x00\x00\x0f\x55\x00\x00\x00\x05\x55\x55\x5f\xf5\x5a\x55\x00\x00\x01\x55\x43\xff\xff\xff\xfc\x15\x54\x00\x3d\x57\xd5\xa5\x55\x55\xa5\x7d\x57\xc0\x15\x7c\x00\x00\x00\x00\x0f\x55\x00\x00\x00\x05\x55\x55\x5f\xf5\x5a\x55\x00\x00\x01\x55\x43\xff\xff\xff\xfc\x15\x54\x00\x01\x57\xd5\xa5\x55\x55\xa5\x7d\x54\x00\x15\x7c\x00\x00\x00\x00\x0f\x55\x00\x00\x00\x05\x55\x55\x5f\xf5\x5a\x55\x00\x00\x01\x55\x43\xff\xff\xff\xfc\x15\x54\x00\x01\x57\xd5\xa5\x55\x55\xa5\x7d\x54\x00\x15\x7c\x00\x00\x00\x00\x0f\x55\x00\x00\x00\x05\x55\x55\x5f\xf5\x5a\x55\x00\x00\x01\x55\x43\xff\xff\xff\xfc\x15\x54\x00\x01\x57\xd5\xa5\x55\x55\xa5\x7d\x54\x00\x15\x7c\x00\x00\x00\x00\x0f\x55\x00\x00\x00\x05\x55\x55\x5f\xf5\x55\xa5\x00\x00\x01\x55\x43\xff\xff\xff\xfc\x15\x54\x00\x01\x57\xd5\xa5\x55\x55\xa5\x7d\x54\x00\x15\x7c\x00\x00\x00\x00\x0f\x55\x00\x00\x00\x05\x55\x55\x5f\xf5\x55\xa5\x00\x00\x01\x55\x43\xff\xff\xff\xfc\x15\x54\x00\x01\x57\xd5\xa5\x55\x55\xa5\x7d\x54\x00\x15\x7c\x00\x00\x00\x00\x0f\x55\x00\x00\x00\x05\x5f\xf5\x5f\xf5\x55\xa5\x00\x00\x01\x55\x43\xff\xff\xff\xfc\x15\x54\x00\x01\x57\xd5\xa5\x55\x55\xa5\x7d\x54\x00\x15\x7c\x00\x00\x00\x00\x0f\x55\x00\x00\x00\x05\x5f\xf5\x5f\xf5\x55\xa5\x00\x00\x01\x55\x43\xff\xff\xff\xfc\x15\x54\x00\x01\x57\xd5\xa5\x55\x55\xa5\x7d\x54\x00\x15\x7c\x00\x00\x00\x00\x0f\x55\x00\x00\x00\x05\x5f\xff\xff\xf5\x55\xa5\x00\x00\x01\x55\x43\xff\xff\xff\xfc\x15\x54\x00\x01\x57\xd5\xa5\x55\x55\xa5\x7d\x54\x00\x15\x7c\x00\x00\x00\x00\x0f\x55\x00\x00\x00\x05\x5f\xff\xff\xf5\x55\xa5\x00\x00\x01\x55\x42\xaa\xaa\xaa\xa8\x15\x54\x00\x01\x57\xd5\xa5\xff\xf5\xa5\x7d\x54\x00\x15\x7c\x00\x00\x00\x00\x0f\x55\x00\x00\x00\x05\x5f\xff\xff\xf5\x55\xa5\x00\x00\x01\x55\x42\xaa\xaa\xaa\xa8\x15\x54\x00\x01\x57\xd5\xa5\xff\xf5\xa5\x7d\x54\x00\x15\x7c\x00\x00\x00\x00\x0f\x55\x00\x00\x00\x05\x5f\xff\xff\xf5\x55\xa5\x00\x00\x01\x55\x43\xff\xff\xff\xfc\x15\x54\x00\x01\x57\xd5\xa5\xf5\xf5\xa5\x7d\x54\x00\x3f\xfc\x00\x00\x00\x00\x0f\xff\x00\x00\x00\x05\x5f\xf5\x55\x55\x55\xa5\x00\x00\x01\x55\x43\xff\xff\xff\xfc\x15\x54\x00\x01\x57\xd5\xa5\xf5\xf5\xa5\x7d\x54\x00\x3f\xfc\x00\x00\x00\x00\x0f\xff\x00\x00\x00\x05\x5f\xf5\x55\x55\x55\xa5\x00\x00\x00\x00\x02\xaa\xaa\xaa\xa8\x00\x00\x00\x03\xff\xd5\xa5\xf5\xf5\xa5\x7f\xfc\x00\x3f\xfc\x00\x00\x00\x00\x0f\xff\x00\x00\x00\x05\x55\x55\x55\x55\x55\xa5\x00\x00\x00\x00\x02\xaa\xaa\xaa\xa8\x00\x00\x00\x03\xff\xd5\xa5\xf5\xf5\xa5\x7f\xfc\x00\x3f\xfc\x00\x00\x00\x00\x0f\xff\x00\x00\x00\x05\x55\x55\x55\x55\x55\xa5\x00\x00\x00\x00\x02\xaa\xaa\xaa\xa8\x00\x00\x00\x03\xff\xd5\xa5\xff\xf5\xa5\x7f\xfc\x00\x00\x3c\x00\x00\x00\x0f\xff\x00\x00\x00\x00\x05\x55\xaa\xaa\xaa\xaa\xa5\x00\x00\x00\x00\x02\xaa\xaa\xaa\xa8\x00\x00\x00\x03\xff\xd5\xa5\xff\xf5\xa5\x7f\xfc\x00\x00\x3c\x00\x00\x00\x0f\xff\x00\x00\x00\x00\x05\x55\xaa\xaa\xaa\xaa\xa5\x00\x00\x00\x00\x02\xaa\x80\x2a\xa8\x00\x00\x00\x00\x03\xd5\xa5\x55\x55\xa5\x7c\x00\x00\x00\x3c\x00\x00\x00\x0f\xaf\x00\x00\x00\x00\x05\x55\x55\x55\x55\x55\x55\x00\x00\x00\x00\x02\xaa\x80\x2a\xa8\x00\x00\x00\x00\x03\xd5\xa5\x55\x55\xa5\x7c\x00\x00\x00\x3c\x00\x00\x00\x0f\xaf\x00\x00\x00\x00\x05\x55\x55\x55\x55\x55\x55\x00\x00\x00\x00\x02\xaa\x80\x2a\xa8\x00\x00\x00\x00\x03\xd5\xaa\xaa\xaa\xa5\x7c\x00\x00\x00\x3c\x00\x00\x00\x0f\xff\x00\x00\x00\x00\x00\x55\x55\x55\x55\x55\x50\x00\x00\x00\x00\x02\xaa\x80\x2a\xa8\x00\x00\x00\x00\x03\xd5\xaa\xaa\xaa\xa5\x7c\x00\x00\x00\x3c\x00\x00\x00\x0f\xff\x00\x00\x00\x00\x00\x55\x55\x55\x55\x55\x50\x00\x00\x00\x00\x02\xaa\x80\x2a\xa8\x00\x00\x00\x00\x03\xd5\x55\x55\x55\x55\x7c\x00\x00\x00\x3c\x00\x00\x00\x00\x0f\x00\x00\x00\x00\x00\x0f\xff\xff\xff\xff\x00\x00\x00\x00\x00\x02\xaa\x80\x2a\xa8\x00\x00\x00\x00\x03\xd5\x55\x55\x55\x55\x7c\x00\x00\x00\x3c\x00\x00\x00\x00\x0f\x00\x00\x00\x00\x00\x0f\xff\xff\xff\xff\x00\x00\x00\x00\x00\x02\xaa\x80\x2a\xa8\x00\x00\x00\x00\x03\xd5\x55\x55\x55\x55\x7c\x00\x00\x00\x3c\x00\x00\x00\x00\x0f\x00\x00\x00\x00\x00\x55\x55\x55\x55\x55\x50\x00\x00\x00\x00\x02\xaa\x80\x2a\xa8\x00\x00\x00\x00\x03\xd5\x55\x55\x55\x55\x7c\x00\x00\x00\x3c\x00\x00\x00\x00\x0f\x00\x00\x00\x00\x00\x55\x55\x55\x55\x55\x50\x00\x00\x00\x00\x02\xaa\x80\x2a\xa8\x00\x00\x00\x00\x03\xff\xff\xff\xff\xff\xfc\x00\x00\x00\x3f\xff\xff\xff\xff\xff\x00\x00\x00\x00\x05\x55\x55\x55\x55\x55\x55\x00\x00\x00\x00\x02\xaa\x80\x2a\xa8\x00\x00\x00\x00\x03\xff\xff\xff\xff\xff\xfc\x00\x00\x00\x3f\xff\xff\xff\xff\xff\x00\x00\x00\x00\x05\x55\x55\x55\x55\x55\x55\x00\x00\x00\x00\x02\xaa\x80\x2a\xa8\x00\x00\x00\x00\x00\x3f\xfc\x00\x00\x3f\xfc\x00\x00\x00\x03\xff\xc0\x00\xff\xf0\x00\x00\x00\x00\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xa0\x00\x00\x00\x02\xaa\x80\x2a\xa8\x00\x00\x00\x00\x00\x3f\xfc\x00\x00\x3f\xfc\x00\x00\x00\x03\xff\xc0\x00\xff\xf0\x00\x00\x00\x00\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xa0\x00\x00\x00\x02\xaa\x80\x2a\xa8\x00\x00\x00\x00\x00\x3f\xfc\x00\x00\x3f\xfc\x00\x00\x00\x03\xff\xc0\x00\xff\xf0\x00\x00\x00\x0a\xff\xfa\xff\xfa\xff\xfa\xff\xfa\x00\x00\x00\x02\xaa\x80\x2a\xa8\x00\x00\x00\x00\x00\x3f\xfc\x00\x00\x3f\xfc\x00\x00\x00\x03\xff\xc0\x00\xff\xf0\x00\x00\x00\x0a\xff\xfa\xff\xfa\xff\xfa\xff\xfa\x00\x00\x00\x02\xaa\x80\x2a\xa8\x00\x00\x00\x00\x00\x3f\xfc\x00\x00\x3f\xfc\x00\x00\x00\x03\xff\xc0\x00\xff\xf0\x00\x00\x00\x0a\xf5\xfa\xf5\xfa\xf5\xfa\xf5\xfa\x00\x00\x00\x02\xaa\x80\x2a\xa8\x00\x00\x00\x00\x00\x3f\xfc\x00\x00\x3f\xfc\x00\x00\x00\x03\xff\xc0\x00\xff\xf0\x00\x00\x00\x0a\xf5\xfa\xf5\xfa\xf5\xfa\xf5\xfa\x00\x00\x00\x01\x55\x40\x15\x54\x00\x00\x00\x00\x00\x3f\xc0\x00\x00\x3f\xc0\x00\x00\x00\x03\xfc\x00\x00\xff\x00\x00\x00\x00\x0a\xff\xfa\xff\xfa\xff\xfa\xff\xfa\x00\x00\x00\x01\x55\x40\x15\x54\x00\x00\x00\x00\x00\x3f\xc0\x00\x00\x3f\xc0\x00\x00\x00\x03\xfc\x00\x00\xff\x00\x00\x00\x00\x0a\xff\xfa\xff\xfa\xff\xfa\xff\xfa\x00\x00\x00\x01\x55\x40\x15\x54\x00\x00\x00\x00\x00\x3f\xc0\x00\x00\x3f\xc0\x00\x00\x00\x03\xfc\x00\x00\xff\x00\x00\x00\x00\x00\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xa0\x00\x00\x00\x01\x55\x40\x15\x54\x00\x00\x00\x00\x00\x3f\xc0\x00\x00\x3f\xc0\x00\x00\x00\x03\xfc\x00\x00\xff\x00\x00\x00\x00\x00\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xa0\x00", + width: 70, + height: 160, +} +let baimianju : Sprite = { + data: b"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xfc\x00\x00\x00\x00\x00\x03\x00\x13\xc0\x00\x00\x00\x00\x0d\x55\x04\xc0\x00\x00\x00\x00\x0c\x30\x41\x30\x00\x00\x00\x00\x30\xf0\x41\x30\x00\x00\x00\x00\x30\xf0\x11\x30\x00\x00\x00\x00\x31\x04\x11\x30\x00\x00\x00\x00\x34\x04\x11\xf0\x00\x00\x00\x00\x34\xc4\x13\xb0\x00\x00\x00\x00\x3c\x0f\x1e\xf0\x00\x03\x00\x00\x3d\x5f\x1f\x70\x00\x0d\x00\x00\x30\x0c\x4d\x70\x00\x35\x00\x00\xfc\x01\x0d\xf0\x00\xd7\x00\x00\xed\x54\x35\xf3\xff\x5c\x00\x00\xeb\x00\x77\xcc\x3f\x70\x00\x03\xea\xff\xff\xff\x36\xc0\x00\x0e\xba\xaa\xaa\xab\xcd\xbc\x00\x3a\xaf\xaa\xaa\xae\xb3\x6c\x00\x3a\xae\xaa\xaa\xfa\xac\xdb\x00\xea\xae\xaa\xaa\xba\xac\x36\x00\xea\xae\xaa\xaa\xba\xab\x36\x00\xea\xba\xaa\xaa\xba\xab\x36\x00\xea\xba\xaa\xaa\xae\xab\x0e\x03\xaa\xba\xaa\xaa\xae\xab\x0d\x03\xaa\xba\xaa\xaa\xae\xaa\xcd\x0e\xaa\xea\xaa\xaa\xae\xaa\xcd\x0e\xaa\xea\xaa\xaa\xab\xaa\xb9\x3a\xaa\xea\xaa\xaa\xab\xaa\xb9\x3a\xaa\xff\xff\xff\xff\xaa\xad\x3a\xaa\xc0\x00\x00\x03\xaa\xad\x3a\xab\x00\x00\x00\x03\xaa\xad\xea\xab\x00\x00\xff\xff\xea\xad\xea\xab\x95\x55\xc0\x00\xea\xab\xea\xab\xaa\xaa\xbf\xff\xea\xab\xea\xab\x00\x00\x00\x00\xea\xab\xea\xaa\xf0\x00\x00\x00\xea\xab\xfa\xaa\xff\xff\xff\xff\xaa\xab\x3e\xab\xaa\xaa\xa7\x6b\xaa\xaf\x03\xeb\xaa\xaa\xa7\x6a\xea\xbc\x00\x3f\xaa\xaa\xa7\x6a\xeb\xc0\x00\x03\xaa\xaa\xa7\x6a\xfc\x00\x00\x03\xaa\xaa\x9c\xda\xc0\x00\x00\x03\xaa\xaa\x9c\xda\xc0\x00\x00\x0e\xaa\xaa\x70\xda\xc0\x00\x00\x0e\xaa\xaa\x70\xda\xb0\x00\x00\x3a\xaa\xaa\x70\xda\xb0\x00\x00\x3a\xaa\xaa\x70\x36\xac\x00\x00\x0f\xff\xff\xf0\x0f\xfc\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0f\xf0\x00\x3f\xc0\x00\x00\x00\x0f\xf0\x00\x3f\xc0\x00\x00\x00\x00\x00\x00\x00\x00\x00", + width: 56, + height:32, +} +let title : Sprite = { + data: b"\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xea\xd5\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x57\x57\xea\xd5\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x57\x57\xea\xd5\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x57\x57\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xd5\xea\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xab\x57\xd5\xea\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xab\x57\xd5\xeb\xfe\xbf\xef\xfe\xff\xef\xfe\xff\xaf\xfe\xff\xef\xfe\xff\xaa\xaa\xab\x57\xd5\xeb\xef\xaf\xaf\xbe\xfb\xef\xbe\xfb\xef\xbe\xfb\xef\xbe\xfb\xea\xaa\xab\x57\xd5\xeb\xef\xaf\xaf\xaa\xfb\xef\xbe\xfb\xef\xaa\xfb\xef\xaa\xfb\xea\xaa\xab\x57\xd5\xeb\xef\xaf\xab\xfa\xfb\xef\xfa\xfb\xef\xfa\xff\xaf\xfa\xfb\xea\xaa\xab\x57\xd5\xeb\xef\xaf\xaa\xbe\xfb\xef\xbe\xfb\xef\xaa\xfb\xef\xaa\xfb\xea\xaa\xab\x57\xd5\xeb\xef\xaf\xaa\xbe\xfb\xef\xbe\xfb\xef\xaa\xfb\xef\xaa\xfb\xea\xaa\xab\x57\xd5\xeb\xef\xaf\xaf\xbe\xfb\xef\xbe\xfb\xef\xbe\xfb\xef\xbe\xfb\xea\xaa\xab\x57\xd5\xeb\xfe\xbf\xef\xfe\xff\xef\xbe\xff\xaf\xfe\xfb\xef\xfe\xff\xaa\xaa\xab\x57\xd5\xea\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xab\x57\xd5\xea\xaa\xab\xff\xbf\xfb\xff\xbf\xfb\xff\xab\xff\xbf\xef\xfe\xfb\xef\xfb\x57\xd5\xea\xaa\xab\xef\xbe\xfb\xef\xbe\xfb\xef\xab\xef\xaf\xaf\xbe\xfb\xeb\xeb\x57\xd5\xea\xaa\xab\xea\xbe\xfb\xef\xbe\xab\xea\xab\xea\xaf\xaf\xaa\xfb\xeb\xeb\x57\xd5\xea\xaa\xaa\xfe\xbf\xeb\xff\xbe\xab\xfe\xab\xfe\xaf\xaf\xbe\xff\xeb\xeb\x57\xd5\xea\xaa\xaa\xaf\xbe\xab\xef\xbe\xab\xea\xab\xea\xaf\xaf\xbe\xfb\xeb\xeb\x57\xd5\xea\xaa\xaa\xaf\xbe\xab\xef\xbe\xab\xea\xab\xea\xaf\xaf\xbe\xfb\xeb\xeb\x57\xd5\xea\xaa\xab\xef\xbe\xab\xef\xbe\xfb\xef\xab\xea\xaf\xaf\xbe\xfb\xeb\xeb\x57\xd5\xea\xaa\xab\xff\xbe\xab\xef\xbf\xfb\xff\xab\xea\xbf\xef\xfe\xfb\xeb\xeb\x57\xd5\xea\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xab\x57\xd5\xea\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xab\x57\xd5\xea\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xab\x57\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xd5\xd5\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x57\x03\xd5\xd5\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x57\x03\xd5\xd5\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x57\x03\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff", + width: 32, + height:80, +} + // @wasm4.set_draw_colors(0, index=1) + // @wasm4.set_draw_colors(3, index=2) + // @wasm4.set_draw_colors(2, index=3) + // @wasm4.set_draw_colors(4, index=4) + // @wasm4.blit( + // @wasm4.sprite(player_sprite.data),10,10, + // player_sprite.width, + // player_sprite.height, + // @wasm4.BlitFlag::{ + // one_bit_per_pixel: false, + // rotate: false, + // flip_x: false, + // flip_y: false,}) \ No newline at end of file diff --git a/teams/Gameboy/src/start.mbt b/teams/Gameboy/src/start.mbt new file mode 100644 index 0000000..65d04c0 --- /dev/null +++ b/teams/Gameboy/src/start.mbt @@ -0,0 +1,30 @@ +struct Point { + mut x : Int + mut y : Int +} +// let none:Point={x:0,y:0} +let p_pos : Point = { x: 16, y: 0} +let e_pos : Point = { x: 106, y: 0} +let player1 : Player = {ai:player_a,if_defend:false,p:true,key:1,state:0,pos:{ x:0,y:125 },hp:50,f_state:{x:0,y:0},f_live:false,demage:{fight:10,skill:20},cd:scentist_cd,direction:false,playermodel:stive_model} +let player2 : Player = {ai:player_a,if_defend:false,p:false,key:2,state:0,pos:{ x:140,y:125},hp:50,f_state:{x:0,y:0},f_live:false,demage:{fight:10,skill:20},cd:scentist_cd,direction:true,playermodel:tanker_model} +let aiplayer : Player = {ai:player_a2,if_defend:false,p:false,key:2,state:0,pos:{ x:140,y:125},hp:50,f_state:{x:0,y:0},f_live:false,demage:{fight:10,skill:20},cd:scentist_cd,direction:true,playermodel:tanker_model} +let ent:Entities={scene:Menus} + +pub fn update() -> Unit { + ai_think() + // strength(player.prob) + match ent.scene{ + // Welcome => render_system(ent) + Menus => render_system(ent) + Game1 => render_system(ent) + Game2 => render_system(ent) + Choice => render_system(ent) + Victory1 => render_system(ent) + Victory2 => render_system(ent) + } + +} + + + + diff --git a/teams/Gameboy/src/story.mbt b/teams/Gameboy/src/story.mbt new file mode 100644 index 0000000..f5f0c4a --- /dev/null +++ b/teams/Gameboy/src/story.mbt @@ -0,0 +1,227 @@ +enum Story { + Sto1 + Sto2 + Sto3 + Sto4 + End +} +enum Stor { + Sto1 + Sto2 + Sto3 + Sto4 + Sto5 + End +} +struct Sto{ +mut story:Story +mut stor:Stor +} +let sto:Sto={story:Sto1,stor:Sto1} +let count:Point={x:1,y:1} +let ti:Ti={t:0} +fn story()->Unit{ + match sto.story{ + Sto1=>{if count.x==1{ + + aiplayer.playermodel=tree_model + aiplayer.ai.prob.prob1=0 + aiplayer.ai.prob.prob2=0 + aiplayer.ai.prob.prob3=0 + aiplayer.ai.prob.prob4=0 + aiplayer.ai.prob.prob5=0 + game2.mod=2 + + count.x+=1 + } + @wasm4.text("Welcome to Minecraft", 0, 10) + @wasm4.text("First step: cut tree", 0, 20) + + game2_init()} + Sto2=>{if count.x==2{ + aiplayer.playermodel=pig_model + aiplayer.ai.prob.prob1=0 + aiplayer.ai.prob.prob2=50 + aiplayer.ai.prob.prob3=0 + aiplayer.ai.prob.prob4=40 + aiplayer.ai.prob.prob5=20 + game2.mod=2 + player1.pos.x=0 + player1.pos.y=125 + count.x+=1 + } + // @wasm4.text("First step: cut tree", 0, 20) + @wasm4.text("kill the pig",40, 20) + player1.demage.fight=15 + game2_init()} + Sto3=>{if count.x==3{ + aiplayer.playermodel=mo_model + aiplayer.pos.x=140 + aiplayer.pos.y=125 + aiplayer.ai.prob.prob1=20 + aiplayer.ai.prob.prob2=80 + aiplayer.ai.prob.prob3=10 + aiplayer.ai.prob.prob4=90 + aiplayer.ai.prob.prob5=30 + game2.mod=2 + player1.hp+=20 + player1.pos.x=0 + player1.pos.y=125 + count.x+=1 + + } + // @wasm4.text("First step: cut tree", 0, 20) + @wasm4.text("Kill the Enderman", 15, 20) + player1.demage.fight=15 + game2_init()} + Sto4=>{if count.x==4{ + aiplayer.playermodel=dra_model + aiplayer.pos.x=110 + aiplayer.pos.y=110 + aiplayer.ai.prob.prob1=0 + aiplayer.ai.prob.prob2=0 + aiplayer.ai.prob.prob3=0 + aiplayer.ai.prob.prob4=0 + aiplayer.ai.prob.prob5=0 + game2.mod=2 + player1.pos.x=0 + player1.pos.y=125 + player1.hp+=20 + count.x=1 + } + // @wasm4.text("First step: cut tree", 0, 20) + @wasm4.text("Kill the EnderDragon", 0, 20) + player1.demage.fight=15 + game2_init()} + End=>{ + @wasm4.set_draw_colors(1, index=1) + @wasm4.set_draw_colors(2, index=2) + @wasm4.set_draw_colors(3, index=3) + @wasm4.set_draw_colors(4, index=4) + @wasm4.blit(@wasm4.sprite(baimianju.data),128,34,baimianju.height,baimianju.width,@wasm4.BlitFlag::{one_bit_per_pixel:false,rotate: false,flip_x: false,flip_y: false,}) + @wasm4.blit(@wasm4.sprite(stive_sprite.data),10,140, tanker_sprite.width,tanker_sprite.height,@wasm4.BlitFlag::{one_bit_per_pixel: false,rotate: true,flip_x: true,flip_y: true,}) + @wasm4.blit(@wasm4.sprite(dragon_sprite.data),110,110, dragon_sprite.height,dragon_sprite.width,@wasm4.BlitFlag::{one_bit_per_pixel: false,rotate: false,flip_x: true,flip_y: false,}) + + match sto.stor{ + Sto1=>{ + ti.t+=1 + @wasm4.set_draw_colors(4, index=1) + @wasm4.set_draw_colors(1, index=2) + @wasm4.rect(0, 0, 160, 160) + @wasm4.text("What hanppend", 30, 10) + @wasm4.text("You Win??????", 30, 20) + @wasm4.text("Press button X", 30, 40) + end() + if @wasm4.get_gamepad(index=1).button_1{ + if ti.t>=60{sto.stor=Sto2 + ti.t=0} + }} + + Sto2=>{ + ti.t+=1 + // @wasm4.set_draw_colors(1, index=1) + // @wasm4.set_draw_colors(1, index=2) + // @wasm4.rect(0, 0, 160, 160) + @wasm4.set_draw_colors(4, index=1) + @wasm4.set_draw_colors(1, index=2) + @wasm4.text("Dragon killer?", 10, 40) + @wasm4.text("Junk!!", 10, 50) + @wasm4.set_draw_colors(1, index=1) + @wasm4.set_draw_colors(4, index=2) + @wasm4.blit(@wasm4.sprite(shenwei_sprite.data),10,10,shenwei_sprite.width,shenwei_sprite.height, @wasm4.BlitFlag::{one_bit_per_pixel: true,rotate: false,flip_x: false,flip_y: false,}) + if @wasm4.get_gamepad(index=1).button_1{ + if ti.t>=60{sto.stor=Sto3 + ti.t=0} + }} + + Sto3=>{ti.t+=1 + @wasm4.set_draw_colors(4, index=1) + @wasm4.set_draw_colors(1, index=2) + // @wasm4.rect(0, 0, 80, 160) + @wasm4.text("Killed the dragon?", 10, 10) + @wasm4.text("For princess?!", 10, 20) + // @wasm4.text("神威难藏泪", 30, 10) + // @wasm4.set_draw_colors(1, index=1) + // @wasm4.set_draw_colors(4, index=2) + // @wasm4.blit(@wasm4.sprite(shenwei_sprite.data),10,10,shenwei_sprite.width,shenwei_sprite.height, @wasm4.BlitFlag::{one_bit_per_pixel: true,rotate: false,flip_x: false,flip_y: false,}) + @wasm4.set_draw_colors(1, index=1) + @wasm4.set_draw_colors(2, index=2) + @wasm4.set_draw_colors(3, index=3) + @wasm4.set_draw_colors(4, index=4) + // @wasm4.blit(@wasm4.sprite(baimianju.data),128,34,baimianju.height,baimianju.width,@wasm4.BlitFlag::{one_bit_per_pixel:false,rotate: false,flip_x: false,flip_y: false,}) + @wasm4.blit(@wasm4.sprite(knight_sprite.data),10,140, tanker_sprite.width,tanker_sprite.height,@wasm4.BlitFlag::{one_bit_per_pixel: false,rotate: true,flip_x: false,flip_y: true,}) + if @wasm4.get_gamepad(index=1).button_1{ + if ti.t>=60{sto.stor=Sto4 + ti.t=0} + }} + Sto4=>{ti.t+=1 + @wasm4.set_draw_colors(4, index=1) + @wasm4.set_draw_colors(1, index=2) + // @wasm4.rect(0, 0, 80, 160) + @wasm4.text("For living forever", 10, 10) + @wasm4.text("Unscrupulously!", 10, 20) + // @wasm4.text("神威难藏泪", 30, 10) + // @wasm4.set_draw_colors(1, index=1) + // @wasm4.set_draw_colors(4, index=2) + // @wasm4.blit(@wasm4.sprite(shenwei_sprite.data),10,10,shenwei_sprite.width,shenwei_sprite.height, @wasm4.BlitFlag::{one_bit_per_pixel: true,rotate: false,flip_x: false,flip_y: false,}) + @wasm4.set_draw_colors(1, index=1) + @wasm4.set_draw_colors(2, index=2) + @wasm4.set_draw_colors(3, index=3) + @wasm4.set_draw_colors(4, index=4) + // @wasm4.blit(@wasm4.sprite(baimianju.data),128,34,baimianju.height,baimianju.width,@wasm4.BlitFlag::{one_bit_per_pixel:false,rotate: false,flip_x: false,flip_y: false,}) + @wasm4.blit(@wasm4.sprite(scientist_sprite.data),10,140, tanker_sprite.width,tanker_sprite.height,@wasm4.BlitFlag::{one_bit_per_pixel: false,rotate: true,flip_x: true,flip_y: true,}) + if @wasm4.get_gamepad(index=1).button_1{ + + if ti.t>=60{sto.stor=Sto5 + ti.t=0} + }} + Sto5=>{ti.t+=1 + @wasm4.set_draw_colors(4, index=1) + @wasm4.set_draw_colors(1, index=2) + // @wasm4.rect(0, 0, 80, 160) + @wasm4.text("You did it, too?", 30, 10) + @wasm4.text("A robot???", 30, 20) + @wasm4.text("F**K!!!!", 30, 30) + // @wasm4.text("神威难藏泪", 30, 10) + // @wasm4.set_draw_colors(1, index=1) + // @wasm4.set_draw_colors(4, index=2) + // @wasm4.blit(@wasm4.sprite(shenwei_sprite.data),10,10,shenwei_sprite.width,shenwei_sprite.height, @wasm4.BlitFlag::{one_bit_per_pixel: true,rotate: false,flip_x: false,flip_y: false,}) + @wasm4.set_draw_colors(1, index=1) + @wasm4.set_draw_colors(2, index=2) + @wasm4.set_draw_colors(3, index=3) + @wasm4.set_draw_colors(4, index=4) + // @wasm4.blit(@wasm4.sprite(baimianju.data),128,34,baimianju.height,baimianju.width,@wasm4.BlitFlag::{one_bit_per_pixel:false,rotate: false,flip_x: false,flip_y: false,}) + @wasm4.blit(@wasm4.sprite(tanker_sprite.data),10,140, tanker_sprite.width,tanker_sprite.height,@wasm4.BlitFlag::{one_bit_per_pixel: false,rotate: true,flip_x: true,flip_y: true,}) + if @wasm4.get_gamepad(index=1).button_1{ + if ti.t>=60{sto.stor=End + ti.t=0} + }} + End=>{ti.t+=1 + @wasm4.set_draw_colors(4, index=1) + @wasm4.set_draw_colors(1, index=2) + // @wasm4.rect(0, 0, 80, 160) + @wasm4.text("You were strongers", 0, 0) + @wasm4.text("But are slaves now", 0, 10) + @wasm4.text("Kill each other", 0, 20) + @wasm4.text("Winner will could", 0, 30) + @wasm4.text("challenge me ", 0, 40) + @wasm4.text("For freedom! ", 0, 50) + // @wasm4.set_draw_colors(1, index=1) + // @wasm4.set_draw_colors(4, index=2) + // @wasm4.blit(@wasm4.sprite(shenwei_sprite.data),10,10,shenwei_sprite.width,shenwei_sprite.height, @wasm4.BlitFlag::{one_bit_per_pixel: true,rotate: false,flip_x: false,flip_y: false,}) + @wasm4.set_draw_colors(1, index=1) + @wasm4.set_draw_colors(2, index=2) + @wasm4.set_draw_colors(3, index=3) + @wasm4.set_draw_colors(4, index=4) + // @wasm4.blit(@wasm4.sprite(baimianju.data),128,34,baimianju.height,baimianju.width,@wasm4.BlitFlag::{one_bit_per_pixel:false,rotate: false,flip_x: false,flip_y: false,}) + // @wasm4.blit(@wasm4.sprite(knight_sprite.data),10,140, tanker_sprite.width,tanker_sprite.height,@wasm4.BlitFlag::{one_bit_per_pixel: false,rotate: true,flip_x: true,flip_y: true,}) + @wasm4.blit(@wasm4.sprite(background.data),0,90,background.height,background.width,@wasm4.BlitFlag::{one_bit_per_pixel: false,rotate: false,flip_x: false,flip_y: false,}) + if @wasm4.get_gamepad(index=1).button_1{ + if ti.t>=60{ent.scene=Menus + ti.t=0} + }} + }}}} + +fn render_game2(entities:Entities)->Unit{ + story() +} \ No newline at end of file From c83d6084928011560471fc6dd72087858ee2dc2a Mon Sep 17 00:00:00 2001 From: zyz2875 <116343420+zyz2875@users.noreply.github.com> Date: Sat, 16 Nov 2024 20:33:05 +0800 Subject: [PATCH 2/2] Update README.md --- teams/Gameboy/README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/teams/Gameboy/README.md b/teams/Gameboy/README.md index 4a92513..dc8c3f1 100644 --- a/teams/Gameboy/README.md +++ b/teams/Gameboy/README.md @@ -17,4 +17,7 @@ P2:S和F控制左右方向移动,A攻击,tab技能 我叫史蒂夫,我正在按着流程过完我的一生————砍树做木剑->杀猪做盔甲->杀掉末影人拿末影珍珠->击败最终BOSS末影龙当我杀完末影龙沉浸在喜悦中。突然,我两眼一黑,一个家伙嘟囔着神威难藏泪什么的。醒来就被这个带着面具的家伙带到了角斗场,旁边三个人也是在自己世界杀完龙后被带来了,这个神秘面具男说我们四个中的胜者战胜他才能回去原来的时空。 ![alt text](image.png) 神秘面具男!他是谁,为什么要把大家从每个时空带来这个角斗场,为什么对每个屠龙勇士都喷垃圾话? -一切答案在错乱时空乱斗中(还未做,代码已写一部分,但游戏内存不够了) \ No newline at end of file +一切答案在错乱时空乱斗中(还未做,代码已写一部分,但游戏内存不够了) +版本:moon 0.1.20241014 (d2f5429 2024-10-14) ~\.moon\bin\moon.exe +moonc v0.1.20241014+2956e63cd ~\.moon\bin\moonc.exe +moonrun 0.1.20241014 (d2f5429 2024-10-14) ~\.moon\bin\moonrun.exe