• Do not use Discord to host any images you post, these links expire quickly! You can learn how to add images to your posts here.
  • Apologies if you've had troubles connecting to the site, you may need a VPN to access it. Staff are also facing issues connecting, so if it's urgent please message Cat on-site or through Discord directly.
  • Hey Guest, staff applications are open! If you are interested in becoming a forum staff member and/or Discord staff member, please apply through this Google Form before April 2! You can also message Cat with any questions.
Resource icon

Resource Better Bitmaps v1.0

Marin submitted a new resource:

Better Bitmaps - Adds utility methods to bitmaps (drawing shapes, lines, circle, ellipses, hexagons, and more!)

This resource allows you to draw a whole bunch of different shapes to bitmaps, including:
  • Triangles
  • Rectangles
  • Hexagons
  • Circles
  • Ellipses
  • Hexagons with hexagons inside (to represent statistics)
  • Lines between points
Other than these default-included shapes, you can always draw your own shape just by specifying a few points. Each of these shapes can also be filled with a solid color.

This image illustrates some things you can do with this:...

Read more about this resource...
 

Izanagi

Developer of Pokémon Stars
Member
Joined
Jun 10, 2021
Posts
27
Hey, I know this is an old release but I hope someone could help me with an issue I'm experiencing. When drawing a hexagon with values the hexagon behaves weirdly. When all the values are set to the same number, the lowest part of the shape inside the hexagon behaves weirdly. The value seems to be reversed somehow and I wonder if anyone knows whats causing this. attached are two screenshots of the behavior with all the values set to 10 and 31 respectively
Values set to 10
Values set to 31

UPDATE: I figured it out by myself. You have to modify the code as follows:
Ruby:
Expand Collapse Copy
  def draw_shape_with_values(color, x, y, points, max_value, values, fill = false,
                             outline = true)
    coords = []
    values.each_with_index do |v,i|
      fact = v.to_f / max_value
      fact = 1.0 if fact > 1
      px = points[i].is_a?(Point) ? points[i].x : points[i][0]
      py = points[i].is_a?(Point) ? points[i].y : points[i][1]
      table = Bitmap.get_table(px, py, x, y).sort { |a,b| a[0] <=> b[0] }
      entry_count = (table.size * fact).round
      table.reverse! if px > x
      table.reverse! if i == 3 # I added this line
      point = table[table.size - entry_count]
      point ||= [x, y]
      coords << Point.new(*point)
    end
    table = draw_shape(color, coords.concat([coords[0]]), fill)
    draw_shape(color, points.concat([points[0]])) if outline
    return table
  end
I don't know why the table at index 3 behaves this way but this resolves the issue
 
Last edited:
Back
Top