前言
今天给大家推荐2种贼好用的模板[doge]
对了,最近作者没灵感了,要是各位小学生有什么主意,可以在评论区留下你的想法哦。或者之前的游戏有什么BUG,不对,是特性[doge]可以在评论区告诉我哦(火柴人跑酷已经停更,因为.......有好多奇怪的bug解决不了QwQ),私信我可能看不到!
哦,还有,或者你对之前的游戏有什么建议都可以在评论区告诉我哦!每一个评论我都会看的。
我会尽力去改进,要是遇到不懂的我也会查资料,要是还是不懂,就只能放弃了。
模板1(空白模板)
此模板适用于大部分小游戏
#include<time.h>
#include<iostream>
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
#include<graphics.h>
#include<windows.h>
#include<mmsystem.h>
#pragma comment(lib,"winmm.lib")
#define _CRT_SECURE_NO_WARNINGS
#define WIDTH 880
#define HEIGHT 540
void init() {
setbkcolor(WHITE);
cleardevice();
settextcolor(BLACK);
setlinecolor(BLACK);
setfillcolor(BLACK);
}
int main() {
initgraph(WIDTH, HEIGHT);
init();
while (1) {
}
_getch();
closegraph();
return 0;
}
模板2(进阶平面模板)
此模板适用于有可移动人物的小游戏,包括上下左右的平面移动(跑酷、射击)
#include<time.h>
#include<stdio.h>
#include<iostream>
#include<conio.h>
#include<stdlib.h>
#include<graphics.h>
#include<windows.h>
#include<mmsystem.h>
#pragma comment(lib,"winmm.lib")
#define _CRT_SECURE_NO_WARNINGS
#define WIDTH 880
#define HEIGHT 540
#define frame 20
void init() {
setbkcolor(WHITE);
cleardevice();
settextcolor(BLACK);
setlinecolor(BLACK);
setfillcolor(BLACK);
}
int x, y;
//IMAGE a;
int main() {
initgraph(WIDTH, HEIGHT);
init();
BeginBatchDraw();
while (1) {
if (GetAsyncKeyState(VK_LEFT)) {
x -= 5;
}
if (GetAsyncKeyState(VK_RIGHT)) {
x += 5;
}
if (GetAsyncKeyState(VK_UP)) {
y -= 5;
}
if (GetAsyncKeyState(VK_DOWN)) {
y += 5;
}
//loadimage(&a, L"", 0, 0);
//putimage(x, y, &a);
FlushBatchDraw();
Sleep(frame);
cleardevice();
}
_getch();
closegraph();
return 0;
}