超级玛丽游戏编程制作的目的 用编程做的超级马里奥游戏

沐流尘2022-06-28 20:16:22情感884

哈喽!哈喽!我是木木子,今日游戏更新——超级玛丽华丽上线啦!

“超级玛丽”有多少人还记得这款经典游戏?对于90、00后应该不大熟悉,但多多少少印象中见过

那个戴帽子的大胡子穿着背带裤的马里奥!

这款游戏1985年发售,因上手简单、情节有趣等因素迅速走红!

​

陪伴70后、80后走过了青涩难忘的童年超级玛丽成了大家心目中的经典!

如果你的童年也曾被魔性的 灯~灯灯~灯~灯灯~灯洗脑那就接着来怀旧一番吧~

今天木木子就带着大家自制一款超级玛丽游戏,还原度超高哦~还在等什么动动手就能拥有属于自

己的”超级玛丽“游戏呢,赶快学起来吧‍‍~

正文

嗯呐~写游戏Python还是用的Pygame模块啦

1)准备中

1.1环境安装

Python3、Pycharm、Pygame模块很多自带的模块等。

模块安装统一用的豆瓣镜像源:​

pip install -i https://pypi.douban.com/simple/ +模块名。

1.2图片素材+背景音乐+字体(可修改)

​

2)开始敲代码

2.1 运行程序:mario_level_1.py。

39;超级玛丽-源码基地:&34;&34;This is an attempt to recreate the first level ofSuper Mario Bros for the NES.&34;&39;__main__&39;Python源码基地:人&34;&34;This module initializes the display and creates dictionaries of resources.&34;&39;SDL_VIDEO_CENTERED&39;1&34;resources&34;fonts&34;resources&34;music&34;resources&34;graphics&34;resources&34;sound&39;Python源码基地:&34;&34;Handles all sound for the game&34;&34;&34;Initialize the class&34;&34;&34;Sets music for level&34;&39;main_theme&39;game_over&34;&34;Updates sound object with game info&34;&34;&34;Handles the state of the soundn object&34;&39;death&39;invincible&39;flagpole&39;out_of_time&39;stage_clear&39;count_down&39;count_down&39;main_theme_sped_up&39;death&39;death&39;flagpole&39;main_theme&39;death&34;&34;Plays new music&34;&34;&34;Stops playback&34;&39;源码基地:&34;&34;Individual digit for score&34;&34;&34;Scores that appear, float up, and disappear&34;&39;item_objects&34;&34;Creates the dictionary for all the number 图片 needed&34;&39;0&39;1&39;2&39;4&39;5&39;8&39;3&39;7&39;9&34;&34;Extracts image from sprite sheet&34;&34;&34;Creates the group of 图片 based on score received&34;&34;&34;Set the rect attributes for each image in self.image_list&34;&34;&34;Updates score movement&34;&34;&34;Draws score numbers onto screen&34;&34;&34;Check if scores need to be deleted&34;" for i, score in enumerate(score_list): if int(score.score_string) == 1000: if (score.y - score.digit_list[0].rect.y) > 130: score_list.pop(i) else: if (score.y - score.digit_list[0].rect.y) > 75: score_list.pop(i)

​3)完整的游戏

由于代码太多太多了如下图所示:所以还是放在文末自己拿完整的代码哈!

​4)效果展示(仅部分)

4.0 展示动态视频一波,完美。

4.1 Part 1 游戏运行界面——

​

​4.2 Part 2 三条命——

4.3 Part 3 吃了蘑菇的马里奥——

总结

虽然现在市面上冲击着各种游戏,但在我们心目中马里奥依旧是那个留着意式大胡子,上天遁地,

无所不能,头顶金币,脚踏乌龟拯救公主的超级英雄!

对游戏感兴趣的小伙伴儿赶紧自己动手造一个吧~

你们的支持是我最大的动力!!记得三连哦~mua 欢迎大家阅读往期的文章哦~

扫描二维码推送至手机访问。

版权声明:本文由虾皮情感网发布,如需转载请注明出处。

本文链接:https://xiopi.com/article/7600.html

分享给朋友:

发表评论

访客

◎欢迎参与讨论,请在这里发表您的看法和观点。