Thank you for the fast answer, and sorry for a slightly slower response.
I've been writing a script that lets the player shoot projectiles outside of battle. These projectiles may activate switches, thus making a good tool for interesting puzzles. Although the projectiles are working when it comes to drawing their sprites, activating switches and so on, there's one thing I'm bugged out about, namely it's being drawn over star marked tiles, e.g. trees.
The problem arise in the fact that I'm not changing the tiles to a tile with a projectile, but rather I'm just drawing a (projectile) sprite over the tiles.
I've tried using sprite blend types to get rid of this problem, but to no avail. In this case the only thing that happened (out of the ordinary) was that the projectile became pitch black. I tried blend type 1 (normal), 2 (additive) and 3 (subtractive). I used it through @projectile_sprite.blend_type = x, where @projectile_sprite is the sprite for the projectile and x was either 1, 2 or 3.
Since this didn't work I moved to another approach, namely to not draw the projectile if a tile is star marked.
I first tried checking the second layer of tiles to see whether it was non-zero or not. If it was non-zero, don't draw the projectile. This solved the problem, but gave rise to a new problem, namely now the projectile is not drawn if it's something on the second layer of tiles, e.g. a flower. The lines of codes for this check is:
if $game_map.tile_id(*next_tile, 2) != 0
*don't draw projectile code goes here*
end
Here "next_tile" is an array containing the coordinates (in tiles) of the next tile the projectile is going to be drawn upon.
Since this didn't work I decided that checking whether "next_tile" is star marked or not. I tried several ways, most notable examples are below:
if $game_map.tileset.flags[$game_map.tile_id(*next_tile, 2)] >= 1000 && 0x10 == 0
*don't draw projectile code goes here*
end
This gave rise to the same problem as above for whatever reason. It's my first time working with "0x10"-stuff so I'm not entirely sure how they work. A similar if statement may be found the function "check_passage" in the class "Game_Map".
Another way I tried is by defining an entirely new function in the class "Game_Map", and calling this function to see whether a tile is star marked or not:
class Game_Map
def rg9_check_start_tile(x, y)
star_tile = false
all_tiles(x, y).each do |tile_id|
flag = tileset.flags[tile_id]
star_tile = true if flag & 0x10 != 0
end # do
return star_tile
end # def
end # class
Don't mind the "rg9_"-part of the function name. I use it do distinguish between aliased functions and my own functions. Anyway, what I find to be weird is that the if statement "if flag & 0x10 != 0" is exactly the same one as in the function "check_passage" in the class "Game_Map", that checks there whether a tile is star marked or not. Changing "0x10 != 0" to "0x10 == 0" might solve it, but I can't try this until later tonight (I'm writing this at work, lol).
Sorry for long post, and I greatly appreciate a solution to this.
