How to check user draw area and set Image viewable area?

Hi everyone,

I am new to Corona and I just want to ask some questions, any help from you guys would be very appreciated:

1.In my game’s battle system, I use user’s draw pattern to trigger activity in game, for easy imagination, it’s should be like this:


the red line is user dragging trail, this return TRUE when user touch all inside the grey area.


however, this will return false because user touch outside the image.

Can anyone teach me how to detect if user touch inside/ outside the provided image?

2.What’s is best way to make an HP bar for game character, especially when I want to use an image (a rainbow color HP bar)

So sorry for my bad english, I am in a hurry so I can’t check it carefully ^^ [import]uid: 143505 topic_id: 25551 reply_id: 325551[/import]

http://learningcorona.com has a bunch of tutorials listed, including one for HP bars.

For your line you’d likely check touch coordinates against coords in a table, although you would also put “hot points” in the line, or use setFocus.

Try experimenting and reading the APIs and available tutorials :slight_smile:

EDIT: Edited to fix link. Thanks @info. [import]uid: 52491 topic_id: 25551 reply_id: 103268[/import]

Correct link is

http://www.learningcorona.com

[import]uid: 104259 topic_id: 25551 reply_id: 103338[/import]