https://github.com/ZTFtrue/wolf-eat-sheep
不知道游戏逻辑怎么写,我都是用 if else 做判断。
1
strpbrk 2019-04-14 15:02:40 +08:00
不就是用 if else 么
|
2
hahaayaoyaoyao OP @strpbrk 我之前看到有人嘲笑游戏用 if else 写。
|
3
inoki 2019-04-14 16:24:27 +08:00 via Android
@hahaayaoyaoyao 太吾绘卷?😂
|
4
hahaayaoyaoyao OP @inoki 是的😂
|
5
xeaglex 2019-04-14 16:49:33 +08:00
比如状态机编程?
|
6
Biwood 2019-04-14 16:59:23 +08:00
@hahaayaoyaoyao 嘲笑的不是 if else,嘲笑的是满屏只有 if else,不懂什么叫函数封装,什么叫抽象。
话说你这代码确实有点吓人,还是多读一些优秀源码吧。 |
7
whoami9894 2019-04-14 17:12:01 +08:00
想起我最开始上学习的 VB 课,最后的大作业一个游戏就是这样的风格
```vb If keyascii = 119 Then Image1.Top = Image1.Top - 200 End If If keyascii = 115 Then Image1.Top = Image1.Top + 200 End If If keyascii = 97 Then Image1.Left = Image1.Left - 200 End If If keyascii = 100 Then Image1.Left = Image1.Left + 200 End If If keyascii = 32 Then If Image3(4).Visible = False Then Call m3 Else Call m1 WindowsMediaPlayer1.Enabled = False Image3(i).Visible = False i = i + 1 If i = 5 Then i = 0 If Abs((Image1.Left + Image1.Width / 2) - (Image2.Left + Image2.Width / 2)) <= Image2.Width / 3 And Abs((Image1.Top + Image1.Height / 2) - (Image2.Top + Image2.Height / 2)) <= (9 / 10) * Image2.Height Then If Image2.Picture = Image4.Picture Then p = 1 Else a = a - 1 Label2.Caption = a End If Image2.Picture = Image4.Picture End If If Abs((Image1.Left + Image1.Width / 2) - (Image11.Left + Image11.Width / 2)) <= Image11.Width / 3 And Abs((Image1.Top + Image1.Height / 2) - (Image11.Top + Image11.Height / 2)) <= (9 / 10) * Image11.Height Then If Image11.Picture = Image12.Picture Then p = 1 Else a = a - 1 Label2.Caption = a End If Image11.Picture = Image12.Picture Timer1.Enabled = False End If If Abs((Image1.Left + Image1.Width / 2) - (Image7.Left + Image7.Width / 2)) <= Image7.Width / 3 And Abs((Image1.Top + Image1.Height / 2) - (Image7.Top + Image7.Height / 2)) <= (9 / 10) * Image7.Height Then If Image7.Picture = Image13.Picture Then p = 1 Else a = a - 1 Label2.Caption = a End If Image7.Picture = Image13.Picture End If If Abs((Image1.Left + Image1.Width / 2) - (Image8.Left + Image8.Width / 2)) <= Image8.Width / 3 And Abs((Image1.Top + Image1.Height / 2) - (Image8.Top + Image8.Height / 2)) <= (9 / 10) * Image8.Height Then If Image8.Picture = Image14.Picture Then p = 1 Else a = a - 1 Label2.Caption = a End If Image8.Picture = Image14.Picture End If If Abs((Image1.Left + Image1.Width / 2) - (Image9.Left + Image9.Width / 2)) <= Image9.Width / 3 And Abs((Image1.Top + Image1.Height / 2) - (Image9.Top + Image9.Height / 2)) <= (9 / 10) * Image9.Height Then If Image9.Picture = Image15.Picture Then p = 1 Else a = a - 1 Label2.Caption = a End If Image9.Picture = Image15.Picture Image9.Move 15000 Timer2.Enabled = True End If ``` |
8
malaohu 2019-04-14 17:13:54 +08:00
我一个人玩的好累
|
9
hahaayaoyaoyao OP @Biwood 给点具体指导,确实很差
|
10
zwh2698 2019-04-14 19:51:27 +08:00
我了你博客中那个套《桃花庵歌》的程序员,觉得你实在无聊的有才啊,https://timerd.ml 传送门给你 .
|
11
Senventise 2019-04-14 20:14:15 +08:00 via Android
没有获胜判断吗?
|
12
hahaayaoyaoyao OP @zwh2698 佛祖?网上抄的
|
13
zwh2698 2019-04-14 23:24:58 +08:00 via Android
@hahaayaoyaoyao 是这个,好玩
|
14
hahaayaoyaoyao OP @Senventise 是的
|