Flappy Bird but Bad [Game]

Post gaming related scripts
User avatar
Kenzis
Posts: 15
Joined: 01 May 2020, 13:05

Flappy Bird but Bad [Game]

Post by Kenzis » 22 May 2023, 18:08

I've made this a while ago, not too while ago but i just made this for fun, anyhow i know all the mistakes and i can type them all here and yet, i won't fix them because im too lazy and have no reason to fix them myself, yet if you wan't to,
please go ahead.
1.FSM Reason sometimes the game would be still running in systray even when closed, (Sometimes) Maybe i fixed it somehow, I have no idea.
2.The BIRD Hitbox or rather the Pipe Hitbox is way to wide to the right, so sometimes you will lose even if you don't hit the pipe going downwards.
3.[No Music & or Sounds, No Background, No nice looking pictures, the pipes are not high enough drawn nor is the picture high enough]
4.The game is overall boring, without the score doing anything, and the game doesn't get harder as further you go, this can be easily implemented just by changing literally one variable, but nahh...
5.Game look is disgusting...
6.The game when you press F1, instead of reseting the GUI's (Which would be way faster), it just closes the game and re-opens it.
8.There's no end to the game, and you always Lose, instead of making like idk a score of 99 or smth or less being like THE END, maybe like the "Bad Mario" shoots his fireballs at you and you die or smth, but idk. Didn't implement it. :mrgreen:
---------------------------------------
Overall even with all these things that are bad and are easy fixes, but i don't wan't to fix em :lolno: It still is pretty much Flappy Bird, but just really bad. Give it a go if you wan't :D, tho the code below won't work since you don't have
the pictures, so download the rar instead with the pictures :P


Also some things you may wan't to read---
1.I've been helped by ChatGPT, the bot helped me with the gravity for the Bird, since idk that stuff, I have ADHD, i've had hard time making this but anyhow chatgpt helped greatly, only for that may i tell you, but without it i would probably
make something similar but take 30x the hours or days just to make the gravity for the bird...It is Probably mentioned at the start of the script "The nonsense with <Where are we at-->", even i don't know what i was typing, but whatever. I've never deleted it even after chatgpt implemented the right gravity into the game.

2.Also the code for errors at the start is in Serbian if you wanted to know, I also did not finish that :bravo: GJ me
3.Theres a "Safe" Return at the end of the script, idk why i put it there, but it is a joke i guess... or just some nonsense :facepalm:

Code: Select all

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases. 
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
#SingleInstance Force
;Where are we at--
;We need to fix the gravity so that the gravity actually works properly
;And not accelerate depending on bird's y position, instead
;It should update by every few ticks to accelerate independant of birds y Pos
;Bring the bird down, but it should be the same indepedant of its y pos.

IfNotExist, %A_ScriptDir%\data
{
MsgBox, 16, Error Data folder not found, `n Izbrisao si folder data ili ga nisi stavio gde treba, vrati ga u direktorijum gde je igrica.
ExitApp
}

IfNotExist, %A_ScriptDir%\data\BadBirdBackground.png
{
MsgBox, 16, Error BadBirdBackground.png not found, `n Izbrisao si sliku za background ili je nisi stavio gde treba, vrati ga u direktorijum gde je igrica tj. u data folder.
ExitApp
}

IfNotExist, %A_ScriptDir%\data\Pipes.png
{
MsgBox, 16, Error BadBirdBackground.png not found, `n Izbrisao si sliku za background ili je nisi stavio gde treba, vrati ga u direktorijum gde je igrica tj. u data folder.
ExitApp
}

IfNotExist, %A_ScriptDir%\data\Bird.png
{
MsgBox, 16, Error BadBirdBackground.png not found, `n Izbrisao si sliku za background ili je nisi stavio gde treba, vrati ga u direktorijum gde je igrica tj. u data folder.
ExitApp
}

;Initial gravity values
jumping := false
gravity_speed := 0.5
gravity_max_speed := 7
gravity_acceleration := 0.001
pipeyran := 0
three := 300
four := 400

;Variables to keep track of falling time
falling_start_time := 0
falling_end_time := 0
falling_time := 0

;Pipes Config
pipespeedx := 3 ;Speed in pixels.
pipex := 800
pipey := 0

;Starting Coordinates
birdx := 196
birdy := 305 ;257
score := 0                      
checkforwindowtimer := 200
windowwidth := 800
windowheight := 600

;Check for gameover
SetTimer, Gameover, 0 

;Check if the bird is offscreen upside, if it is skip to gameoverstart
SetTimer, Gameoverup, 0

;Gravity 1.01 is slow 1.02 is fast
Gravity := 1.02

;Check for window if it doesn't exist, exitapp.
SetTimer, SBNotExist, %checkforwindowtimer%

;Starting Gui & Background GUI with an active starting button for the game.
Gui, Start:New
Gui, Start:Margin, 0, 0
Gui, Start:Add, Picture, x0 y0 w%windowwidth% h%windowheight%, %A_ScriptDir%\data\BadBirdBackground.png
gui, Start:Show, Center w%windowwidth% h%windowheight%, Bad Bird
gui, Start:Font, s20 w700, Arial
gui, Start:Add, Button, Center w120 h60 x340 y280 gStartbutt, START 
Hotkey, *~Space, , Off
return

;Gui of the game
Startbutt:
Hotkey, *~Space, , On
Gui, Start1:New
Gui, Start1:Show, Center w%windowwidth% h%windowheight%, Bad Bird
Gui, Start:Show, NoActivate
Gui, Start:Destroy
Gui, Start:New
Gui, Start:Show, Center w%windowwidth% h%windowheight%, Bad Bird
Gui, Start:Color, White
Gui, Start1:Destroy

;Draw the pipes
Gui, Pipes:New, -sysmenu -border -Caption
gui, Pipes:Margin, 0, 0
Gui, Pipes:+ParentStart
Gui, Pipes:Add, Picture, x0 y0, %A_ScriptDir%\data\Pipes.png
Gui, Pipes:Show, x%pipex% y%pipey% AutoSize

;Draw the bird character.
Gui, Bird:New, -sysmenu -border -Caption
Gui, Bird:Margin, 0, 0
Gui, Bird:+ParentStart
Gui, Bird:Add, Picture, x-8 y-15 w64 h64, %A_ScriptDir%\data\Bird.png
Gui, Bird:Show, x%birdx% y%birdy% w52 h35

Gui, Score:New, -border -sysmenu -Caption
Gui, Score:Font, s20 w700, Arial
Gui, Score:Margin, 0, 0
Gui, Score:+ParentStart
Gui, Score:Add, Text, x0 y0 w175 h25, Score = %score%
Gui, Score:Show, x2 y5 Autosize

;Move the pipe to the right timer
SetTimer, Pipemove, 0

SetTimer, scorecalculator, 2500

;Checks whether or not the bird hit the pipe.
;SetTimer, hitboxcheckup, 0
;SetTimer, hitboxcheckdown, 0
;SetTimer, hitboxcheckright, 0

