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.
---------------------------------------
Overall even with all these things that are bad and are easy fixes, but i don't wan't to fix em It still is pretty much Flappy Bird, but just really bad. Give it a go if you wan't , tho the code below won't work since you don't have
the pictures, so download the rar instead with the pictures
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 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
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
}