# Reefpirate

Member Since 23 Feb 2011
Offline Last Active May 09 2013 09:35 PM

### Room_Speed Lag?

09 May 2013 - 02:34 AM

Hey all,

So early on in making my game I was always testing it with 9999 room_speed to make sure that things were running fairly fast with what I wanted on screen. What I had on screen was able to stay above 500 fps at all times.

However, now that I've adjusted room_speed down to 60 (which I want for the 'final' game), the game occasionally drops below 60 fps when certain calculations happen. What gives? Is there any way I can try to fix this?

I figured if the game can run at 500 fps without a room_speed cap, that it should have no problem running at 60 fps?

EDIT: I'm using GM 8.1.

### Generating A Tile-Map From An Array

03 May 2013 - 01:46 AM

I'm trying to generate a tile map from an array of integers, but I am having trouble figuring out the easiest way to do this with GM.

In a lot of tile-map tutorials online people recommend assigning 'IDs' to tiles so that you can create a map from an array of these tile IDs. The first tile on a background would be Tile 0, the second tile would be Tile 1, etc. Then you can create an array like this:

0, 1, 1, 0

1, 1, 1, 1

1, 1, 1, 1

0, 1, 1, 0

If you scan through the array, you can then have a script place tiles according to whatever integer is at each spot.

It seems you can't do this simply in GM because you can't attach IDs to tiles. You have to specify the 'region' each time you want to place a tile! I can't say 'add Tile 1 at position x, y', I have to say 'take this arbitrary region from the given background and place it at x, y'.

What is the best way to do this??

The only thing that comes to mind is creating an object for each tile in my background, and have that object place the tile for me. Does anyone know a better way?

### Any way to turn off a collision mask?

26 January 2013 - 07:10 AM

So I have enemies in my game that do not get destroyed when they 'die'. However, after they are 'dead' and they are displaying their corpse sprites lying on the ground, other enemies and the player are still colliding with them. I do not want collision on the corpses.

Is there a simple and easy way to keep the same object displaying a sprite but no longer having collision? What I was thinking is just a quick way to 'turn off' the collision mask. Any ideas?

### Logic operations in Draw Event?

30 October 2012 - 10:32 PM

So I've read in places that it's bad practice to have logic operations (if statements, switches, etc) in your Draw Events. Is this true?

I keep finding myself needing to check variables in my Draw Events... Not a lot, but enough that I'm worried about hindering myself later on. How much should I be worried about this?

### How do I avoid friendly fire?

26 July 2012 - 03:46 AM

So I have a battle occuring in my game between 2 or more groups of 'soldiers'. For each soldier in a given group I want them to roll a 50% chance to score a 'hit'. When all the 'hits' are tallied up, I want to randomly select soldiers from the battlefield that are NOT friendly and remove them, ie. make them dead. It seemed like a simple battle system when I started, but it's turning out to be more difficult than I thought...

Here's roughly what I have so far:

var _hits, _soldiers, _outfit, _numSides;

_numSides = ds_list_size(_atkList); // this tells me how many groups are involved in the battle

for (j = 0; j < _numSides; j += 1)
{
_outfit[j]       = atk_FindValue(ds_list_find_value(_atkList, j), ATK_OUTFIT); // this tells me what faction this group is from
_soldiers[j]    = atk_FindValue(ds_list_find_value(_atkList, j), ATK_SOLDIERS_NUM); // this tells me how many soldiers that faction has in the battle
_hits[j]         = 0; // this will be where I store the number of hits the group scored per 'turn'
}

For now I'm thinking about making a list for each side in the battle with a list of the id's for that side's enemies. Then when trying to find out who to kill with which hits I can figure out which soldiers are enemies by fiddling with these lists. But that seems like a whole lot of mess for what seems to be a simple problem...

Any ideas? Tips? Help!