Jump to content


AndrewFM

Member Since 21 Jun 2005
Offline Last Active Jan 20 2013 01:22 AM

Topics I've Started

Using Surfaces instead of Multiple Views

05 February 2011 - 04:53 AM

My game is divided into 3 different layers, which are currently being rendered by using multiple views:

Posted Image

My goal is to try to remake this same system, just using surfaces instead of views. The reason I'm using separate layers like this, is because they all use different zoom scales. The BG Layer is always at 1x zoom. The Game Layer changes zoom constantly depending on what's going on in the game. The Foreground layer is always at 2x zoom.

The reason why I want to use surfaces instead of views is because GM's views don't scale properly on certain graphics cards. It creates seams between tiles and other game objects:

Posted Image

However, while attempting to convert the view method to surfaces, I've been unable to figure out a way to replicate it 100% accurately. Using a single surface which captures the entire screen, everything is forced to be the same scale. When using 3 different surfaces to contain the 3 different layers, the background of the Game Layer does not appear transparent, and obscures the BG layer:

Posted Image

So my question is, what do you think is the best method to approach this situation? Can you think of some way to replicate the view method without creating those ugly seams?

Drawing Independently From The View

22 February 2010 - 04:11 AM

Lets say I'm drawing a HUD, and I want the HUD to stay at a specific section on the screen, unaltered by anything going on with the actual camera following the player.

Well, in most cases, that'd be an easy fix. Just set the HUD's drawing coordinates to (view_xview+xoffset,view_yview+yoffset).

However, a simple solution like that won't work when you either change the angle of the view, or change the size of the viewport, so that the view is zoomed in or out.

What I'm looking to do is draw the HUD completely independent from the view, so that no matter what the view is doing, the HUD remains safe on it's own little "layer". Is there even a way to do this, without having to make my own camera system to substitute GM's built in one?

Partner

04 April 2009 - 01:57 AM

Partner is a quick little game I made in a little less than a week. The premise of the game involves solving complex puzzles that require multiple people working together simultaneously to solve. However, it's not a multilayer game; not in the least. This game is completely single player.

It's hard to wrap your mind around how this could possibly work, but you'll be working together with yourself like a pro within minutes. It's not a difficult game to play, or a difficult game to learn, but it's a difficult game to master. It requires a lot of thought, and a lot of planning.

Good luck!

The game includes 14 levels of progressive difficulty.

http://www.yoyogames...ames/show/76356

Screenshots

Posted Image

Posted Image

Posted Image

Playing A Single Sound With Multiple Instances

13 October 2008 - 05:51 PM

Alright, here's the problem. I'm creating several instances at the same time, and each of the instances plays a sound when it's created. However, I only want the sound played once, while it's not playing.

Now, the simple solution to this would just be to make the spawner play the sound rather than the instance itself; however, it would be much more convenient if I could just have the instance itself play the sound, rather than having to worry about putting in the sound playing for every single object that spawns that instance.

My first idea was to do this in the create event:

sound_stop(snd_whatever);
sound_play(snd_whatever);

However, this lagged the game for a second when spawning many instances simultaneously.

My second idea, though I didn't think it would work (and I was right), was to do this:

if (!sound_isplaying(snd_whatever))
 sound_play(snd_whatever);

However, since all the objects are spawned at the exact same time, they all detect that no sound is playing at the same time, and proceed to all play the sound at the same time.

My third idea was to use a controller object to manage a trigger that showed whether or not each individual sound was playing, and use that variable rather than sound_isplaying(), but that'd probably just wind up being even more complicated and inefficient than just making the spawner play the sound.

So, would there be any way to do this, using the instance itself to play the sound, or should I just play the sound with the spawner?

Initial Value Changes > To >= ?!?!

27 June 2008 - 04:43 AM

I've used Game Maker for years, and I've never seen anything like this... I'm completely baffled.

I have this simple code:

if (global.run_speed > 0.1)
  global.run_speed -= 0.1;

Now, in the create event, I put:

global.run_speed = 5;

On execution, global.run_speed subtracts by 0.1, but ends up stopping on 0.0, instead of 0.1! I went back to check my code, thinking I accidentally used >=, but I hadn't.

Playing around with it some more, I found something very strange...

Starting the value as 8, it stopped at 0.0 when executed (okay...)
Starting the value as 5, it stopped at 0.0 when executed (still following the pattern...)
Starting the value as 3, it stopped at 0.0 when executed (still same thing...)
Starting the value as 2, it stopped at 0.1 when executed (what?! Why would starting as 2 make it execute correctly, when the others didn't?)
Starting the value as 1, it stopped at 0.0.

I thought it might have to do with how the string was being drawn, since I was using string_format. However, I debugged the value (not the modified string), and it is indeed stopping at those values.

Any ideas?