game-maker

Spawn bullet at barrel of gun

百般思念 提交于 2021-02-09 13:57:46
问题 I'm making a top-down shooter and the player's gun is offset from the coordinates of the object. I'm using GameMaker:Studio, so the x and y coords are the center of the object. The offset of the image is set here: bullet_offset_x = 30; bullet_offset_y = 28; And here is the code for shooting the gun: 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

Gamemaker Studio 2: My character won’t transition through rooms

旧街凉风 提交于 2021-01-29 08:30:53
问题 I use transition code that I learned through a Udemy course, but the character in my game will only transition through the first door, and no others. I am using the same object but changing the creation code of the object. I use variables room_ , start_ . I use these to select different rooms and start positions within the creation code. Click the link to view video game - (https://drive.google.com/open?id=1jCWIM3hYymgspW54EPbnUDrNQVZbY_4B). 回答1: I fiddled with the project a bit, I understand

How to make water pour in GML?

人盡茶涼 提交于 2020-01-06 23:47:56
问题 How can I make water pour from a flask in game maker where have obj_flask , obj_water , and obj_container . I want to make the obj_water pour from obj_flask into the obj_container . 回答1: This depends hugely on how you want to achieve this effect. You could for example have an animated sprite stretching from the flask to the container. Or you could create water droplet instances at a given time rate and let them be affected by gravity. Or you could use a particle system, but this usually gives

Fast projectiles don't always hit

血红的双手。 提交于 2020-01-04 06:33:53
问题 So for my game, a have a fast moving Bullet object, with a sprite that's 5x5 (roughly). Moving at about a speed of 30, it needs to impact a relatively thin Enemy object with a thickness of only about 5 pixels. At certain regular intervals of distance, the Bullets pass through the enemy without a collision. I think its because the bullet is moving so fast that it happens to "jump" over the enemy, hence the regular intervals. other than increasing the width of the Bullet or Enemy, is there a

Weighted random number (without predefined values!)

泄露秘密 提交于 2019-12-23 04:48:09
问题 currently I'm needing a function which gives a weighted, random number. It should chose a random number between two doubles/integers (for example 4 and 8) while the value in the middle (6) will occur on average, about twice as often than the limiter values 4 and 8. If this were only about integers, I could predefine the values with variables and custom probabilities, but I need the function to give a double with at least 2 digits (meaning thousands of different numbers)! The environment I use

How to freeze sprite animation on last frame?

本小妞迷上赌 提交于 2019-12-13 02:55:48
问题 I want to make a sprite in game maker that contains 5 sub images to stop when it reaches the last one how can I do this using code? 回答1: In Animation End event: image_speed = 0; image_index = image_number - 1; 回答2: Run this in the Step even of your object: If image_index == 4 Then image_speed = 0; image_index is the index of the current frame in the object's sprite's animation, image_speed is the speed of the animation (in frames per step). This code just checks if the animation is at the

how to write a cga shader in glsl?

左心房为你撑大大i 提交于 2019-12-11 05:25:27
问题 How to write a CGA shader that limit the palette to 4 colors and match the original colors with those (cyan, magenta, black, white)?? I'm working on Game Maker Studio Professional, that actually allows the using of shaders writing vertex and fragment code I already asked this question also in the yoyogames community and in the openGl forum someone answered me with this : varying vec2 v_vTexcoord; varying vec4 v_vColour; const mat3 rgb_to_wcm = mat3(1,-1, 0, 1, 0,-1, -1, 1, 1); void main() {

How to embed resources into a single executable?

一曲冷凌霜 提交于 2019-12-07 01:24:39
问题 If you've ever used the tool Game Maker, it's a bit like that. I want to be able to take all my sounds, images, and everything else of the like and embed them into a single C++ executable. Game Maker would have a built-in editor, and would have the images embedded into the .gmk file, and when you'd open it it would read the images, and display them in the game. I'm thinking he had the images saved not as images, but as pure data stored in the .gmk file and interpreted by the editor or by some

How to embed resources into a single executable?

风格不统一 提交于 2019-12-05 04:56:17
If you've ever used the tool Game Maker, it's a bit like that. I want to be able to take all my sounds, images, and everything else of the like and embed them into a single C++ executable. Game Maker would have a built-in editor, and would have the images embedded into the .gmk file, and when you'd open it it would read the images, and display them in the game. I'm thinking he had the images saved not as images, but as pure data stored in the .gmk file and interpreted by the editor or by some interpreter written into the .exe. How would I go about making something similar? The windows resource

Sending whole folder content to client with express

安稳与你 提交于 2019-11-28 00:29:10
I made an html5 game (using GameMaker), which is constituted of an index.html and a folder "html5game" that contains the dependencies of the game - the javascript code and the resources. The problem is the resources are quite numerous and diverse (sounds, sprites, etc.) and The client needs them all to play. I am looking for a way to send them all without naming them specifically. I tried the glob module : var glob = require( 'glob' ); var files = glob.sync( './html5game/**' ).forEach( function( file ) { require( path.resolve( file ) ); }); but I can't figure a way to send the files using res