C语言,如下:
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <windows.h>
int main()
{
HANDLE hOutput = GetStdHandle(STD_OUTPUT_HANDLE); //获取控制台输出的窗口句柄
int t = 1; //定义时间变量
while (t++) //实现循环并让时间自增
{
COORD huoquan;
COORD xiangling = { 40,15 };
int R = 13; //定义火圈位置和半径、以及香菱位置
huoquan.X = xiangling.X + 2 * R * cos(t * 0.2);//利用余弦函数计算火圈x坐标
huoquan.Y = xiangling.Y + R * sin(t * 0.2); //利用正弦函数计算火圈y坐标
system("cls"); //清空屏幕
SetConsoleCursorPosition(hOutput, xiangling);
printf("香菱"); //设置香菱坐标,打印香菱
SetConsoleCursorPosition(hOutput, huoquan);
printf("火圈"); //设置火圈坐标,打印火圈
CONSOLE_CURSOR_INFO curInfo = { 1,FALSE };
SetConsoleCursorInfo(hOutput, &curInfo); //这两句话用来将光标进行隐藏
}
}
这个代码可以实现香菱大招的效果()。
虽然看不懂但就是十分牛逼hhh。
代码来源:b站up 英雄哪里出来