0% found this document useful (0 votes)
8 views19 pages

Stick Boy Run Game Project Overview

The document certifies the project titled 'Stick Boy Run Game' submitted by Bothe Yadnya Uday under the guidance of Mr. M.V. Khasne at Sanjivani K.B.P. Polytechnic. It includes acknowledgments to faculty members for their support and outlines the game's mechanics, which involve controlling a stickman character to jump across platforms and reach a door. The project is developed using Python and Tkinter, and the conclusion suggests potential improvements for the game.

Uploaded by

yadnyabothe
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views19 pages

Stick Boy Run Game Project Overview

The document certifies the project titled 'Stick Boy Run Game' submitted by Bothe Yadnya Uday under the guidance of Mr. M.V. Khasne at Sanjivani K.B.P. Polytechnic. It includes acknowledgments to faculty members for their support and outlines the game's mechanics, which involve controlling a stickman character to jump across platforms and reach a door. The project is developed using Python and Tkinter, and the conclusion suggests potential improvements for the game.

Uploaded by

yadnyabothe
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

SANJIVANI RURAL EDUCATION SOCITY,

KOPARGOAN
SANJIVANI [Link].

THIS IS TO CERTIFY THAT PROJECT


ENTITLED:

“STICK BOY RUN GAME ”

Submitted By
Bothe Yadnya Uday(27)

Under the guidance of: [Link]


DEPARTMENT OF
COMPUTERTECHNOLOGY (2024-2025 )
CERTIFICATE
Department Of Diploma in Computer
Technology Sanjivani K.B.P.
Polytechnic, Kopargoan.

This is to certify that project entitled:


“STICK BOY RUN GAME”

Submitted By:
Bothe Yadnya Uday(27)

[Link] [Link] [Link]


(Guide) (H.O.D) (Principal)
ACKNOWLEDGEMENT
First and the foremost We , express our deep sense of gratitude,
sincere thanks and deep sense of appreciation to Project Guide
[Link], Department of Computer Technology, Sanjivani
K.B.P. Polytenic, Kopargaon. Your availability at anytime
throughout the year, valuable guidance, opinion, view, comments,
critics, encouragement, and support tremendously boosted this
project work. Lots of thanks to Head of Computer Technology
Department, [Link] for providing us the best support we
ever had. We like to express our sincere gratitude to
[Link], Principal, Sanjivani K. B. P. Polytechnic,
Kopargaon for providing a great platform to complete the project
within the scheduled time. We are also Thankful to all the faculty
members, Computer Technology Department, Sanjivani K. B. P.
Polytechnic, Kopargaon for giving comments for improvement of
work, encouragement and help during completion of the Project.

Bothe Yadnya Uday(27)


Diploma in Computer Technology

Saniivani K.B.P. Polytechnic, Kopargaon


INRODUCTION
The Simple Stick Boy Run Game was built using Python module where it has a
simple library that can move and modify an object. The game is played in a simple
windowed interface that comes with a sprite of the stickman and background
sprites of a platform. The player can control the stick man via keyboard bindings
(Left Arrow Key to turn left, Right Arrow Key to turn right, Space Bar to jump).
The game is very simple you just need to jump across the platform and enter the
door as fast as you can. The stick man will continue to move when you turn in any
side. The Simple Stick Boy Run Game is simple arcade style platform game where
your goal is to enter the yellow door.

SOURCE CODE:
from tkinter import *

import random

import time

class Game:

def init (self):

[Link] = Tk()

[Link]("Stick Boy")

[Link](0, 0)

[Link].wm_attributes("-topmost", 1)

[Link] = Canvas([Link], width=500, height=500, highlightthickness=0)

[Link]()

[Link]()

self.canvas_height = 500
self.canvas_width = 500

[Link] = PhotoImage(file="[Link]")

w = [Link]()

h = [Link]()

for x in range(0, 5):

for y in range(0, 5):

[Link].create_image(x * w, y * h, image=[Link],

anchor='nw') [Link] = []

[Link] = True

self.game_over_text = [Link].create_text(250, 250, text='YOU WIN!', font =


('Times', 30), state='hidden', fill = '#ffd561')

[Link] = [Link].create_text(58, 22, text = 'EXIT', font = ('Times', 7), fill =


'#f56e6e')

def mainloop(self):

while 1:

if [Link]:

for sprite in [Link]:

[Link]()

else:

[Link](1)

[Link](self.game_over_text, state='normal')

