如果您曾经使用过Game Maker工具,那就有点像.我希望能够将我所有的声音,图像和其他类似内容都嵌入到单个C++可执行文件中.游戏制造商将有一个内置的编辑器,而且会对嵌入.gmk文件中的图像,而当你打开它,它会读取图像,并且在比赛中显示出来.我认为他保存的图像不是图像,而是存储在.gmk文件中的纯数据,由编辑器或写入.exe的解释器解释.我该如何制作类似的东西?
我现在在Game Maker中制作游戏,无法弄清楚如何获得对象的确切位置并让另一个对象移动到该位置.有人可以帮帮我吗?
我一直在努力简单地显示当前时间,无法在任何地方找到解决方案......对于错位的帖子感到抱歉.
我想要的只是在用户的电脑或手机上显示时间.
我能做的就是让时间显示在一个盒子里,而不是让它每秒都显示和更新.
这是我目前的代码
//store the current time
t=date_current_datetime();
//get the hour portion of that time
h=date_get_hour(t);
//get the minute portion of the time.
m=date_get_minute(t);
//get the second potion of the time
s=date_get_second(t);
//show the time
txt="The current time is:"+string(h)+":"+string(m)+":"+string(s);
show_message(txt);
Run Code Online (Sandbox Code Playgroud)
希望这个游戏制作者代码有意义,感谢任何帮助.
我正在使用SFML进行c ++游戏.我已经写了一个用于移动玩家的代码,但是当游戏启动玩家时,移动但是当我离开按钮时玩家返回其原始位置.可以帮助我吗?
主要的:
#include <iostream>
#include <SFML/Graphics.hpp>
int main() {
sf::RenderWindow window(sf::VideoMode(1320, 840), "Window");
window.setPosition(sf::Vector2i(150, 50));
window.setSize(sf::Vector2u(1320, 840));
window.getPosition();
window.setVerticalSyncEnabled(true);
window.setFramerateLimit(5);
window.getSize();
while (window.isOpen()) {
window.clear(sf::Color::White);
//texture
sf::Texture texture;
if (!texture.loadFromFile("/users/gaetanodonnarumma/desktop/background1.png", sf::IntRect(0, 0, 1320, 840))) {
return -1;
}
sf::Texture playerTexture;
if (!playerTexture.loadFromFile("/users/gaetanodonnarumma/desktop/quadrato-giallo.jpg", sf::IntRect(0, 0, 70, 70))) {
return -1;
}
//sprite
sf::Sprite backgroud;
backgroud.setTexture(texture);
sf::Sprite player;
double pX = 0;
double pY = 770;
player.setTexture(playerTexture);
player.setPosition(sf::Vector2f(pX, pY));
player.getPosition();
sf::Event event;
while (window.pollEvent(event)) {
if (event.type == sf::Event::Closed) {
window.close(); …Run Code Online (Sandbox Code Playgroud) 我制作了一个html5游戏(使用GameMaker),它由一个index.html和一个包含游戏依赖关系的文件夹"html5game"构成 - javascript代码和资源.问题是资源数量众多且多样化(声音,精灵等),客户需要它们才能发挥作用.
我正在寻找一种方法来发送它们而不具体命名它们.
我试过了glob模块:
var glob = require( 'glob' );
var files = glob.sync( './html5game/**' ).forEach( function( file ) {
require( path.resolve( file ) );
});
Run Code Online (Sandbox Code Playgroud)
但是,一旦我这样做,我无法找到使用res.sendFile()发送文件的方法.
我试过了
var express = require('express');
var app = express();
[...]
app.get('/aeronavale/jeu', function(req, res){
res.sendFile(__dirname + '/aeronavale/index.html');
res.sendFile(files)
});
[...]
app.listen(3000, function(){
console.log('app started on port 3000, yeah !')
})
Run Code Online (Sandbox Code Playgroud)
但它给了我错误:
TypeError: path argument is required to res.sendFile
Run Code Online (Sandbox Code Playgroud)
如果你有其他解决方案,我也有兴趣.谢谢你的回答!
我使用Game Maker为Windows创建简单(而不是简单)的2D游戏.
我真的很喜欢它.它易于使用,功能强大,可以让我快速创建游戏.
但现在我知道Python了.Python是我的新爱.
我想现在用Python创建游戏.我想拥有类似Game Maker的东西,但内部有Python.
谷歌搜索"python游戏引擎",我发现了这些:
1)PyGame
2)Cocos2D
3)搅拌机
4)Python-Ogre
也许我错了,但我发现:
1)PyGame并不比Game Maker更强大(对于Windows).最后一个问题是在2009年.
2)Cocos2D通常用于使用C#和Java创建移动游戏.它也不比Game Maker强大.
3)搅拌机是3D引擎.不要认为这是比Game Maker更容易创建2D游戏的方法.
4)Python-Ogre - 与Blender相同.
那么,你会推荐我什么?
我正在制作一个自上而下的射击游戏,并且玩家的枪支偏离了对象的坐标。我正在使用GameMaker:Studio,因此x和y坐标是对象的中心。图像的偏移量在此处设置:
bullet_offset_x = 30;
bullet_offset_y = 28;
Run Code Online (Sandbox Code Playgroud)
这是枪支射击的代码:
var xpos = x + (bullet_offset_x * cos(degtorad(direction))) - (bullet_offset_y * sin(degtorad(direction)));
var ypos = y + (bullet_offset_x * sin(degtorad(direction))) + (bullet_offset_y * cos(degtorad(direction)));
var flash = instance_create(xpos, ypos, obj_flash);
with (flash){
direction = other.direction;
image_angle = other.direction;
}
Run Code Online (Sandbox Code Playgroud)
我使用以下公式放置枪口闪光灯:
x'= x cos(角度)-y sin(角度)
y'= x sin(角度)+ y cos(角度)
因此:
xpos = x + x'和ypos = x + y'
但是,当我运行代码时,当角度为0/360时,枪口闪光灯已正确定位,否则关闭。我算错了吗?
图片:
正确

不正确的

我正在使用GameMaker:Studio Pro并尝试执行存储在变量中的脚本,如下所示:
script = close_dialog;
script_execute(script);
Run Code Online (Sandbox Code Playgroud)
它不起作用.它显然正在寻找一个名为"script"的脚本.谁知道我怎么能做到这一点?
我想在游戏制作器中制作一个包含5个子图像的精灵,当它到达最后一个精灵时,该精灵将停止,该如何使用代码来做到这一点?