;Check for the pipe being near the bird and starting a hitbox check
SetTimer, checkforpipexhitbox, 0

;Check for pipex coord being on the far left and reset it.
SetTimer, Checkforpipex, 0

;Bird's Own Gravity Timer
SetTimer, GravityStart, 0
falling_start_time := 0
SetTimer, Gravity, Off
Return

GravityStart:
{
    if (jumping = true) {
        SetTimer, GravityStart, Off
        SetTimer, Gravity, 0
        falling_start_time := A_TickCount
        Return
    }
    birdy := birdy +1
    falling_time := 0
    Gui, Bird:Show, x%birdx% y%birdy% NoActivate
    SetTimer, GravityStart, Off
    SetTimer, Gravity, 0
    falling_start_time := A_TickCount
    Return
}

Gravity:
{
    if (jumping = true) {
        SetTimer, Gravity, Off
        jumping := false
        SetTimer, GravityStart, 0
        Return
    }
    falling_end_time := A_TickCount
    falling_time := falling_end_time - falling_start_time
    gravity_speed := gravity_speed + gravity_acceleration * falling_time
    if (gravity_speed > gravity_max_speed) {
        gravity_speed := gravity_max_speed
    }
    birdy := birdy + gravity_speed
    Gui, Bird:Show, x%birdx% y%birdy% NoActivate
    Return
}

;Gameover script, if the user goes below the map or touches the pipes this is the label the script will go to.
;Don't mistake it for gameover if going to the label, we must go to the gameoverstart label instead.

Gameover:
If birdy >= 600.0
{
SetTimer, Gameover, Off 
SetTimer, GravityStart, Off
SetTimer, Gravity, Off
SetTimer, Gameover, Off
SetTimer, PipeMove, Off
SetTimer, Checkforpipex, Off
Hotkey, *~Space, , Off
Gui, Gameover:New, -border -sysmenu -Caption
Gui, Gameover:Margin, 0, 0
Gui, Gameover:+ParentStart
Gui, Gameover:Font, s30 w700, Arial
Gui, Gameover:Add, Text, x0 y0,     YOU LOST `n Press F1 To Restart
Gui, Gameover:Show, Autosize x196 y257
Return
}
Return

;Goes to gameoverstart, or rather gameover if the bird is far too up and offscreen.
Gameoverup:
{
If birdy <= -50.0
{
Goto, Gameoverstart
Return
}
Return
}
   
;Gamover if the bird is far too up and offscreen.
Gameoverstart:
{
SetTimer, Gameoverup, Off
SetTimer, Gameover, Off 
SetTimer, GravityStart, Off
SetTimer, Gravity, Off
SetTimer, Gameover, Off
SetTimer, PipeMove, Off
SetTimer, Checkforpipex, Off
SetTimer, pipehitboxchecker, Off
SetTimer, scorecalculator, Off 
SetTimer, checkforpipexhitbox, Off
Hotkey, *~Space, , Off
Gui, Gameover:New, -border -sysmenu -Caption
Gui, Gameover:Margin, 0, 0
Gui, Gameover:+ParentStart
Gui, Gameover:Font, s30 w700, Arial
Gui, Gameover:Add, Text, x0 y0,     YOU LOST `n Press F1 To Restart
Gui, Gameover:Show, Autosize x196 y257
Return
}

;Moves the pipe continuesly with the pipespeedx variable
PipeMove:
{
pipex := pipex - pipespeedx
Gui, Pipes:Show, x%pipex% y%pipey% AutoSize
Return
}

;This checks whether or not the pipes are on the far left, if so teleport them back to the right.
Checkforpipex:
{
If pipex <= -100
 {
 Random, pipeyran, -300, 150
SetTimer, PipeMove, Off
pipex := 800
pipey := pipeyran ; 400 initial bottom and 300 initial top

SetTimer, PipeMove, 0
Return
 }
 Return
}

Return ;safe return i guess??? Why did i put this here, there's no reason for this return to exist other than a safe exit. ???
;Exit the program if the Gui/window doesn't exist.
SBNotExist:
IfWinNotExist, Bad Bird
ExitApp
Return

*~Space::
    if (jumping = false) {
        jumping := true
        gravity_speed := -3
        SetTimer, Gravity, 0
        SetTimer, GravityStart, 0
    }
return

;Testing Feature for reloading the script, remove afterwards
F1::
Reload

;Checks whether or not the pipes are near the bird and executes the check command for hitbox check
checkforpipexhitbox:
{
If pipex <= 235
 {
 If pipex >= 230
 {
  SetTimer, checkforpipexhitbox, Off
  SetTimer, pipehitboxchecker, 0
  score := score + 1
  Return
  }
 }
 Return
}

scorecalculator:
{
Gui, Score:Destroy
Gui, Score:New, -border -sysmenu -Caption
Gui, Score:Font, s20 w700, Arial
Gui, Score:Margin, 0, 0
Gui, Score:+ParentStart
Gui, Score:Add, Text, x0 y0 w175 h25, Score = %score%
Gui, Score:Show, x2 y5 Autosize
Return
}

;Checks whether or not the bird touches the pipes, if so end the game.
pipehitboxchecker:
    {
	HitBoxCheckActive = True
	idk :=pipey+three
    idkk :=pipey+four
                If birdy <= %idk%
				{
			    Goto, Gameoverstart
				}
				Else If birdy >= %idkk%
				{
			    Goto, Gameoverstart
				}
                Else If pipex <= 110
                {
					idk := 0
                    idkk := 0
                 SetTimer, checkforpipexhitbox, 0
                 SetTimer, pipehitboxchecker, Off
				 HitBoxCheckActive = False
				}
					idk := 0
                    idkk := 0
					HitBoxCheckActive = False
				Return
	}
Attachments
Bad Bird.rar
Bad Bird Game Version 0.01
(502.14 KiB) Downloaded 399 times
User avatar
Kenzis
Posts: 15
Joined: 01 May 2020, 13:05

Re: Flappy Bird but Bad [Game]

Post by Kenzis » 23 May 2023, 04:15

If the game keeps staying on systray, it's because you're playing it inside the winrar, extract the game [Bad Bird Folder] anywhere and play from there.
User avatar
SpeedMaster
Posts: 494
Joined: 12 Nov 2016, 16:09

Re: Flappy Bird but Bad [Game]

Post by SpeedMaster » 27 May 2023, 09:46

Extracting the archive file doesn't work. Can you post the images directly ?
User avatar
Kenzis
Posts: 15
Joined: 01 May 2020, 13:05

Re: Flappy Bird but Bad [Game]

Post by Kenzis » 27 May 2023, 10:39