[Link].update_idletasks()

[Link]()
[Link](0.02)

class Coords:

def init (self, x1=0, y1=0, x2=0, y2=0):

self.x1 = x1

self.y1 = y1

self.x2 = x2

self.y2 = y2

def within_x(co1, co2):

if (co1.x1 > co2.x1 and co1.x1 < co2.x2) or (co1.x2 > co2.x1 and co1.x2 < co2.x2) or
(co2.x1 > co1.x1 and co2.x1 < co1.x2) or (co2.x2 > co1.x1 and co2.x2 < co1.x1):

return True

else:

return False

def within_y(co1, co2):

if (co1.y1 > co2.y1 and co1.y1 < co2.y2) or (co1.y2 > co2.y1 and co1.y2 < co2.y2) or
(co2.y1 > co1.y1 and co2.y1 < co1.y2) or (co2.y2 > co1.y1 and co2.y2 < co1.y1):

return True

else:

return False

def collided_left(co1, co2):


if within_y(co1, co2):

if co1.x1 <= co2.x2 and co1.x1 >= co2.x1:

return True

return False

def collided_right(co1, co2):

if within_y(co1, co2):

if co1.x2 >= co2.x1 and co1.x2 <= co2.x2:

return True

return False

def collided_top(co1, co2):

if within_x(co1,

co2):

if co1.y1 <= co2.y2 and co1.y1 >= co2.y1:

return True

return False

def collided_bottom(y, co1,

co2): if within_x(co1,

co2):

y_calc = co1.y2 + y

if y_calc >= co2.y1 and y_calc <= co2.y2:

return True

return False
class Sprite:

def init (self, game):

[Link] = game

[Link] = False

[Link] = None

def move(self):

pass

def coords(self):

return [Link]

class PlatformSprite(Sprite):

def init (self, game, photo_image, x, y, width, height):

Sprite. init (self, game)

self.photo_image = photo_image

[Link] = [Link].create_image(x, y, image=self.photo_image,


anchor='nw')

[Link] = Coords(x, y, x + width, y + height)

class MovingPlatformSprite(PlatformSprite):

def init (self, game, photo_image, x, y, width, height):

PlatformSprite. init (self, game, photo_image, x, y, width, height)

self.x = 2

[Link] = 0
self.last_time = [Link]()

[Link] = width

[Link] = height

def coords(self):

xy = [Link]([Link])

[Link].x1 = xy[0]

[Link].y1 = xy[1]

[Link].x2 = xy[0] + [Link]

[Link].y2 = xy[1] + [Link]

return [Link]

def move(self):

if [Link]() - self.last_time > 0.03:

self.last_time = [Link]()

[Link]([Link], self.x, 0)

[Link] += 1

if [Link] > 20:

self.x *= -1

[Link] = 0

class DoorSprite(Sprite):

def init (self, game, x, y, width, height):#hei1353


Sprite. init (self, game)

self.closed_door = PhotoImage(file="[Link]")

self.open_door = PhotoImage(file="[Link]")

[Link] = [Link].create_image(x, y, image=self.closed_door,


anchor='nw')

[Link] = Coords(x, y, x + (width / 2), y + height)

[Link] = True

def opendoor(self):

[Link]([Link], image=self.open_door)

[Link].update_idletasks()

def closedoor(self):

[Link]([Link], image=self.closed_door)

[Link].update_idletasks()

class StickFigureSprite(Sprite):

def init (self, game):

Sprite. init (self, game)

