Mar 31, 2014 07:29 PM
(This post was last modified: Mar 31, 2014 09:02 PM by Blixuk.)
Yeah... I know... :/
I was bored and it passed some time. So yeah, here it is Flappy Square.
The sources is poorly coded and is messy. But by all means if you can do something with it go for it. Only spent an hour or so on this before I got bored again.
Pretty basic... Press 'Spacebar' to flap. (I added 'Mouse Click' to flap but never perfected it.)
It has all the sound effects but they could be added much better.
It counts your score up, but doesn't save it. I didn't think it was needed.
The pipes are just the same 2 picture boxes, once they reach a select point they are re-positioned to a new location and the size changes, the gap in-between them always remains the same size.
There's basic collision detection.
It's all done with timers, I didn't think it needed treading or anything more because of the simplicity.
Screen Shot
![[Image: 2gUu008.gif]](https://i.imgur.com/2gUu008.gif)
Source Code - (If you just want to look at the code.)
Code Public Class Form1
Dim sprites(2) As PictureBox
Dim score As Integer = 0
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'====[SPRITES]
sprites(0) = Me.playerPB
sprites(1) = Me.wallPB1
sprites(2) = Me.wallPB2
'====[START]
Dim result As DialogResult
result = MessageBox.Show("Start?", "Flappy Square", MessageBoxButtons.YesNo)
If result = MsgBoxResult.Yes Then
Timer1.Enabled = True
Timer2.Enabled = True
Timer3.Enabled = True
score = 0
Label1.Text = "Score: " & score
ElseIf result = MsgBoxResult.No Then
Me.Close()
End If
End Sub
Private Sub Form1_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint
ControlPaint.DrawGrid(e.Graphics, New Rectangle(0, 0, Me.Width, Me.Height), New Size(32, 32), Color.Red)
'ControlPaint.DrawGrabHandle(e.Graphics, New Rectangle(0, 0, 32, 32), True, True)
End Sub
#Region "CONTROLS"
Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
'====[MOVEMENT]
If e.KeyCode = Keys.Up Then
playerPB.Top -= 32
ElseIf e.KeyCode = Keys.Down Then
playerPB.Top += 32
ElseIf e.KeyCode = Keys.Left Then
playerPB.Left -= 32
ElseIf e.KeyCode = Keys.Right Then
playerPB.Left += 32
End If
'====[JUMP]
If e.KeyCode = Keys.Space Then
playerPB.Location = New Point(playerPB.Left, playerPB.Location.Y - 64)
My.Computer.Audio.Play(My.Resources.FQ_Flap, AudioPlayMode.Background)
Else
End If
End Sub
Private Sub Form1_MouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseClick
'====[MOUSE CONTROL]
playerPB.Location = New Point(playerPB.Left, playerPB.Location.Y - 64)
My.Computer.Audio.Play(My.Resources.FQ_Flap, AudioPlayMode.Background)
End Sub
#End Region
#Region "SPRITES"
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
'====[PLAYER UPDATE]
playerPB.Location = New Point(playerPB.Left, playerPB.Location.Y + 16)
If playerPB.Location.Y = 352 Then
Timer1.Enabled = False
Timer2.Enabled = False
Timer3.Enabled = False
My.Computer.Audio.Play(My.Resources.FQ_Dead, AudioPlayMode.Background)
Dim result As DialogResult
result = MessageBox.Show("You scored: " & score & " Would you like to retry?", "Flappy Square", MessageBoxButtons.YesNo)
If result = MsgBoxResult.Yes Then
Me.playerPB.Location = New Point(128, 128)
Me.wallPB1.Location = New Point(300, 320)
Me.wallPB2.Location = New Point(300, -2)
wallPB2.ClientSize = New Size(64, 164)
score = 0
Label1.Text = "Score: " & score
Timer1.Enabled = True
Timer2.Enabled = True
Timer3.Enabled = True
ElseIf result = MsgBoxResult.No Then
Me.Close()
End If
Else
End If
End Sub
Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
'====[OBJECT UPDATE]
Dim size As Integer
Dim newRandom As New Random()
wallPB1.Location = New Point(wallPB1.Location.X - 20, wallPB1.Location.Y)
wallPB2.Location = New Point(wallPB2.Location.X - 20, wallPB2.Location.Y)
If wallPB1.Location.X = -40 Then
size = newRandom.Next(128, 320)
wallPB1.Location = New Point(400, size)
'PictureBox2.ClientSize = New Size(64, size)
Else
End If
If wallPB2.Location.X = -40 Then
wallPB2.Location = New Point(400, -2)
wallPB2.ClientSize = New Size(64, wallPB1.Location.Y - 128)
Else
End If
End Sub
Private Sub Timer3_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer3.Tick
'====[COLLISION DETECTION]
For index = 1 To 2
If Me.playerPB.Bounds.IntersectsWith(sprites(index).Bounds) Then
Timer1.Enabled = False
Timer2.Enabled = False
Timer3.Enabled = False
My.Computer.Audio.Play(My.Resources.FQ_Dead, AudioPlayMode.Background)
Dim result As DialogResult
result = MessageBox.Show("You scored: " & score & " Would you like to retry?", "Flappy Square", MessageBoxButtons.YesNo)
If result = MsgBoxResult.Yes Then
Me.playerPB.Location = New Point(128, 128)
Me.wallPB1.Location = New Point(300, 320)
Me.wallPB2.Location = New Point(300, -2)
wallPB2.ClientSize = New Size(64, 164)
score = 0
Label1.Text = "Score: " & score
Timer1.Enabled = True
Timer2.Enabled = True
Timer3.Enabled = True
ElseIf result = MsgBoxResult.No Then
Me.Close()
End If
Else
End If
Next
'====[SCORE]
If wallPB1.Location.X = 100 Then
My.Computer.Audio.Play(My.Resources.FQ_Point, AudioPlayMode.Background)
score = score + 1
Label1.Text = "Score: " & score
Else
End If
End Sub
#End Region
End Class
Project File
Download - (Virus Total)
Looks good. Will download and test it out later.
![[Image: IMG-6011.png]](https://i.postimg.cc/k5fyhYts/IMG-6011.png) Remotely Control your iOS Devices.
Thanks for this man ;) Will check it out :D
Lol, nice. Does it get harder as your score increases? Or is it all the same difficulty?
Apr 1, 2014 03:06 AM
(This post was last modified: Apr 1, 2014 03:07 AM by iVision.)
You forgot to make a ceiling:
[img]http://www.lensert.com/Odb.png[/img]
Just press space as many times and it continues (since the descending takes time :P) Also the collision is not perfect you can hit the corners
Lol, wow I thought that couldn't be made into .Net creative bro, it's really up tight :)
Apr 1, 2014 09:31 AM
(This post was last modified: Apr 1, 2014 09:32 AM by Blixuk.)
(Apr 1, 2014 03:06 AM)iVision Wrote: You forgot to make a ceiling:
[img]http://www.lensert.com/Odb.png[/img]
Just press space as many times and it continues (since the descending takes time :P) Also the collision is not perfect you can hit the corners
Yeah, I said it's not great. I got bored before I added much detail to the game. I could go back and add all that stuff if people want.
But thanks for checking it out.
(Apr 1, 2014 08:26 AM)MAXUSdev Wrote: Lol, wow I thought that couldn't be made into .Net creative bro, it's really up tight :)
Yeah, it's a pretty simple concept. Aha.
(Mar 31, 2014 10:12 PM)Wumbology Expert Wrote: Lol, nice. Does it get harder as your score increases? Or is it all the same difficulty?
No it doesn't but it's not hard to make it get harder tho.
Ehh. Why not use GDI? Moving controls is pretty much the worst way of doing things like this.
Anyways, the idea is pretty cool I guess.
Apr 1, 2014 09:34 AM
(This post was last modified: Apr 1, 2014 09:36 AM by Blixuk.)
Well looks like someone hated this, I'v been down rep't -10... I din't think it was that bad. Thanks. (Y)
(Apr 1, 2014 09:34 AM)Meerkat. Wrote: Ehh. Why not use GDI? Moving controls is pretty much the worst way of doing things like this.
Anyways, the idea is pretty cool I guess.
I haven't learned much GDI, I would really like to tho. Plus I just messing around and made it. Didn't think much about it. Thanks for checking it out tho.
(Apr 1, 2014 09:34 AM)Blixuk Wrote: Well looks like someone hated this, I'v been down rep't -10... I din't think it was that bad. Thanks. (Y)
Lol that’s an april fools from Omni. Your rep is still at 5 :)
<p><br></p>
(Apr 1, 2014 09:34 AM)Blixuk Wrote: Well looks like someone hated this, I'v been down rep't -10... I din't think it was that bad. Thanks. (Y)
I haven't learned much GDI, I would really like to tho. Plus I just messing around and made it. Didn't think much about it. Thanks for checking it out tho.
No man it is the owners April fools joke haha. It only looks like that don't you, don't worry :-)
Apr 1, 2014 09:40 AM
(This post was last modified: Apr 1, 2014 09:40 AM by Blixuk.)
(Apr 1, 2014 09:37 AM)Cletus Kasady Wrote: No man it is the owners April fools joke haha. It only looks like that don't you, don't worry :-)
Dam... He got me good. >.< I feel like a idiot now. Aha. That was good one.
(Apr 1, 2014 09:37 AM)Cletus Kasady Wrote: No man it is the owners April fools joke haha. It only looks like that don't you, don't worry :-)
Dam... He got me good. >.< That was good one.
Just to re-assure you man http://prntscr.com/363tv6
(Apr 1, 2014 10:00 AM)Cletus Kasady Wrote: Just to re-assure you man http://prntscr.com/363tv6
Thanks alot mate. :D Aha.
You're top guy.
(Apr 1, 2014 09:34 AM)Blixuk Wrote: I haven't learned much GDI, I would really like to tho. Plus I just messing around and made it. Didn't think much about it. Thanks for checking it out tho.
I'll post my GDI version as soon as I'm finished with it. I just started working on it a few hours ago, and it gives the ability for the square to rotate using a matrix and such. It's also a lot better performing and the framerate is better.
|