SpeedMaster wrote:
27 May 2023, 09:46
Extracting the archive file doesn't work. Can you post the images directly ?
Sure i can post them directly, for them to act upon the game you must create a folder called data (Even tho there's one in the zip); the same place where the executable is.
You need to put all three images into the data folder and the game should work properly, else it checks for the images and it won't work.

Still don't understand how can't you extract the game, just the folder to any destionation, your desktop or wherever, In any case here are the images,

fe: (C:\Users\YourName\OneDrive\Radna površina\Bad Bird.exe) you should also put at the same destination the data folder, which in this case would be (C:\Users\YourName\OneDrive\Radna površina\data) the images that i attached should be put inside the data folder.

Also if you can explain to me why you can't extract maybe i can help, since that's really weird imop. :wtf:
Attachments
Pipes.png
Put into the data folder (same directory as the executable file, "the game")
Pipes.png (4.18 KiB) Viewed 5684 times
Bird.png
Put into the data folder (same directory as the executable file, "the game")
Bird.png (1.58 KiB) Viewed 5684 times
BadBirdBackground.png
Put into the data folder (same directory as the executable file, "the game")
BadBirdBackground.png (22.44 KiB) Viewed 5684 times
User avatar
SpeedMaster
Posts: 494
Joined: 12 Nov 2016, 16:09

Re: Flappy Bird but Bad [Game]

Post by SpeedMaster » 27 May 2023, 19:21

Thank you for the images and installation instructions.
The game works fine (AHK 1.1.36.02 Unicode x32 on WIN_7 64bit) :thumbup:
I've changed the background color of the GUI to black and inverted the colors of the images. It now looks like an old atari game. :HeHe:
Kenzis wrote:
27 May 2023, 10:39
Also if you can explain to me why you can't extract maybe i can help, since that's really weird imop.
The file contains an exe which is flagged as containing malware by my antivirus. :problem:
This may or may not be a false positive. How can I tell ? :wtf:
It is recommended not to post an exe file.
User avatar
Kenzis
Posts: 15
Joined: 01 May 2020, 13:05

Re: Flappy Bird but Bad [Game]

Post by Kenzis » 28 May 2023, 09:17

SpeedMaster wrote:
27 May 2023, 19:21
Thank you for the images and installation instructions.
The game works fine (AHK 1.1.36.02 Unicode x32 on WIN_7 64bit) :thumbup:
I've changed the background color of the GUI to black and inverted the colors of the images. It now looks like an old atari game. :HeHe:
Kenzis wrote:
27 May 2023, 10:39
Also if you can explain to me why you can't extract maybe i can help, since that's really weird imop.
The file contains an exe which is flagged as containing malware by my antivirus. :problem:
This may or may not be a false positive. How can I tell ? :wtf:
It is recommended not to post an exe file.

I'm glad it works
:dance:
The anti virus detects various exes as viruses or just doesn't allow you to open them unless you ignore it's warning.
I have no idea how to make it so that the anti virus doesn't falsely detect it, maybe it's better if the folder which you extract exclude from anti-virus.

Anyhow maybe when I'm free i can do a scan on the exe online so I can prove it is not a virus, it's just a compiled exe from the code above, but yet the anti virus won't & doesn't know that.

If i were to guess, this would only be a problem with Windows's own anti virus, others are probably not going to falsely detect them.
It also happens to me when I download other exes, matter of a fact it happens when I download java mods for Minecraft, but i excluded the downloads folder, since i will never download a virus.

(And that you should never do...of course, but because I'm so sure about myself that i won't download a virus I've just excluded it.) Also if i was to ever really use an anti virus Malwarebytes usually detects the Best and also it doesn't falsely detect exes. Which is cool (I used it a long time ago, when i was a kid and actually downloaded a virus, and it got rid of it, the virus also disabled Windows's anti virus, so Malwarebytes really helped out.) Interesting nonetheless. :bravo:
User avatar
boiler
Posts: 17706
Joined: 21 Dec 2014, 02:44

Re: Flappy Bird but Bad [Game]

Post by boiler » 28 May 2023, 09:53

Kenzis wrote:
I have no idea how to make it so that the anti virus doesn't falsely detect it, maybe it's better if the folder which you extract exclude from anti-virus.
Anyhow maybe when I'm free i can do a scan on the exe online so I can prove it is not a virus, it's just a compiled exe from the code above, but yet the anti virus won't & doesn't know that.
As SpeedMaster said, it’s better not to include the .exe file at all. How about just leaving it out? What’s the reason for including it or even having it at all? I assume you’re aware that .ahk files can be run directly without being compiled (after all, it’s not really compiling the code — just wrapping it with the AHK binary). If anyone wants to share the game with others who don’t have AHK installed, they can easily compile it themselves.
User avatar
Kenzis
Posts: 15
Joined: 01 May 2020, 13:05

Re: Flappy Bird but Bad [Game]

Post by Kenzis » 28 May 2023, 10:09

boiler wrote:
28 May 2023, 09:53
Kenzis wrote:
I have no idea how to make it so that the anti virus doesn't falsely detect it, maybe it's better if the folder which you extract exclude from anti-virus.
Anyhow maybe when I'm free i can do a scan on the exe online so I can prove it is not a virus, it's just a compiled exe from the code above, but yet the anti virus won't & doesn't know that.
As SpeedMaster said, it’s better not to include the .exe file at all. How about just leaving it out? What’s the reason for including it or even having it at all? I assume you’re aware that .ahk files can be run directly without being compiled (after all, it’s not really compiling the code — just wrapping it with the AHK binary). If anyone wants to share the game with others who don’t have AHK installed, they can easily compile it themselves.
Actually true, Guess i just didn't think about that, i could've just set it as a ahk program, and not compiled it
User avatar
boiler
Posts: 17706
Joined: 21 Dec 2014, 02:44

Re: Flappy Bird but Bad [Game]

Post by boiler » 28 May 2023, 10:14

Kenzis wrote: i could've just set it as a ahk program
I’m not sure what you mean by this. You shouldn’t have to “set” anything. You should be able to execute .ahk files as-is. If not, you probably have changed the default file association for .ahk files.
User avatar
Kenzis
Posts: 15
Joined: 01 May 2020, 13:05

Re: Flappy Bird but Bad [Game]

Post by Kenzis » 28 May 2023, 19:23

I have no idea how to edit my post, bot nontheless here i go with a reply. This is one TF2 level update
An update to Bad Bird has been released. The update will be applied automatically when you redownload Bad Bird. The major changes include:
➤ New score system
➤Completely rewritten from ground up, Now actually works as intented, Thanks to [Kliksphilip] for pointing this out.
➤ New restart system using new baz'ed tech
➤Now faster than ever before, works as intented.
➤ Updated the localization files

I've also tested soundplay, and i have yet to understand why when i play a soundeffect the game laggs really really badly. Also tried the difficulty system, maybe this could be done in the future, and ofcourse i've removed the virus :trollface:
No But rly, soundplay seems like a real problem, I've searched over the internet but haven't found a solution, there was a topic where someone talked about reading the sound file and storing it in the memory, but i was unsuccessful, so idk.

Also.. i did not compile the script, so everyone can use it normally. Have fun :bravo:

Code: Select all

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
#SingleInstance Force

IfNotExist, %A_ScriptDir%\data
{
MsgBox, 16, Error Data folder not found, `n The data folder no longer exists, or the game can not detect `n it. Put the data folder in the same directory as the game.
ExitApp
}

IfNotExist, %A_ScriptDir%\data\BadBirdBackground.png
{
MsgBox, 16, Error BadBirdBackground.png not found, `n The BadBirdBackground.png no longer exists, or the game can not detect it. `n Put the BadBirdBackground.png in the data folder, the same place where the game is located.
ExitApp
}

IfNotExist, %A_ScriptDir%\data\Pipes.png
{
MsgBox, 16, Error Pipes.png not found, `n The Pipes.png no longer exists, or the game can not detect it. `n Put the Pipes.png in the data folder, the same place where the game is located.
ExitApp
}

IfNotExist, %A_ScriptDir%\data\Bird.png
{
MsgBox, 16, Error Bird.png not found, `n The Bird.png no longer exists, or the game can not detect it. `n Put the Bird.png in the data folder, the same place where the game is located.
ExitApp
}

;Initial jumping value
jumping := false

;Initial gravity values
gravity_speed := 0.5
gravity_max_speed := 7
gravity_acceleration := 0.001

;Useless code which is made just for the sake of being there... But it is what it is...
three := 300
four := 400

;Variables to keep track of falling time
falling_start_time := 0
falling_end_time := 0
falling_time := 0

;Pipes Config
pipespeedx := 3 ;Speed in pixels.
pipex := 800
pipey := 0
pipeyran := 0

;Starting Coordinates
birdx := 196
birdy := 305 ;257

;Initial score
score := 0
subscore := 0

;Useless timer, and GUI's width and height.
checkforwindowtimer := 200
windowwidth := 800
windowheight := 600

;Check for gameover
SetTimer, Gameover, 0 

;Check if the bird is offscreen upside, if it is skip to gameoverstart
SetTimer, Gameoverup, 0

;Gravity 1.01 is slow 1.02 is fast
Gravity := 1.02

;Check for window if it doesn't exist, exitapp.
SetTimer, SBNotExist, %checkforwindowtimer%

;Starting Gui & Background GUI with an active starting button for the game.
Gui, Start:New, -sysmenu -border -Caption
Gui, Start:Margin, 0, 0
gui, Start:Font, s20 w700, Arial
Gui, Start:Add, Picture, x0 y0 w%windowwidth% h%windowheight%, %A_ScriptDir%\data\BadBirdBackground.png
gui, Start:Add, Text, w120 h130 x340 y100, F1 to restart `n F2 to QUIT
gui, Start:Show, Center w%windowwidth% h%windowheight%, Bad Bird
gui, Start:Add, Button, Center w120 h60 x340 y280 gStartbutt, START 
Hotkey, *~Space, , Off
return

;Gui of the game
Startbutt:
Hotkey, *~Space, , On
Gui, Start1:New
Gui, Start1:Show, Center w%windowwidth% h%windowheight%, Bad Bird
Gui, Start:Show, NoActivate
Gui, Start:Destroy
Gui, Start:New, -sysmenu -border -Caption
Gui, Start:Show, Center w%windowwidth% h%windowheight%, Bad Bird
Gui, Start:Color, White
Gui, Start1:Destroy

;Draw the pipes
Gui, Pipes:New, -sysmenu -border -Caption
gui, Pipes:Margin, 0, 0
Gui, Pipes:+ParentStart
Gui, Pipes:Add, Picture, x0 y0, %A_ScriptDir%\data\Pipes.png
Gui, Pipes:Show, x%pipex% y%pipey% AutoSize

;Draw the bird character.
Gui, Bird:New, -sysmenu -border -Caption
Gui, Bird:Margin, 0, 0
Gui, Bird:+ParentStart
Gui, Bird:Add, Picture, x-8 y-15 w64 h64, %A_ScriptDir%\data\Bird.png
Gui, Bird:Show, x%birdx% y%birdy% w52 h35

Gui, Score:New, -border -sysmenu -Caption
Gui, Score:Font, s20 w700, Arial
Gui, Score:Margin, 0, 0
Gui, Score:+ParentStart
Gui, Score:Add, Text, x0 y0 w175 h25, Score = %score%
Gui, Score:Show, x2 y5 Autosize

;Move the pipe to the right timer
SetTimer, Pipemove, 0

;Check for the score
SetTimer, scoretimercalc, 0

;Check for the pipe being near the bird and starting a hitbox check
SetTimer, checkforpipexhitbox, 0

;Check for pipex coord being on the far left and reset it.
SetTimer, Checkforpipex, 0

;Timer for score calculation
SetTimer, scorecalc, 0

;Bird's Own Gravity Timer
SetTimer, GravityStart, 0
falling_start_time := 0
SetTimer, Gravity, Off
Return

GravityStart:
{
    if (jumping = true) {
        SetTimer, GravityStart, Off
        SetTimer, Gravity, 0
        falling_start_time := A_TickCount
        Return
    }
    birdy := birdy +1
    falling_time := 0
    Gui, Bird:Show, x%birdx% y%birdy% NoActivate
    SetTimer, GravityStart, Off
    SetTimer, Gravity, 0
    falling_start_time := A_TickCount
    Return
}

Gravity:
{
    if (jumping = true) {
        SetTimer, Gravity, Off
        jumping := false
        SetTimer, GravityStart, 0
        Return
    }
    falling_end_time := A_TickCount
    falling_time := falling_end_time - falling_start_time
    gravity_speed := gravity_speed + gravity_acceleration * falling_time
    if (gravity_speed > gravity_max_speed) {
        gravity_speed := gravity_max_speed
    }
    birdy := birdy + gravity_speed
    Gui, Bird:Show, x%birdx% y%birdy% NoActivate
    Return
}

;Gameover script, if the user goes below the map or touches the pipes this is the label the script will go to.
;Don't mistake it for gameover if going to the label, we must go to the gameoverstart label instead.

Gameover:
If birdy >= 600.0
{
SetTimer, Gameover, Off 
SetTimer, GravityStart, Off
SetTimer, Gravity, Off
SetTimer, Gameover, Off
SetTimer, PipeMove, Off
SetTimer, scorecalc, Off
SetTimer, Checkforpipex, Off
Hotkey, *~Space, , Off
Gui, Gameover:New, -border -sysmenu -Caption
Gui, Gameover:Margin, 0, 0
Gui, Gameover:+ParentStart
Gui, Gameover:Font, s30 w700, Arial
Gui, Gameover:Add, Text, x0 y0,     YOU LOST `n Press F1 To Restart
Gui, Gameover:Show, Autosize x196 y257
Return
}
Return

;Goes to gameoverstart, or rather gameover if the bird is far too up and offscreen.
Gameoverup:
{
If birdy <= -50.0
{
Goto, Gameoverstart
Return
}
Return
}
   
;Gamover if the bird is far too up and offscreen.
Gameoverstart:
{
SetTimer, Gameoverup, Off
SetTimer, Gameover, Off 
SetTimer, GravityStart, Off
SetTimer, Gravity, Off
SetTimer, Gameover, Off
SetTimer, PipeMove, Off
SetTimer, Checkforpipex, Off
SetTimer, pipehitboxchecker, Off
SetTimer, scorecalc, Off
SetTimer, checkforpipexhitbox, Off
Hotkey, *~Space, , Off
Gui, Gameover:New, -border -sysmenu -Caption
Gui, Gameover:Margin, 0, 0
Gui, Gameover:+ParentStart
Gui, Gameover:Font, s30 w700, Arial
Gui, Gameover:Add, Text, x0 y0,     YOU LOST `n Press F1 To Restart
Gui, Gameover:Show, Autosize x196 y257
Return
}

;Moves the pipe continuesly with the pipespeedx variable
PipeMove:
{
pipex := pipex - pipespeedx
Gui, Pipes:Show, x%pipex% y%pipey% AutoSize
Return
}

;This checks whether or not the pipes are on the far left, if so teleport them back to the right.
Checkforpipex:
{
If pipex <= -100
 {
 Random, pipeyran, -300, 150
SetTimer, PipeMove, Off
pipex := 800
pipey := pipeyran ; 400 initial bottom and 300 initial top

SetTimer, PipeMove, 0
Return
 }
 Return
}

Return ;safe return i guess??? Why did i put this here, there's no reason for this return to exist other than a safe exit. ???
;Exit the program if the Gui/window doesn't exist.
SBNotExist:
IfWinNotExist, Bad Bird
ExitApp
Return

;Jump keybind
*~Space::
    if (jumping = false) {
        jumping := true
        gravity_speed := -3
        SetTimer, Gravity, 0
        SetTimer, GravityStart, 0
    }
return

;Checks whether or not the pipes are near the bird and executes the check command for hitbox check
checkforpipexhitbox:
{
If pipex <= 235
 {
 If pipex >= 230
 {
  SetTimer, checkforpipexhitbox, Off
  SetTimer, pipehitboxchecker, 0
  Return
  }
 }
 Return
}

;Checks whether or not the bird touches the pipes, if so end the game.
pipehitboxchecker:
    {
	HitBoxCheckActive = True
	idk :=pipey+three
    idkk :=pipey+four
                If birdy <= %idk%
				{
			    Goto, Gameoverstart
				}
				Else If birdy >= %idkk%
				{
			    Goto, Gameoverstart
				}
                Else If pipex <= 110
                {
					idk := 0
                    idkk := 0
                 SetTimer, checkforpipexhitbox, 0
                 SetTimer, pipehitboxchecker, Off
				 HitBoxCheckActive = False
				}
					idk := 0
                    idkk := 0
					HitBoxCheckActive = False
				Return
	}
	
Return

;Restart the game right way.
F1::
{
restart := true ;haha nub
IfNotExist, %A_ScriptDir%\data
{
MsgBox, 16, Error Data folder not found, `n The data folder no longer exists, or the game can not detect `n it. Put the data folder in the same directory as the game.
ExitApp
}

IfNotExist, %A_ScriptDir%\data\BadBirdBackground.png
{
MsgBox, 16, Error BadBirdBackground.png not found, `n The BadBirdBackground.png no longer exists, or the game can not detect it. `n Put the BadBirdBackground.png in the data folder, the same place where the game is located.
ExitApp
}

IfNotExist, %A_ScriptDir%\data\Pipes.png
{
MsgBox, 16, Error Pipes.png not found, `n The Pipes.png no longer exists, or the game can not detect it. `n Put the Pipes.png in the data folder, the same place where the game is located.
ExitApp
}

IfNotExist, %A_ScriptDir%\data\Bird.png
{
MsgBox, 16, Error Bird.png not found, `n The Bird.png no longer exists, or the game can not detect it. `n Put the Bird.png in the data folder, the same place where the game is located.
ExitApp
}

;Initial gravity values
jumping := false
gravity_speed := 0.5
gravity_max_speed := 7
gravity_acceleration := 0.001
pipeyran := 0
three := 300
four := 400

;Variables to keep track of falling time
falling_start_time := 0
falling_end_time := 0
falling_time := 0

;Pipes Config
pipespeedx := 3 ;Speed in pixels.
pipex := 800
pipey := 0

;Starting Coordinates
birdx := 196
birdy := 305 ;257
score := 0
subscore := 0
checkforwindowtimer := 200
windowwidth := 800
windowheight := 600

;Gui of the game
Gui, Gameover:Destroy
Hotkey, *~Space, , On
Gui, Start1:New, -sysmenu -border -Caption
Gui, Start1:Show, Center w%windowwidth% h%windowheight%, Bad Bird
Gui, Start:Show, NoActivate
Gui, Start:Destroy
Gui, Start:New, -sysmenu -border -Caption
Gui, Start:Show, Center w%windowwidth% h%windowheight%, Bad Bird
Gui, Start:Color, White
Gui, Start1:Destroy

;Draw the pipes
Gui, Pipes:New, -sysmenu -border -Caption
gui, Pipes:Margin, 0, 0
Gui, Pipes:+ParentStart
Gui, Pipes:Add, Picture, x0 y0, %A_ScriptDir%\data\Pipes.png
Gui, Pipes:Show, x%pipex% y%pipey% AutoSize

;Draw the bird character.
Gui, Bird:New, -sysmenu -border -Caption
Gui, Bird:Margin, 0, 0
Gui, Bird:+ParentStart
Gui, Bird:Add, Picture, x-8 y-15 w64 h64, %A_ScriptDir%\data\Bird.png
Gui, Bird:Show, x%birdx% y%birdy% w52 h35

Gui, Score:New, -border -sysmenu -Caption
Gui, Score:Font, s20 w700, Arial
Gui, Score:Margin, 0, 0
Gui, Score:+ParentStart
Gui, Score:Add, Text, x0 y0 w175 h25, Score = %score%
Gui, Score:Show, x2 y5 Autosize

SetTimer, Gameoverup, 0
SetTimer, Gameover, 0
SetTimer, GravityStart, 0
SetTimer, Gravity, 0
SetTimer, Gameover, 0
SetTimer, PipeMove, 0
SetTimer, Checkforpipex, 0
SetTimer, pipehitboxchecker, Off
SetTimer, scorecalc, 0
SetTimer, checkforpipexhitbox, 0
restart := false
}
Return

;Calculates the newest score, and displays it on the screen.
scorecalc:
{
If score = %subscore%
 {
 subscore := subscore + 1
Gui, Score:Destroy
Gui, Score:New, -border -sysmenu -Caption
Gui, Score:Font, s20 w700, Arial
Gui, Score:Margin, 0, 0
Gui, Score:+ParentStart
Gui, Score:Add, Text, x0 y0 w175 h25, Score = %score%
Gui, Score:Show, x2 y5 Autosize
 SetTimer, scorecalc, Off
 SetTimer, scoretimercalc, 10
Return
 }
 Return
}

;Check for the bird if it passed through the pipes, if it did give it the score.
scoretimercalc:
{
If pipex <= 175
 {
 If pipex >= 170
  {
  SetTimer, scoretimercalc, Off
  SetTimer, scorecalc, 10
      score := score + 1
  Return
  }
  Return
 }
}
Return

;fek it, the script sometimes just doesn't close even tho there is a settimer that looks for the exact window called Bad Bird, and yet
;it literally never detects it, idk what's the problem but this is a fix for now.
F2::
ExitApp

;also fek it.
!F4::
ExitApp
Attachments
Bad Bird 0.02.rar
Extract the folder anywhere on your desktop and you may run the game.
(53.24 KiB) Downloaded 348 times
william_ahk
Posts: 639
Joined: 03 Dec 2018, 20:02

Re: Flappy Bird but Bad [Game]

Post by william_ahk » 29 May 2023, 07:54

Kenzis wrote:
28 May 2023, 19:23
and ofcourse i've removed the virus :trollface:
I knew it :trollface:
Btw the movements will be a lot smoother by simply writing SetBatchLines -1
User avatar
Kenzis
Posts: 15
Joined: 01 May 2020, 13:05

Re: Flappy Bird but Bad [Game]

Post by Kenzis » 09 Mar 2024, 20:42

After a "small" TF2 update cycle, I came back to this project to just make the game harder, and also add a stutter and highscore calculator. If your FPS is below 1.0, it means your game is stuttering, and the game is slowed down. If at anytime your game goes below 1.0, then idk... get gud or smth.
[ with your hardware... ]
:?

- Changes :

* Made the game Harder, with the speed of pipes set to 7 [ double the amount of the original speed, hopefully making the game more challenging and fun].
* Changed the jump height, to a bit higher than before.
* Made a stutter calculator, which indicates if your game is stuttering or not. [ If your FPS shows 1.0 continuously (You're Fine) Otherwise if it shows a number below 1.0 sometimes or all the time (You're stuttering).
* Made the code easier to read
* Removed Unnecessary SetTimer.
* Removed the text at the start of the program. Now it's inside a readme.txt
* Added Highscore at the end of your game when you "lose".
* Moved the starting button a bit.
* etc. some text changes.
* - Note: The HighScore isn't kept after closing the game with hotkeys [F2] or [Alt + F4].
- If you press [F1] way too fast; too many times, the game will show an error, where the GUI of the game won't render fast enough, and the bird may or may not render. :crazy:

That's it, I don't think the game needed much changes, but this does spice it up a bit and make it more fun to play, since you can "actually" lose, if you make a mistake. ;)

Code: Select all

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
#SingleInstance Force
SetBatchLines, -1

; Variables for FPS calculation
StartTime := A_TickCount
Frames := 0

; FPS timer interval (in milliseconds)
FPSTimerInterval := 1000

IfNotExist, %A_ScriptDir%\data
{
    MsgBox, 16, Error Data folder not found, `n The data folder no longer exists, or the game cannot detect `n it. Put the data folder in the same directory as the game.
    ExitApp
}

IfNotExist, %A_ScriptDir%\data\BadBirdBackground.png
{
    MsgBox, 16, Error BadBirdBackground.png not found, `n The BadBirdBackground.png no longer exists, or the game can not detect it. `n Put the BadBirdBackground.png in the data folder, the same place where the game is located.
    ExitApp
}

IfNotExist, %A_ScriptDir%\data\Pipes.png
{
    MsgBox, 16, Error Pipes.png not found, `n The Pipes.png no longer exists, or the game can not detect it. `n Put the Pipes.png in the data folder, the same place where the game is located.
    ExitApp
}

IfNotExist, %A_ScriptDir%\data\Bird.png
{
    MsgBox, 16, Error Bird.png not found, `n The Bird.png no longer exists, or the game can not detect it. `n Put the Bird.png in the data folder, the same place where the game is located.
    ExitApp
}

;Initial jumping value
jumping := false

;Initial gravity values
gravity_speed := 0.5
gravity_max_speed := 7
gravity_acceleration := 0.001

;Useless code which is made just for the sake of being there... But it is what it is...
three := 300
four := 400

;Variables to keep track of falling time
falling_start_time := 0
falling_end_time := 0
falling_time := 0

;Pipes Config
pipespeedx := 7 ;Speed in pixels.
pipex := 800
pipey := 0
pipeyran := 0

;Starting Coordinates
birdx := 196
birdy := 305 ;257

;Initial score
highscore := 0
score := 0
subscore := 0

;Useless timer, and GUI's width and height.
checkforwindowtimer := 200
windowwidth := 800
windowheight := 600

;Check for gameover
SetTimer, Gameover, 0 

;Check if the bird is offscreen upside, if it is skip to gameoverstart
SetTimer, Gameoverup, 0

;Gravity 1.01 is slow 1.02 is fast
Gravity := 1.02

;Starting Gui & Background GUI with an active starting button for the game.
Gui, Start:New, -sysmenu -border -Caption
Gui, Start:Margin, 0, 0
gui, Start:Font, s20 w700, Arial
Gui, Start:Add, Picture, x0 y0 w%windowwidth% h%windowheight%, %A_ScriptDir%\data\BadBirdBackground.png
gui, Start:Show, Center w%windowwidth% h%windowheight%, Bad Bird
gui, Start:Add, Button, Center w120 h60 x340 y550 gStartbutt, START 
Hotkey, *~Space, , Off

; Set timer for FPS calculation
SetTimer, FPSCalculator, % FPSTimerInterval

return

; Gui of the game
Startbutt:
Hotkey, *~Space, , On
Gui, Start1:New
Gui, Start1:Show, Center w%windowwidth% h%windowheight%, Bad Bird
Gui, Start:Show, NoActivate
Gui, Start:Destroy
Gui, Start:New, -sysmenu -border -Caption
Gui, Start:Show, Center w%windowwidth% h%windowheight%, Bad Bird
Gui, Start:Color, White
Gui, Start1:Destroy

; Draw the pipes
Gui, Pipes:New, -sysmenu -border -Caption
gui, Pipes:Margin, 0, 0
Gui, Pipes:+ParentStart
Gui, Pipes:Add, Picture, x0 y0, %A_ScriptDir%\data\Pipes.png
Gui, Pipes:Show, x%pipex% y%pipey% AutoSize

; Draw the bird character.
Gui, Bird:New, -sysmenu -border -Caption
Gui, Bird:Margin, 0, 0
Gui, Bird:+ParentStart
Gui, Bird:Add, Picture, x-8 y-15 w64 h64, %A_ScriptDir%\data\Bird.png
Gui, Bird:Show, x%birdx% y%birdy% w52 h35

Gui, Score:New, -border -sysmenu -Caption
Gui, Score:Font, s20 w700, Arial
Gui, Score:Margin, 0, 0
Gui, Score:+ParentStart
Gui, Score:Add, Text, x0 y0 w175 h25, Score = %score%
Gui, Score:Show, x2 y5 Autosize

; Move the pipe to the right timer
SetTimer, Pipemove, 0

; Check for the score
SetTimer, scoretimercalc, 0

; Check for the pipe being near the bird and starting a hitbox check
SetTimer, checkforpipexhitbox, 0

; Check for pipex coord being on the far left and reset it.
SetTimer, Checkforpipex, 0

; Timer for score calculation
SetTimer, scorecalc, 0

; Bird's Own Gravity Timer
SetTimer, GravityStart, 0
falling_start_time := 0
SetTimer, Gravity, Off
Return

; Gravity start, handles gravity calculation when bird is not jumping
GravityStart:
{
    if (jumping = true) {
        SetTimer, GravityStart, Off
        SetTimer, Gravity, 0
        falling_start_time := A_TickCount
        Return
    }
    birdy := birdy + 1
    falling_time := 0
    Gui, Bird:Show, x%birdx% y%birdy% NoActivate
    SetTimer, GravityStart, Off
    SetTimer, Gravity, 0
    falling_start_time := A_TickCount
    Return
}

; Gravity, handles falling when bird is not jumping
Gravity:
{
    if (jumping = true) {
        SetTimer, Gravity, Off
        jumping := false
        SetTimer, GravityStart, 0
        Return
    }
    falling_end_time := A_TickCount
    falling_time := falling_end_time - falling_start_time
    gravity_speed := gravity_speed + gravity_acceleration * falling_time
    if (gravity_speed > gravity_max_speed) {
        gravity_speed := gravity_max_speed
    }
    birdy := birdy + gravity_speed
    Gui, Bird:Show, x%birdx% y%birdy% NoActivate
    Return
}

; Gameover script, handles game over conditions
Gameover:
If birdy >= 600.0
{
    SetTimer, Gameover, Off 
    SetTimer, GravityStart, Off
    SetTimer, Gravity, Off
    SetTimer, Gameover, Off
    SetTimer, PipeMove, Off
    SetTimer, scorecalc, Off
    SetTimer, Checkforpipex, Off
    Hotkey, *~Space, , Off
    Gui, Gameover:New, -border -sysmenu -Caption
    Gui, Gameover:Margin, 0, 0
    Gui, Gameover:+ParentStart
    Gui, Gameover:Font, s24 w700, Arial
    If not highscore >= score
    {
        highscore := score
    }
    Gui, Gameover:Add, Text, x0 y0,     YOU DIED `n Press F1 To Restart `n HighScore = %highscore%
    Gui, Gameover:Show, Autosize x196 y257
    Return
}
Return

; Goes to gameoverstart, or rather gameover if the bird is far too up and offscreen.
Gameoverup:
{
    If birdy <= -50.0
    {
        Goto, Gameoverstart
        Return
    }
    Return
}
   
; Gameover start, handles game over when bird is too far up
Gameoverstart:
{
    SetTimer, Gameoverup, Off
    SetTimer, Gameover, Off 
    SetTimer, GravityStart, Off
    SetTimer, Gravity, Off
    SetTimer, Gameover, Off
    SetTimer, PipeMove, Off
    SetTimer, Checkforpipex, Off
    SetTimer, pipehitboxchecker, Off
    SetTimer, scorecalc, Off
    SetTimer, checkforpipexhitbox, Off
    Hotkey, *~Space, , Off
    Gui, Gameover:New, -border -sysmenu -Caption
    Gui, Gameover:Margin, 0, 0
    Gui, Gameover:+ParentStart
    Gui, Gameover:Font, s24 w700, Arial
    If not highscore >= score
    {
        highscore := score
    }
    Gui, Gameover:Add, Text, x0 y0,     YOU DIED `n Press F1 To Restart `n HighScore = %highscore%
    Gui, Gameover:Show, Autosize x196 y257
    Return
}

; Moves the pipe continuously with the pipespeedx variable
PipeMove:
{
    pipex := pipex - pipespeedx
    Gui, Pipes:Show, x%pipex% y%pipey% AutoSize
    Return
}

; This checks whether or not the pipes are on the far left, if so teleport them back to the right.
Checkforpipex:
{
    If pipex <= -100
    {
        Random, pipeyran, -300, 150
        SetTimer, PipeMove, Off
        pipex := 800
        pipey := pipeyran ; 400 initial bottom and 300 initial top

        SetTimer, PipeMove, 0
        Return
    }
    Return
}

; Safe return
Return

; Jump keybind
*~Space::
    if (jumping = false) {
        jumping := true
        gravity_speed := -4
        SetTimer, Gravity, 0
        SetTimer, GravityStart, 0
    }
return

; Checks whether or not the pipes are near the bird and executes the check command for hitbox check
checkforpipexhitbox:
{
    If pipex <= 235
    {
        If pipex >= 230
        {
            SetTimer, checkforpipexhitbox, Off
            SetTimer, pipehitboxchecker, 0
            Return
        }
    }
    Return
}

; Checks whether or not the bird touches the pipes, if so end the game.
pipehitboxchecker:
{
    HitBoxCheckActive = True
    idk := pipey + three
    idkk := pipey + four
    If birdy <= %idk%
    {
        Goto, Gameoverstart
    }
    Else If birdy >= %idkk%
    {
        Goto, Gameoverstart
    }
    Else If pipex <= 110
    {
        idk := 0
        idkk := 0
        SetTimer, checkforpipexhitbox, 0
        SetTimer, pipehitboxchecker, Off
        HitBoxCheckActive = False
    }
    idk := 0
    idkk := 0
    HitBoxCheckActive = False
    Return
}

; Restart the game right away.
F1::
{
    restart := true ;haha nub
    IfNotExist, %A_ScriptDir%\data
    {
        MsgBox, 16, Error Data folder not found, `n The data folder no longer exists, or the game cannot detect `n it. Put the data folder in the same directory as the game.
        ExitApp
    }

IfNotExist, %A_ScriptDir%\data
{
    MsgBox, 16, Error Data folder not found, `n The data folder no longer exists, or the game cannot detect `n it. Put the data folder in the same directory as the game.
    ExitApp
}

IfNotExist, %A_ScriptDir%\data\BadBirdBackground.png
{
    MsgBox, 16, Error BadBirdBackground.png not found, `n The BadBirdBackground.png no longer exists, or the game can not detect it. `n Put the BadBirdBackground.png in the data folder, the same place where the game is located.
    ExitApp
}

IfNotExist, %A_ScriptDir%\data\Pipes.png
{
    MsgBox, 16, Error Pipes.png not found, `n The Pipes.png no longer exists, or the game can not detect it. `n Put the Pipes.png in the data folder, the same place where the game is located.
    ExitApp
}

IfNotExist, %A_ScriptDir%\data\Bird.png
{
    MsgBox, 16, Error Bird.png not found, `n The Bird.png no longer exists, or the game can not detect it. `n Put the Bird.png in the data folder, the same place where the game is located.
    ExitApp
}

    ; Initial gravity values
    jumping := false
    gravity_speed := 0.5
    gravity_max_speed := 7
    gravity_acceleration := 0.001
    pipeyran := 0
    three := 300
    four := 400

    ; Variables to keep track of falling time
    falling_start_time := 0
    falling_end_time := 0
    falling_time := 0

    ; Pipes Config
    pipespeedx := pipespeedx ;Speed in pixels.
    pipex := 800
    pipey := 0

    ; Starting Coordinates
    birdx := 196
    birdy := 305 ;257
    score := 0
    subscore := 0
    checkforwindowtimer := 200
    windowwidth := 800
    windowheight := 600

    ; Gui of the game
    Gui, Gameover:Destroy
    Hotkey, *~Space, , On
    Gui, Start1:New, -sysmenu -border -Caption
    Gui, Start1:Show, Center w%windowwidth% h%windowheight%, Bad Bird
    Gui, Start:Show, NoActivate
    Gui, Start:Destroy
    Gui, Start:New, -sysmenu -border -Caption
    Gui, Start:Show, Center w%windowwidth% h%windowheight%, Bad Bird
    Gui, Start:Color, White
    Gui, Start1:Destroy

    ; Draw the pipes
    Gui, Pipes:New, -sysmenu -border -Caption
    gui, Pipes:Margin, 0, 0
    Gui, Pipes:+ParentStart
    Gui, Pipes:Add, Picture, x0 y0, %A_ScriptDir%\data\Pipes.png
    Gui, Pipes:Show, x%pipex% y%pipey% AutoSize

    ; Draw the bird character.
    Gui, Bird:New, -sysmenu -border -Caption
    Gui, Bird:Margin, 0, 0
    Gui, Bird:+ParentStart
    Gui, Bird:Add, Picture, x-8 y-15 w64 h64, %A_ScriptDir%\data\Bird.png
    Gui, Bird:Show, x%birdx% y%birdy% w52 h35

    Gui, Score:New, -border -sysmenu -Caption
    Gui, Score:Font, s20 w700, Arial
    Gui, Score:Margin, 0, 0
    Gui, Score:+ParentStart
    Gui, Score:Add, Text, x0 y0 w175 h25, Score = %score%
    Gui, Score:Show, x2 y5 Autosize

    SetTimer, Pipemove, 0
    SetTimer, scoretimercalc, 0
    SetTimer, checkforpipexhitbox, 0
    SetTimer, Checkforpipex, 0
    SetTimer, scorecalc, 0
    SetTimer, GravityStart, 0
    falling_start_time := 0
    SetTimer, Gravity, Off
    Return
}

; Quit the program.
F2::
{
    ExitApp
    Return
}

; Timer for score calculation
scorecalc:
{
If score = %subscore%
 {
 subscore := subscore + 1
Gui, Score:Destroy
Gui, Score:New, -border -sysmenu -Caption
Gui, Score:Font, s20 w700, Arial
Gui, Score:Margin, 0, 0
Gui, Score:+ParentStart
Gui, Score:Add, Text, x0 y0 w175 h25, Score = %score%
Gui, Score:Show, x2 y5 Autosize
 SetTimer, scorecalc, Off
 SetTimer, scoretimercalc, 10
Return
 }
 Return
}

; Stutter calculator if below 1.0, this means your game is stuttering or the tickrate is below the normal threshold, since the tickrate or "fps" is suppossed to be at 1.0
FPSCalculator:
{
    Frames++
    CurrentTime := A_TickCount
    ElapsedTime := CurrentTime - StartTime
    if (ElapsedTime >= FPSTimerInterval) {
        FPS := (Frames / ElapsedTime) * 1000
        Gui, FPS_gui:New, -sysmenu -border -Caption
        Gui, FPS_gui:Margin, 0, 0
        Gui, FPS_gui:+ParentStart
        Gui, FPS_gui:Add, Text, x0 y0 w175 h25, FPS %FPS%
        Gui, FPS_gui:Show, x725 y5 AutoSize
        StartTime := CurrentTime
        Frames := 0
    }
    Return
}


; Check for score
scoretimercalc:
{
If pipex <= 175
 {
 If pipex >= 170
  {
  SetTimer, scorecalc, 10
      score := score + 1
  Return
  }
  Return
 }
}
Attachments
Bad Bird - Remaster.rar
The re-mastered 2024 version
(50.63 KiB) Downloaded 123 times
User avatar
lmstearn
Posts: 714
Joined: 11 Aug 2016, 02:32
Contact:

Re: Flappy Bird but Bad [Game]

Post by lmstearn » 09 Mar 2024, 22:07

Coming on nicely, :) And a handful of milestones:

  • Embed all data files in script.
  • <Enter> key to commence, restart game.
  • Text on starting screen: <Spacebar> to jump.
  • Selectable speed modes: Speedy, Normal, Granny.
  • Gap between pipes: Narrow, Normal, Wide
  • Coloured pipes (cached before each game)
  • Green colour for FPS 1.0, else orange or red.
  • Left arrow to slow bird, right arrow to accelerate bird.
  • Health bar: different penalties for hard/soft collision.
  • Esc: to exit game.

Sound wouldn't play here, jumpsound not in remaster file.
:arrow: itros "ylbbub eht tuO kaerB" a ni kcuts m'I pleH
User avatar
Kenzis
Posts: 15
Joined: 01 May 2020, 13:05

Re: Flappy Bird but Bad [Game]

Post by Kenzis » 10 Mar 2024, 00:38

lmstearn wrote:
09 Mar 2024, 22:07
Coming on nicely, :) And a handful of milestones:

  • Embed all data files in script.
  • <Enter> key to commence, restart game.
  • Text on starting screen: <Spacebar> to jump.
  • Selectable speed modes: Speedy, Normal, Granny.
  • Gap between pipes: Narrow, Normal, Wide
  • Coloured pipes (cached before each game)
  • Green colour for FPS 1.0, else orange or red.
  • Left arrow to slow bird, right arrow to accelerate bird.
  • Health bar: different penalties for hard/soft collision.
  • Esc: to exit game.

Sound wouldn't play here, jumpsound not in remaster file.
I saw your comment just a few moments ago on my phone, and yeah, these milestones are really good. I did have an idea long long ago for this project about the difficulty's and files being embedded into the program, but never got to it since i get so easily distracted. ADHD as much as it sucks, it also made me come back go this project so... Idk 😶, but i completely like those milestones, not even ideas, but this should be implemented. I say that as i will forget this in literally a day or so, but your comment is here and if i get strapped to my chair once again and look at this project. I will change it up with your milestones in mind. Also pipes getting random colors and accelerating the speed of the bird based on the arrow keys is a really smart concept. 🙂 👍 Thanks for the reply
User avatar
lmstearn
Posts: 714
Joined: 11 Aug 2016, 02:32
Contact:

Re: Flappy Bird but Bad [Game]

Post by lmstearn » 10 Mar 2024, 05:37

Cool, glad you found Chatgpt to be of some use. There's always plenty of time, and heaps of resources on hand in the site, and ... we'll be here as well.
Good luck. :)
:arrow: itros "ylbbub eht tuO kaerB" a ni kcuts m'I pleH
Post Reply

Return to “Gaming Scripts (v1)”