Jump to content
A 2021 backup has been restored. Forums are closed and work in progress. Join our Discord server for more updates! ×
SoaH City Message Board

Leaderboard

Popular Content

Showing content with the highest reputation on 06/01/2014 in all areas

  1. Anyone who fooled around with MS Paint in the '90s as much as I did is intimately familiar with the Invert Colors effect. Today it still has its uses; it's pretty handy for flashing enemies or bosses for example. It's actually pretty simple to achieve the same effect in Game Maker 8.0, even without shaders. Inverting a Rectangular Region As long as the drawing color is set to c_white, you can invert a rectangular region simply by drawing a rectangle with a certain blend mode. draw_set_blend_mode_ext(bm_inv_dest_color, bm_zero); draw_rectangle(left, top, right, bottom, false); draw_set_blend_mode(bm_normal); I recommend turning the above into a script, perhaps named draw_invert_region(), for ease of use. Inverting an Image Often you'll want to invert an image, though, not an exact rectangle. The trick to doing this is to invert a region, draw the image in that region, and then invert the same exact region again. This sandwiches the image between two inversions, resulting in every pixel in the image being inverted but the pixels behind the image are returned to normal. draw_set_color(c_white); draw_invert_region(view_xview, view_yview, view_xview + view_wview, view_yview + view_hview); draw_sprite(sprite_index, image_index, x, y); draw_invert_region(view_xview, view_yview, view_xview + view_wview, view_yview + view_hview); Further Effects It's possible to sweeten up plain old inversions in order to create some nicer effects. By drawing the image with a blend color, you can give it different tones. Draw with a dark purple blend color to get a golden yellow inverted image; draw with an orange or red blend color to get an icy blue inverted image. If you want an example, here's a GMK you can fool with.
    3 points
  2. i was going to upload a screenshot but instead i did a vid of this, is a little something i was working even before Silver Gear and Sonic Recreations
    1 point
  3. This is a significant difference between Game Maker Studio and Game Maker 8.0 that really gave me trouble. You see, in Game Maker 8.0, arguments passed to a function or script are always evaluated in a strict left-to-right order. Say you wanted to read some data from a file directly into a function like so: some_function(file_bin_read_byte(file), file_bin_read_byte(file), file_bin_read_byte(file), file_bin_read_byte(file)); This would work as expected in Game Maker 8.0, with each byte being read from the file in sequence and winding up in some_function() as argument0, argument1, argument2, and argument3 as expected. But in Game Maker Studio, however, the evaluation order is not guaranteed, and - in my tests - seems to be precisely reversed. Thus, argument0 winds up as the fourth byte, argument1 as the third byte, argument2 as the second byte, and argument3 as the first byte. Weird as this is, it appears as though it's not going to change any time soon (explanation here). It really should have been given more attention in the documentation, because it can wreak inexplicable havoc in legacy code. Fortunately, it can be worked around easily, if clumsily: byte[0] = file_bin_read_byte(file); byte[1] = file_bin_read_byte(file); byte[2] = file_bin_read_byte(file); byte[3] = file_bin_read_byte(file); some_function(byte[0], byte[1], byte[2], byte[3]);
    1 point
×
×
  • Create New...