[Tier 1] Multi touch sprite buttons. by Cliff Mellangard 3DEGS27th Aug 2012 15:54
|
---|
Summary Use multi touch for sprite buttons. Description The function is written for my own game where i use 3 buttons for directions and jump. Code ` This code was downloaded from The Game Creators ` It is reproduced here with full permission ` http://www.thegamecreators.com These neads to be globals !!!!!! Global BT_Left , BT_Right , BT_Up Global BT_Left_State , BT_Right_State , BT_Up_State Function Multi_Touch() BT_Left_State=0 SetSpriteColorAlpha(BT_Left,100) BT_Right_State=0 SetSpriteColorAlpha(BT_Right,100) BT_Up_State=0 SetSpriteColorAlpha(BT_Up,100) touchID = GetRawFirstTouchEvent(1) while touchID > 0 x# = ScreenToWorldX(GetRawTouchCurrentX( touchID )) y# = ScreenToWorldY(GetRawTouchCurrentY( touchID )) if GetSpriteHitTest ( BT_Left, x#, y# ) BT_Left_State=-1 SetSpriteColorAlpha(BT_Left,200) endif if GetSpriteHitTest ( BT_Right, x#, y# ) BT_Right_State=1 SetSpriteColorAlpha(BT_Right,200) endif if GetSpriteHitTest ( BT_Up, x#, y# ) BT_Up_State=1 SetSpriteColorAlpha(BT_Up,200) endif touchID = GetRawNextTouchEvent() endwhile Endfunction |