Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Set flash_data for single tiles coordinate-based

I think the tile explains my case quite well... I wonder how I can set a new value for a coordinate inside flash_data Table object in Tilemap class. I failed with all tries until now, so let's hope someone around here can help me :D

This has been Yeyinde's suggestion:
Code:
@tilemap.flash_data[x][y] = 0xrgb

Called from Spriteset_Map, that'd make the Call Script line the following, if i'm not mistaken:
Code:
$scene.spriteset.tilemap.flash_data[1][1] = 0xfff

The error I get is (NoMethodError) "undefined method '[]' for nil:NilClass"... yeah, that's familiar.

Any help on that one?
 

Zeriab

Sponsor

Uhm, it's a 2-D Table object. But first of all you have to create the table for the flash_data since it's nil by default.
[rgss]#Let's us assume you have tilemap
map_data = tilemap.map_data
# It got the be same width and height as the map_data according to the help file
table = Table.new(map_data.xsize, map_data.ysize)
# Let's set the created table as the flash_data
tilemap.flash_data = table
[/rgss]

Once you have done that you can make your script call with the natural change since you are dealing with a table:
[rgss]$scene.spriteset.tilemap.flash_data[1,1] = 0xfff
[/rgss]

I have tested this and it works beautifully (unless I made any copy-paste errors >_>)
*hugs*
- Zeriab
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top