self.images_left = [

PhotoImage(file="[Link]"),

PhotoImage(file="[Link]"),

PhotoImage(file="[Link]")

self.images_right = [
PhotoImage(file="[Link]"),

PhotoImage(file="[Link]"),

PhotoImage(file="[Link]")

[Link] = [Link].create_image(200, 470, \

image=self.images_left[0], anchor='nw')

self.x = -2

self.y = 0

self.current_image = 0

self.current_image_add = 1

self.jump_count = 0

self.last_time = [Link]()

[Link] = Coords()

[Link].bind_all('<KeyPress-Left>', self.turn_left)

[Link].bind_all('<KeyPress-Right>', self.turn_right)

[Link].bind_all('<space>', [Link])

def turn_left(self, evt):

if self.y == 0:

self.x = -2

def turn_right(self, evt):

if self.y == 0:

self.x = 2

#brought to you by [Link]


def jump(self, evt):

if self.y == 0:

self.y = -4

self.jump_count = 0

def animate(self):

if self.x != 0 and self.y == 0:

if [Link]() - self.last_time > 0.1:

self.last_time = [Link]()

self.current_image += self.current_image_add

if self.current_image >= 2:

self.current_image_add = -1

if self.current_image <= 0:

self.current_image_add = 1

if self.x < 0:

if self.y != 0:

[Link]([Link],
image=self.images_left[2])

else:

[Link]([Link],
image=self.images_left[self.current_image])

elif self.x > 0:

if self.y != 0:

[Link]([Link],
image=self.images_right[2])
else:

[Link]([Link],
image=self.images_right[self.current_image])

def coords(self):

xy = [Link]([Link])

[Link].x1 = xy[0]

[Link].y1 = xy[1]

[Link].x2 = xy[0] + 27

[Link].y2 = xy[1] + 30

return [Link]

def move(self):

[Link]()

if self.y < 0:

self.jump_count += 1

if self.jump_count > 20:

self.y = 4

if self.y > 0:

self.jump_count -= 1

co = [Link]()

left = True

right = True

top = True
bottom = True

falling = True

if self.y > 0 and co.y2 >= [Link].canvas_height:

self.y = 0

bottom = False

elif self.y < 0 and co.y1 <= 0:

self.y = 0

top = False

if self.x > 0 and co.x2 >= [Link].canvas_width:

self.x = 0

right = False

elif self.x < 0 and co.x1 <= 0:

self.x = 0

left = False

for sprite in [Link]:

if sprite == self:

continue

sprite_co = [Link]()

if top and self.y < 0 and collided_top(co, sprite_co):

self.y = -self.y

top = False

if bottom and self.y > 0 and collided_bottom(self.y, co, sprite_co):

self.y = sprite_co.y1 - co.y2


if self.y < 0:

self.y =

0 bottom =

False top =

False

if bottom and falling and self.y == 0 and co.y2 < [Link].canvas_height


and collided_bottom(1, co, sprite_co):

falling = False

if left and self.x < 0 and collided_left(co, sprite_co):

self.x = 0

left = False

if [Link]:

[Link](sprite)

if right and self.x > 0 and collided_right(co, sprite_co):

self.x = 0

right = False

if [Link]:

[Link](sprite)

if falling and bottom and self.y == 0 and co.y2 < [Link].canvas_height:

self.y = 4

[Link]([Link], self.x, self.y)

def end(self, sprite):

[Link] = False

[Link]()
[Link](1)

[Link]([Link], state='hidden')

[Link]()

g = Game()

platform1 = PlatformSprite(g, PhotoImage(file = "[Link]"), 0, 480, 100, 10)

platform2 = PlatformSprite(g, PhotoImage(file = "[Link]"), 150, 440, 100, 10)

platform3 = PlatformSprite(g, PhotoImage(file = "[Link]"), 300, 400, 100, 10)

platform4 = PlatformSprite(g, PhotoImage(file = "[Link]"), 300, 160, 100, 10)

platform5 = PlatformSprite(g, PhotoImage(file = "[Link]"), 175, 350, 66, 10)

platform6 = PlatformSprite(g, PhotoImage(file = "[Link]"), 50, 300, 66, 10)

platform7 = PlatformSprite(g, PhotoImage(file = "[Link]"), 170, 120, 66, 10)

platform8 = PlatformSprite(g, PhotoImage(file = "[Link]"), 45, 60, 66, 10)

platform9 = PlatformSprite(g, PhotoImage(file = "[Link]"), 170, 250, 32, 10)

platform10 = PlatformSprite(g, PhotoImage(file = "[Link]"), 230, 200, 32, 10)

[Link](platform1)

[Link](platform2)

[Link](platform3)

[Link](platform4)

[Link](platform5)

[Link](platform6)

[Link](platform7)
[Link](platform8)

[Link](platform8)

[Link](platform9)

[Link](platform10)

door = DoorSprite(g, 45, 30, 40, 35)

[Link](door)

sf = StickFigureSprite(g)

[Link](sf)

[Link]()

OUTPUT:
CONCLUSION
In this article, we have created a simple Stickman game in python with the help of
the Tkinter library. You can try to make the game more interesting and challenging
by adding obstacles on the way or decreasing the health of the Stickman Game in
Python whenever it falls down on the ground. Hope this article will help you.

REFERENCES
 [Link]
 [Link]
Jason-R.-Briggs1

You might also like