Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
(2 edits) (+1)

Hey, just wanted to make sure I'm on the right track here with a speech bubble component I'm working on:


The roundrect is manually drawn on the contraption's background, with margins set to allow shrinking and growing. The bubble's "tail" is a volatile canvas because the tail needs to change both image (mirror left/right) and position. Right now I'm making those changes from the view handler:

on view do
 left: state.text in "se","w"
 mirror: state.text in "sw","w"
 if left
  me.margin: 7,25,7,7
  tail.pos: 12,tail.pos[1]
 else
  me.margin: 7,7,25,7
  tail.pos: (me.size[0]-24),tail.pos[1]
 end
 img: image["%%IMG2..."] # tail image initially points to the right
 if mirror
  img.transform["horiz"]
  end
 tail.paste[img]
end

I call view[] from each of the set_ handlers, so if the text changes or the direction changes, everything gets repositioned and redrawn. This mostly works, but it has some weird side effects during editing. For example, if I resize the widget, the tail jumps back to its default position (its position in the prototype). And sometimes the volatile tail canvas clears itself during editing, and won't be redrawn until I switch to Interact mode.

Am I on the right track here? Is there something else that should be calling view[]? Or is there a better approach you would recommend?