Doodle jump язык программирования

Saved searches

Use saved searches to filter your results more quickly

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

Classic platforming video game for web browsers

Meenakshi-Anand/DoodleJump

This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Sign In Required

Please sign in to use Codespaces.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching Xcode

If nothing happens, download Xcode and try again.

Launching Visual Studio Code

Your codespace will open once ready.

There was a problem preparing your codespace, please try again.

Latest commit

Git stats

Files

Failed to load latest commit information.

README.md

login page

Doodle Jump is a clone of the classic game, in which the character attempts hops up to earn points for each hop . He will be interrupted by enemies and collision with the enemies or falling down will result in losing the game .

In Doodle Jump users will be able to

  • There will be a control modal describing the rules.
  • Randomly seed initial data(bases) for play.
  • User will be able to hop up on bases in left and right.
  • User’s core will be the no of bases he has crossed over hopping.
  • Score will be visible while on play .

Doodle Jump will be a single-window game. The user will be able to move up ,left and right with the keyboard’s arrows.

Design Documentation

This project will be implemented with the following technologies:

  • Vanilla JavaScript for overall structure and game logic,
  • HTML5 Canvas for DOM manipulation and rendering,
  • PS5 for sound generation, processing and control.
  • Webpack to bundle and serve up the various scripts.

In addition to the webpack entry file, there will be four scripts involved in this project:

gameScreen.js: this script will handle the gaming logic .

sprite.js: this script will house the physics logic for the sprite.

audio.js: this script will handle the audio logic and the creation of AudioEvents based on the input parameters outlined above.

Setup the foundational framework . Ran through the basic logic to implement the game. Completed the design documentation .

  • Implement the basic logic of the game .
  • User moves up on jump to reach the next base failing will result in loosing the game.
  • Handle collision with enemies and displaying score .
  • Design the character and the backdrop .
  • Allow the user to acquire points based on the number of bases he has crossed.
  • Complete design and functionality.
  • Style the display and make sure that the everything is running smoothly.
  • A day to make sure the code, interface, and functionality is clean.
  • Controls on the bottom of the game’s window will allow the user to quit the game.
  • Add sound effects while the character falls down and sound effects for his jump .

About

Classic platforming video game for web browsers

Источник

Doodle Jump на pygame

Добрый…
Хочу рассказать и показать вам свой опыт знакомства с библиотекой pygame — предположительно отличной библиотекой для реализации графичиских приложений (в большей степени игр-аркад) на языке python. Для примера была реализована (частично) игра Doodle Jump.

Дисклеймер

  • Да, я использовал чужие картинки — мне стыдно и я скоро это исправлю.
  • Персонаж сейчас может только прыгать, но я планирую дописать игру до конца.
  • Да, идея не нова, но прикольно ведь получилось.
  • Да, скорее всего бред — использовать интерпретируемый язык для написания игр.
  • Я не профессиональный программист и это моя не основная деятельность.

Вместо введения

Python. Python великолепен в плане документации. Она есть, она понятна, она не лишена отличных примеров. Pygame — не исключение, поэтому предлагаю пока не останавливаться на подробностях реализации этой библиотеки, но необходимо заметить, что ее средства позволяют подгрузить изображение, и просто перемещать его по x и y. Ничего лишнего.

Архитектура

Постараемся разработатать архитектуру приложения в лучших традициях ООП. Имеем следующую диаграмму классов:

Сторонники MVC модели уже плачут, т.к. и логика и представление засунуты в тело класса.
Имеем 3 локации:

  • StartLocation — здесь крутится меню и приглашение к игре.
  • GameLocation — собственно сабж.
  • ExitLocation — выход, результаты, фанфары-овации.

Базовый объект Sprite, от которого наследуются все игровые объекты — платформы, кнопки, главный герой и т.д. По схеме все ясно.

Ключевые моменты

Events
 def event(self, event): if event.type == QUIT: sys.exit() elif event.type == KEYUP: if event.key == K_ESCAPE: # do something if event.type == MOUSEMOTION: for btn in self.buttons: if btn.rect.collidepoint(pygame.mouse.get_pos()): #pass btn.changeState(1)

С помощью механизма эвентов прозрачно перехватываются нажатия клавиш и манипуляции с мышью.

Изображения
 self.img_l = pygame.image.load('img/doodle_l.png').convert() self.image = self.img_l self.image.set_colorkey(self.image.get_at((0,0)), RLEACCEL) self.rect = self.image.get_rect() self.rect.center = (self.x,self.y)

Подгружаем картинки для спрайтов.

Столкновения
self.doodle.getLegsRect().colliderect(spr.getSurfaceRect())

Метода coliderect возвращает true, если прямоугольники, ограничивающие спрайты пересекаются.

Пара скриншотов


ToDo

  • Проработать гемплей
  • Нарисовать новые спрайты
  • Добавить звуки
  • Добавить статистику
  • Поправить алгоритмы расположения платформ
  • Добавить управление стрелками
  • Что еще?

Вместо послесловия

Знакомство с pygame можно считать законченым, дудлер прыгает и радуется жизни, но нагрузка процессора при этом стремится к 50-70%, что не есть гуд. Что это, говнокод плохая архитектура приложения или особенности языка — решать вам. Спасибо за внимание.
Исходники на github.

Источник

Doodle jump: microbit python game tutorial

Doodle jump: microbit python game tutorial

This tutorial will talk you through how to write, test, debug and improve the python code for a doodle jump style game on a BBC micro:bit.

Challenging

This microbit python game tutorial is possibly a little too advanced for beginners so have a look at some of the other tutorials if you’re just getting started or jump straight in here if you’re feeling confident.

Doodle jump is a brilliantly simple but infuriatingly addictive game where you have to control a green alien by moving it left and right to jump up to the next platform, as the world falls away beneath it. The original game won an Apple design award and it quickly took the gaming world by storm. You can play it here (it’s likely to be blocked if you’re viewing this tutorial page in school). The challenge of this tutorial is to attempt to scale down the game so it still works on a 5×5 LED screen on the BBC micro:bit whilst still being fun to play.

Try it with code

Below is a sample of the doodle jump game that we’ll create using this tutorial.

Press Ctrl + Enter to run the code, or click on the run button that appears when you click on the button in the bottom right corner of the code editor.

Press button A to move left and button B to move right.

If you want to test the game on an actual micro:bit, plug it into your computer, run the code and click on Download HEX and save that file onto your micro:bit.

Источник

Читайте также:  Производственная практика разработка приложений
Оцените статью