Sprite Code Examples: Difference between revisions
Jump to navigation
Jump to search
m (Thanks for noticing that, asgromo.) |
Old-Sckool (talk | contribs) No edit summary |
||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
This article contains all of the code described in the [[ | This article contains all of the code described in the [[Sprite_(Tutorial)#Sprite Tutorial|Sprite Tutorial]]. | ||
==Example 1.1== | ==Example 1.1== | ||
lockplayer | lockplayer |
Latest revision as of 04:11, 27 January 2011
This article contains all of the code described in the Sprite Tutorial.
Example 1.1
lockplayer set "spr0_refx" to 80 set "spr0_refy" to 0 set "spr0_width" to 3 set "spr0_height" to 3 : "drawloop" wait for 1 put c?? Sprite p00 at "x" "y" if uppressed then "up" if leftpressed then "left" if rightpressed then "right" if downpressed then "down" goto "drawloop" : "up" dec "y" by 1 goto "drawloop" : "down" inc "y" by 1 goto "drawloop" : "left" dec "x" by 1 goto "drawloop" : "right" inc "x" by 1 goto "drawloop"
Example 1.2
lockplayer set "local" to 0 set "local2" to 5 set "local3" to 5 set "spr&local&_refx" to 80 set "spr&local&_refy" to 0 set "spr&local&_width" to 3 set "spr&local&_height" to 3 goto "#draw" : "drawloop" if uppressed then "#up" if leftpressed then "#left" if rightpressed then "#right" if downpressed then "#down" wait for 1 goto "drawloop" : "#up" if "local3" <= 0 then "#return" dec "local3" by 1 goto "#draw" goto "#return" : "#down" if "local3" >= "(25-'spr&local&_height')" then "#return" inc "local3" by 1 goto "#draw" goto "#return" : "#left" if "local2" <= 0 then "#return" dec "local2" by 1 goto "#draw" goto "#return" : "#right" if "local2" >= "(80-'spr&local&_width')" then "#return" inc "local2" by 1 goto "#draw" goto "#return" : "#draw" put c?? Sprite "local" at "local2" "local3" set "spr&local&_setview" to 1 goto "#return"
Example 1.3
. "Global robot" set "spr_yorder" to 1 --------------------------------------------------------------- . "Player robot" lockplayer set "local" to 0 set "local2" to 5 set "local3" to 5 set "spr&local&_refx" to 80 set "spr&local&_refy" to 0 set "spr&local&_width" to 3 set "spr&local&_height" to 3 set "spr&local&_cx" to 0 set "spr&local&_cy" to 2 set "spr&local&_cwidth" to 3 set "spr&local&_cheight" to 1 goto "#draw" : "drawloop" if uppressed then "#up" if leftpressed then "#left" if rightpressed then "#right" if downpressed then "#down" wait for 1 goto "drawloop" : "#up" if "local3" <= 0 then "#return" if c?? Sprite_colliding "local" at 0 -1 then "#return" dec "local3" by 1 goto "#draw" goto "#return" : "#down" if "local3" >= "(25-'spr&local&_height')" then "#return" if c?? Sprite_colliding "local" at 0 1 then "#return" inc "local3" by 1 goto "#draw" goto "#return" : "#left" if "local2" <= 0 then "#return" if c?? Sprite_colliding "local" at -1 0 then "#return" dec "local2" by 1 goto "#draw" goto "#return" : "#right" if "local2" >= "(80-'spr&local&_width')" then "#return" if c?? Sprite_colliding "local" at 1 0 then "#return" inc "local2" by 1 goto "#draw" goto "#return" : "#draw" put c?? Sprite "local" at "local2" "local3" set "spr&local&_setview" to 1 goto "#return"
Example 2.1
. "Global robot" set "spr_yorder" to 1 set "spr_p_x" to 80 set "spr_p_y" to 0 set "spr_p_w" to 3 set "spr_p_h" to 3 set "spr_p_cx" to 0 set "spr_p_cy" to 2 set "spr_p_cw" to 3 set "spr_p_ch" to 1 set "spr_d_x" to 83 set "spr_d_y" to 0 set "spr_d_w" to 3 set "spr_d_h" to 3 set "spr_d_cx" to 0 set "spr_d_cy" to 0 set "spr_d_cw" to 3 set "spr_d_ch" to 3 set "spr_k_x" to 86 set "spr_k_y" to 0 set "spr_k_w" to 2 set "spr_k_h" to 3 set "spr_k_cx" to 0 set "spr_k_cy" to 0 set "spr_k_cw" to 2 set "spr_k_ch" to 3 . "Your values may differ, so please change them to suit." --------------------------------------------------------------- . "Player robot" lockplayer set "local" to "robot_id" set "local2" to "thisx" set "local3" to "thisy" gotoxy "local" 0 . "@spr&local&" set "spr&local&_refx" to "spr_p_x" set "spr&local&_refy" to "spr_p_y" set "spr&local&_width" to "spr_p_w" set "spr&local&_height" to "spr_p_h" set "spr&local&_cx" to "spr_p_cx" set "spr&local&_cy" to "spr_p_cy" set "spr&local&_cwidth" to "spr_p_cw" set "spr&local&_cheight" to "spr_p_ch" goto "#draw" : "drawloop" if uppressed then "#up" if leftpressed then "#left" if rightpressed then "#right" if downpressed then "#down" wait for 1 goto "drawloop" : "#up" if "local3" <= 0 then "#return" if c?? Sprite_colliding "local" at 0 -1 then "collision" dec "local3" by 1 goto "#draw" goto "#return" : "#down" if "local3" >= "(25-'spr&local&_height')" then "#return" if c?? Sprite_colliding "local" at 0 1 then "collision" inc "local3" by 1 goto "#draw" goto "#return" : "#left" if "local2" <= 0 then "#return" if c?? Sprite_colliding "local" at -1 0 then "collision" dec "local2" by 1 goto "#draw" goto "#return" : "#right" if "local2" >= "(80-'spr&local&_width')" then "#return" if c?? Sprite_colliding "local" at 1 0 then "collision" inc "local2" by 1 goto "#draw" goto "#return" : "#draw" put c?? Sprite "local" at "local2" "local3" set "spr&local&_setview" to 1 goto "#return" : "collision" loop start goto "#collide('spr_clist&loopcount&')" send "spr('spr_clist&loopcount&')" to "touch" loop for "('spr_collisions'-1)" goto "#return" --------------------------------------------------------------- . "Key robot" set "local" to "robot_id" set "local2" to "thisx" set "local3" to "thisy" set "local4" to "this_color" gotoxy "local" 0 . "@spr&local&" set "spr&local&_refx" to "spr_k_x" set "spr&local&_refy" to "spr_k_y" set "spr&local&_width" to "spr_k_w" set "spr&local&_height" to "spr_k_h" set "spr&local&_cx" to "spr_k_cx" set "spr&local&_cy" to "spr_k_cy" set "spr&local&_cwidth" to "spr_k_cw" set "spr&local&_cheight" to "spr_k_ch" put "local4" Sprite "local" at "local2" "local3" end : "touch" inc "key_&local4&" by 1 set "spr&local&_off" to 1 die --------------------------------------------------------------- . "Door robot" set "local" to "robot_id" set "local2" to "thisx" set "local3" to "thisy" set "local4" to "this_color" gotoxy "local" 0 . "@spr&local&" set "spr&local&_refx" to "spr_d_x" set "spr&local&_refy" to "spr_d_y" set "spr&local&_width" to "spr_d_w" set "spr&local&_height" to "spr_d_h" set "spr&local&_cx" to "spr_d_cx" set "spr&local&_cy" to "spr_d_cy" set "spr&local&_cwidth" to "spr_d_cw" set "spr&local&_cheight" to "spr_d_ch" put "local4" Sprite "local" at "local2" "local3" end : "touch" if "key_&local4&" <= 0 then "end" dec "key_&local4&" by 1 set "spr&local&_off" to 1 die : "end" end
Example 2.2
. "Global robot" set "spr_yorder" to 1 set "spr_p_x" to 80 set "spr_p_y" to 0 set "spr_p_w" to 3 set "spr_p_h" to 3 set "spr_p_cx" to 0 set "spr_p_cy" to 2 set "spr_p_cw" to 3 set "spr_p_ch" to 1 set "spr_d_x" to 83 set "spr_d_y" to 0 set "spr_d_w" to 3 set "spr_d_h" to 3 set "spr_d_cx" to 0 set "spr_d_cy" to 0 set "spr_d_cw" to 3 set "spr_d_ch" to 3 set "spr_k_x" to 86 set "spr_k_y" to 0 set "spr_k_w" to 2 set "spr_k_h" to 3 set "spr_k_cx" to 0 set "spr_k_cy" to 0 set "spr_k_cw" to 2 set "spr_k_ch" to 3 set "num_keys" to 0 set "num_doors" to 0 --------------------------------------------------------------- . "Player robot" lockplayer set "local" to "robot_id" set "local2" to "thisx" set "local3" to "thisy" gotoxy "local" 0 set "playersprite" to "local" . "@spr&local&" set "spr&local&_refx" to "spr_p_x" set "spr&local&_refy" to "spr_p_y" set "spr&local&_width" to "spr_p_w" set "spr&local&_height" to "spr_p_h" set "spr&local&_cx" to "spr_p_cx" set "spr&local&_cy" to "spr_p_cy" set "spr&local&_cwidth" to "spr_p_cw" set "spr&local&_cheight" to "spr_p_ch" goto "#draw" : "drawloop" if uppressed then "#up" if leftpressed then "#left" if rightpressed then "#right" if downpressed then "#down" wait for 1 goto "drawloop" : "#up" if "local3" <= 0 then "#return" if c?? Sprite_colliding "local" at 0 -1 then "collision" dec "local3" by 1 goto "#draw" goto "#return" : "#down" if "local3" >= "(25-'spr&local&_height')" then "#return" if c?? Sprite_colliding "local" at 0 1 then "collision" inc "local3" by 1 goto "#draw" goto "#return" : "#left" if "local2" <= 0 then "#return" if c?? Sprite_colliding "local" at -1 0 then "collision" dec "local2" by 1 goto "#draw" goto "#return" : "#right" if "local2" >= "(80-'spr&local&_width')" then "#return" if c?? Sprite_colliding "local" at 1 0 then "collision" inc "local2" by 1 goto "#draw" goto "#return" : "#draw" put c?? Sprite "local" at "local2" "local3" set "spr&local&_setview" to 1 goto "#return" : "collision" loop start goto "#collide('spr_clist&loopcount&')" send "spr('spr_clist&loopcount&')" to "touch" loop for "('spr_collisions'-1)" goto "#return" --------------------------------------------------------------- . "Key robot" set "local" to "robot_id" set "local2" to "thisx" set "local3" to "thisy" set "local4" to "this_color" gotoxy "local" 0 . "@spr&local&" set "spr&local&_lpos" to "num_keys" set "keysprite('spr&local&_lpos')" to "local" inc "num_keys" by 1 set "spr&local&_refx" to "spr_k_x" set "spr&local&_refy" to "spr_k_y" set "spr&local&_width" to "spr_k_w" set "spr&local&_height" to "spr_k_h" set "spr&local&_cx" to "spr_k_cx" set "spr&local&_cy" to "spr_k_cy" set "spr&local&_cwidth" to "spr_k_cw" set "spr&local&_cheight" to "spr_k_ch" put "local4" Sprite "local" at "local2" "local3" end : "touch" inc "key_&local4&" by 1 dec "num_keys" by 1 set "spr('keysprite&num_keys&')_lpos" to "spr&local&_lpos" set "keysprite('spr&local&_lpos')" to "keysprite&num_keys&" set "spr&local&_off" to 1 die --------------------------------------------------------------- . "Door robot" set "local" to "robot_id" set "local2" to "thisx" set "local3" to "thisy" set "local4" to "this_color" gotoxy "local" 0 . "@spr&local&" set "spr&local&_lpos" to "num_doors" set "doorsprite('spr&local&_lpos')" to "local" inc "num_doors" by 1 set "spr&local&_refx" to "spr_d_x" set "spr&local&_refy" to "spr_d_y" set "spr&local&_width" to "spr_d_w" set "spr&local&_height" to "spr_d_h" set "spr&local&_cx" to "spr_d_cx" set "spr&local&_cy" to "spr_d_cy" set "spr&local&_cwidth" to "spr_d_cw" set "spr&local&_cheight" to "spr_d_ch" put "local4" Sprite "local" at "local2" "local3" end : "touch" if "key_&local4&" <= 0 then "end" dec "key_&local4&" by 1 dec "num_doors" by 1 set "spr('doorsprite&num_doors&')_lpos" to "spr&local&_lpos" set "doorsprite('spr&local&_lpos')" to "doorsprite&num_doors&" set "spr&local&_off" to 1 die : "end" end
Example 2.3
. "Global robot" set "bminx" to 0 set "bminy" to 0 set "bmaxx" to 80 set "bmaxy" to 25 set "spr_yorder" to 1 set "spr_p_x" to 80 set "spr_p_y" to 0 set "spr_p_w" to 3 set "spr_p_h" to 3 set "spr_p_cx" to 0 set "spr_p_cy" to 2 set "spr_p_cw" to 3 set "spr_p_ch" to 1 set "spr_d_x" to 83 set "spr_d_y" to 0 set "spr_d_w" to 3 set "spr_d_h" to 3 set "spr_d_cx" to 0 set "spr_d_cy" to 0 set "spr_d_cw" to 3 set "spr_d_ch" to 3 set "spr_k_x" to 86 set "spr_k_y" to 0 set "spr_k_w" to 2 set "spr_k_h" to 3 set "spr_k_cx" to 0 set "spr_k_cy" to 0 set "spr_k_cw" to 2 set "spr_k_ch" to 3 set "local2" to "playerx" set "local3" to "playery" restore "justentered" 1 | "justentered" set "spr&playersprite&_off" to 1 loop start set "spr('keysprite&loopcount&')_off" to 1 loop for "('num_keys'-1)" loop start set "spr('doorsprite&loopcount&')_off" to 1 loop for "('num_doors'-1)" set "num_keys" to 0 set "num_doors" to 0 lockscroll set "player_x" to "local2" set "player_y" to "local3" put player at 0 0 end : "edge0" set "local2" to "player_x" set "local3" to "('bmaxy'-'spr_p_h')" put player at 0 0 move player NORTH end : "edge1" set "local2" to "player_x" set "local3" to "bminy" put player at "('board_w'-1)" "('board_h'-1)" move player SOUTH end : "edge2" set "local2" to "('bmaxx'-'spr_p_w')" set "local3" to "player_y" put player at 0 0 move player WEST end : "edge3" set "local2" to "bminx" set "local3" to "player_y" put player at "('board_w'-1)" "('board_h'-1)" move player EAST end --------------------------------------------------------------- . "Player robot" lockplayer set "local" to "robot_id"set "local2" to "thisx"set "local3" to "thisy"gotoxy "local" 0 set "playersprite" to "local" . "@spr&local&" restore "justentered" 1 | "justentered" set "spr&local&_refx" to "spr_p_x" set "spr&local&_refy" to "spr_p_y" set "spr&local&_width" to "spr_p_w" set "spr&local&_height" to "spr_p_h" set "spr&local&_cx" to "spr_p_cx" set "spr&local&_cy" to "spr_p_cy" set "spr&local&_cwidth" to "spr_p_cw" set "spr&local&_cheight" to "spr_p_ch" goto "#draw" : "drawloop" if uppressed then "#up" if leftpressed then "#left" if rightpressed then "#right" if downpressed then "#down" wait for 1 goto "drawloop" : "#up" set "spr&local&_lastmove" to 0 if "player_y" <= "bminy" then "edgecollide" if c?? Sprite_colliding "local" at 0 -1 then "collision" dec "player_y" by 1 goto "#draw" goto "#return" : "#down" set "spr&local&_lastmove" to 1 if "player_y" >= "('bmaxy'-'spr&local&_height')" then "edgecollide" if c?? Sprite_colliding "local" at 0 1 then "collision" inc "player_y" by 1 goto "#draw" goto "#return" : "#left" set "spr&local&_lastmove" to 2 if "player_x" <= "bminx" then "edgecollide" if c?? Sprite_colliding "local" at -1 0 then "collision" dec "player_x" by 1 goto "#draw" goto "#return" : "#right" set "spr&local&_lastmove" to 3 if "player_x" >= "('bmaxx'-'spr&local&_width')" then "edgecollide" if c?? Sprite_colliding "local" at 1 0 then "collision" inc "player_x" by 1 goto "#draw" goto "#return" : "#draw" put c?? Sprite "local" at "player_x" "player_y" set "spr&local&_setview" to 1 goto "#return" : "collision" loop start goto "#collide('spr_clist&loopcount&')" send "spr('spr_clist&loopcount&')" to "touch" loop for "('spr_collisions'-1)" goto "#return" : "edgecollide" send "global" to "edge&spr('local')_lastmove&" goto "#return" --------------------------------------------------------------- . "Key robot" set "local" to "robot_id" set "local2" to "thisx" set "local3" to "thisy" set "local4" to "this_color" gotoxy "local" 0 . "@spr&local&" restore "justentered" 1 | "justentered" set "spr&local&_lpos" to "num_keys" set "keysprite('spr&local&_lpos')" to "local" inc "num_keys" by 1 set "spr&local&_refx" to "spr_k_x" set "spr&local&_refy" to "spr_k_y" set "spr&local&_width" to "spr_k_w" set "spr&local&_height" to "spr_k_h" set "spr&local&_cx" to "spr_k_cx" set "spr&local&_cy" to "spr_k_cy" set "spr&local&_cwidth" to "spr_k_cw" set "spr&local&_cheight" to "spr_k_ch" put "local4" Sprite "local" at "local2" "local3" end : "touch" inc "key_&local4&" by 1 dec "num_keys" by 1 set "spr('keysprite&num_keys&')_lpos" to "spr&local&_lpos" set "keysprite('spr&local&_lpos')" to "keysprite&num_keys&" set "spr&local&_off" to 1 die --------------------------------------------------------------- . "Door robot" set "local" to "robot_id" set "local2" to "thisx" set "local3" to "thisy" set "local4" to "this_color" gotoxy "local" 0 . "@spr&local&" restore "justentered" 1 | "justentered" set "spr&local&_lpos" to "num_doors" set "doorsprite('spr&local&_lpos')" to "local" inc "num_doors" by 1 set "spr&local&_refx" to "spr_d_x" set "spr&local&_refy" to "spr_d_y" set "spr&local&_width" to "spr_d_w" set "spr&local&_height" to "spr_d_h" set "spr&local&_cx" to "spr_d_cx" set "spr&local&_cy" to "spr_d_cy" set "spr&local&_cwidth" to "spr_d_cw" set "spr&local&_cheight" to "spr_d_ch" put "local4" Sprite "local" at "local2" "local3" end : "touch" if "key_&local4&" <= 0 then "end" dec "key_&local4&" by 1 dec "num_doors" by 1 set "spr('doorsprite&num_doors&')_lpos" to "spr&local&_lpos" set "doorsprite('spr&local&_lpos')" to "doorsprite&num_doors&" set "spr&local&_off" to 1 die : "end" end
Example 2.4
. "Global robot" set "bminx" to 1 set "bminy" to 1 set "bmaxx" to 81 set "bmaxy" to 26 set "vw" to 80 set "vh" to 25 set "spr_yorder" to 1 set "spr_p_x" to 0 set "spr_p_y" to 0 set "spr_p_w" to 3 set "spr_p_h" to 3 set "spr_p_cx" to 0 set "spr_p_cy" to 2 set "spr_p_cw" to 3 set "spr_p_ch" to 1 set "spr_d_x" to 3 set "spr_d_y" to 0 set "spr_d_w" to 3 set "spr_d_h" to 3 set "spr_d_cx" to 0 set "spr_d_cy" to 0 set "spr_d_cw" to 3 set "spr_d_ch" to 3 set "spr_k_x" to 6 set "spr_k_y" to 0 set "spr_k_w" to 2 set "spr_k_h" to 3 set "spr_k_cx" to 0 set "spr_k_cy" to 0 set "spr_k_cw" to 2 set "spr_k_ch" to 3 put "@sprites.mzm" Image_file p02 at 0 0 set "local2" to "playerx" set "local3" to "playery" set "local4" to "scrolledx" set "local5" to "scrolledy" . "Uberleet expression hack method:" . "set \"local4\" to \"(('scrolledx'<'bminx'*('bminx'-'scrolledx'))+('scrolledx'+'vw'>'bmaxx'*('bmaxx'-'vw'-'scrolledx'))+'scrolledx')\"" . "set \"local5\" to \"(('scrolledy'<'bminy'*('bminy'-'scrolledy'))+('scrolledy'+'vh'>'bmaxy'*('bmaxy'-'vh'-'scrolledy'))+'scrolledy')\"" restore "justentered" 1 | "justentered" set "spr&playersprite&_off" to 1 loop start set "spr('keysprite&loopcount&')_off" to 1 loop for "('num_keys'-1)" loop start set "spr('doorsprite&loopcount&')_off" to 1 loop for "('num_doors'-1)" set "num_keys" to 0 set "num_doors" to 0 lockscroll scrollview position "local4" "local5" set "player_x" to "local2" set "player_y" to "local3" put player at 0 0 : "playerloop" if "player_x" < "('bminx'+'bmaxx'/2)" then "#playerleft" if "player_x" > "('bminx'+'bmaxx'/2)" then "#playerright" if "player_y" < "('bminy'+'bmaxy'/2)" then "#playerup" if "player_y" > "('bminy'+'bmaxy'/2)" then "#playerdown" . "Uberleet expression hack method:" . "put player at \"('bminx'+'bmaxx'/2<'player_x'*('board_w'-1))\" \"('bminy'+'bmaxy'/2<'player_y'*('board_h'-1))\"" wait for 1 goto "playerloop" end : "edge0" set "local2" to "player_x" set "local3" to "('bmaxy'-'spr_p_h')" set "local4" to "scrolledx" set "local5" to "('bmaxy'-'vh')"put player at 0 0move player NORTH end : "edge1" set "local2" to "player_x" set "local3" to "bminy" set "local4" to "scrolledx" set "local5" to "bminy"put player at "('board_w'-1)" "('board_h'-1)"move player SOUTH end : "edge2" set "local2" to "('bmaxx'-'spr_p_w')" set "local3" to "player_y" set "local4" to "('bmaxx'-'vw')" set "local5" to "scrolledy"put player at 0 0move player WEST end : "edge3" set "local2" to "bminx" set "local3" to "player_y" set "local4" to "bminx" set "local5" to "scrolledy"put player at "('board_w'-1)" "('board_h'-1)"move player EAST end : "#playerleft" put player at 0 "playery" goto "#return" : "#playerright" put player at "('board_w'-1)" "playery" goto "#return" : "#playerup" put player at "playerx" 0 goto "#return" : "#playerdown" put player at "playerx" "('board_h'-1)" goto "#return" --------------------------------------------------------------- . "Player robot" lockplayer set "local" to "robot_id" gotoxy "local" 0 set "playersprite" to "local" . "@spr&local&" restore "justentered" 1 | "justentered" set "spr&local&_vlayer" to 1 set "spr&local&_refx" to "spr_p_x" set "spr&local&_refy" to "spr_p_y" set "spr&local&_width" to "spr_p_w" set "spr&local&_height" to "spr_p_h" set "spr&local&_cx" to "spr_p_cx" set "spr&local&_cy" to "spr_p_cy" set "spr&local&_cwidth" to "spr_p_cw" set "spr&local&_cheight" to "spr_p_ch" goto "#draw" : "drawloop" if uppressed then "#up" if leftpressed then "#left" if rightpressed then "#right" if downpressed then "#down" wait for 1 goto "drawloop" : "#up" set "spr&local&_lastmove" to 0 if "player_y" <= "bminy" then "edgecollide" if c?? Sprite_colliding "local" at 0 -1 then "collision" dec "player_y" by 1 goto "#draw" goto "#return" : "#down" set "spr&local&_lastmove" to 1 if "player_y" >= "('bmaxy'-'spr&local&_height')" then "edgecollide" if c?? Sprite_colliding "local" at 0 1 then "collision" inc "player_y" by 1 goto "#draw" goto "#return" : "#left" set "spr&local&_lastmove" to 2 if "player_x" <= "bminx" then "edgecollide" if c?? Sprite_colliding "local" at -1 0 then "collision" dec "player_x" by 1 goto "#draw" goto "#return" : "#right" set "spr&local&_lastmove" to 3 if "player_x" >= "('bmaxx'-'spr&local&_width')" then "edgecollide" if c?? Sprite_colliding "local" at 1 0 then "collision" inc "player_x" by 1 goto "#draw" goto "#return" : "#draw" put c?? Sprite "local" at "player_x" "player_y" set "spr&local&_setview" to 1 if "scrolledx" < "bminx" then "#fixleft" if "scrolledx" > "('bmaxx'-'vw')" then "#fixright" if "scrolledy" < "bminy" then "#fixup" if "scrolledy" > "('bmaxy'-'vh')" then "#fixdown" . "Uberleet expression hack method:" . "set \"local2\" to \"(('scrolledx'<'bminx'*('bminx'-'scrolledx'))+('scrolledx'+'vw'>'bmaxx'*('bmaxx'-'vw'-'scrolledx'))+'scrolledx')\"" . "set \"local3\" to \"(('scrolledy'<'bminy'*('bminy'-'scrolledy'))+('scrolledy'+'vh'>'bmaxy'*('bmaxy'-'vh'-'scrolledy'))+'scrolledy')\"" . "scrollview position \"local2\" \"local3\"" goto "#return" : "collision" loop start goto "#collide('spr_clist&loopcount&')" send "spr('spr_clist&loopcount&')" to "touch" loop for "('spr_collisions'-1)" goto "#return" : "edgecollide" send "global" to "edge&spr('local')_lastmove&" goto "#return" : "#fixleft" scrollview position "bminx" "scrolledy" goto "#return" : "#fixright" scrollview position "('bmaxx'-'vw')" "scrolledy" goto "#return" : "#fixup" scrollview position "scrolledx" "bminy" goto "#return" : "#fixdown" scrollview position "scrolledx" "('bmaxy'-'vh')" goto "#return" --------------------------------------------------------------- . "Key robot" set "local" to "robot_id" set "local2" to "thisx" set "local3" to "thisy" set "local4" to "this_color" gotoxy "local" 0 . "@spr&local&" restore "justentered" 1 | "justentered" set "spr&local&_lpos" to "num_keys" set "keysprite('spr&local&_lpos')" to "local" inc "num_keys" by 1 set "spr&local&_vlayer" to 1 set "spr&local&_refx" to "spr_k_x" set "spr&local&_refy" to "spr_k_y" set "spr&local&_width" to "spr_k_w" set "spr&local&_height" to "spr_k_h" set "spr&local&_cx" to "spr_k_cx" set "spr&local&_cy" to "spr_k_cy" set "spr&local&_cwidth" to "spr_k_cw" set "spr&local&_cheight" to "spr_k_ch" put "local4" Sprite "local" at "local2" "local3" end : "touch" inc "key_&local4&" by 1 dec "num_keys" by 1 set "spr('keysprite&num_keys&')_lpos" to "spr&local&_lpos" set "keysprite('spr&local&_lpos')" to "keysprite&num_keys&" set "spr&local&_off" to 1 die --------------------------------------------------------------- . "Door robot" set "local" to "robot_id" set "local2" to "thisx" set "local3" to "thisy" set "local4" to "this_color" gotoxy "local" 0 . "@spr&local&" restore "justentered" 1 | "justentered" set "spr&local&_lpos" to "num_doors" set "doorsprite('spr&local&_lpos')" to "local" inc "num_doors" by 1 set "spr&local&_vlayer" to 1 set "spr&local&_refx" to "spr_d_x" set "spr&local&_refy" to "spr_d_y" set "spr&local&_width" to "spr_d_w" set "spr&local&_height" to "spr_d_h" set "spr&local&_cx" to "spr_d_cx" set "spr&local&_cy" to "spr_d_cy" set "spr&local&_cwidth" to "spr_d_cw" set "spr&local&_cheight" to "spr_d_ch" put "local4" Sprite "local" at "local2" "local3" end : "touch" if "key_&local4&" <= 0 then "end" dec "key_&local4&" by 1 dec "num_doors" by 1 set "spr('doorsprite&num_doors&')_lpos" to "spr&local&_lpos" set "doorsprite('spr&local&_lpos')" to "doorsprite&num_doors&" set "spr&local&_off" to 1 die : "end" end
Example 3.1
. "Global robot" set "commands" to 4096 set "maxhealth" to 100 set maxhealth to "maxhealth" set "enter_menu" to 0 set "bminx" to 1 set "bminy" to 1 set "bmaxx" to 81 set "bmaxy" to 26 set "vw" to 80 set "vh" to 25 set "spr_yorder" to 1 set "spr_p_x" to 0 set "spr_p_y" to 0 set "spr_p_w" to 3 set "spr_p_h" to 3 set "spr_p_cx" to 0 set "spr_p_cy" to 2 set "spr_p_cw" to 3 set "spr_p_ch" to 1 set "spr_d_x" to 3 set "spr_d_y" to 0 set "spr_d_w" to 3 set "spr_d_h" to 3 set "spr_d_cx" to 0 set "spr_d_cy" to 0 set "spr_d_cw" to 3 set "spr_d_ch" to 3 set "spr_k_x" to 6 set "spr_k_y" to 0 set "spr_k_w" to 2 set "spr_k_h" to 3 set "spr_k_cx" to 0 set "spr_k_cy" to 0 set "spr_k_cw" to 2 set "spr_k_ch" to 3 set "lyr_s_x" to 0 set "lyr_s_y" to 3 set "lyr_s_w" to 50 set "lyr_s_h" to 2 set "lyr_sh_x" to 10 set "lyr_sh_y" to 3 set "lyr_sh_w" to 25 set "lyr_sh_h" to 1 set "lyr_sa_x" to 43 set "lyr_sa_y" to 3 set "lyr_sa_w" to 5 set "lyr_sa_h" to 1 set "lyr_sk_x" to 8 set "lyr_sk_y" to 4 set "lyr_sk_w" to 40 set "lyr_sk_h" to 1 set "spr_sh_x" to 8 set "spr_sh_y" to 0 put "@sprites.mzm" Image_file p02 at 0 0 put "@statusbar.mzm" Image_file p02 at "lyr_s_x" "lyr_s_y" set "local2" to "playerx" set "local3" to "playery" set "local4" to "scrolledx" set "local5" to "scrolledy" . "Uberleet expression hack method:" . "set \"local4\" to \"(('scrolledx'<'bminx'*('bminx'-'scrolledx'))+('scrolledx'+'vw'>'bmaxx'*('bmaxx'-'vw'-'scrolledx'))+'scrolledx')\"" . "set \"local5\" to \"(('scrolledy'<'bminy'*('bminy'-'scrolledy'))+('scrolledy'+'vh'>'bmaxy'*('bmaxy'-'vh'-'scrolledy'))+'scrolledy')\"" restore "justentered" 1 | "justentered" set "spr&playersprite&_off" to 1 set "spr&statusbar&_off" to 1 loop start set "spr('keysprite&loopcount&')_off" to 1 loop for "('num_keys'-1)" loop start set "spr('doorsprite&loopcount&')_off" to 1 loop for "('num_doors'-1)" set "num_keys" to 0 set "num_doors" to 0 lockscroll scrollview position "local4" "local5" set "player_x" to "local2" set "player_y" to "local3" put player at 0 0 : "playerloop" . "... Lines after this point have not changed." --------------------------------------------------------------- . "The player, key, and door robots have not changed." --------------------------------------------------------------- . "Status bar robot" set "local" to "robot_id" set "local2" to "('vw'-'lyr_s_w'/2)" set "local3" to 0 . "@spr&local&" gotoxy "local" 0 | "justentered" restore "justentered" 1 set "statusbar" to "local" set "spr&local&_vlayer" to 1 set "spr&local&_static" to 1 set "spr&local&_refx" to "lyr_s_x" set "spr&local&_refy" to "lyr_s_y" set "spr&local&_width" to "lyr_s_w" set "spr&local&_height" to "lyr_s_h" set "spr&local&_cx" to 0 set "spr&local&_cy" to 500 set "spr&local&_cwidth" to 0 set "spr&local&_cheight" to 0 restore "keyenter" 255 goto "keyenter" : "drawloop" put "@statusbar.mzm" Image_file p02 at "lyr_s_x" "lyr_s_y" goto "#dohealth" goto "#doammo" goto "#dokeys" goto "#draw" wait for 1 goto "drawloop" : "#dohealth" copy block "#&spr_sh_x&" "#&spr_sh_y&" for "('health'*'lyr_sh_w'/'maxhealth')" "lyr_sh_h" to "#&lyr_sh_x&" "#&lyr_sh_y&" goto "#return" : "#doammo" . "Uberleet expression hack for capping ammo at 99999." . "set \"ammo\" to \"('ammo'>99999*(99999-'ammo')+'ammo')\"" set "$ammo" to "&ammo&" loop start set "vch('lyr_sa_x'+'loopcount'),('lyr_sa_y')" to "$ammo.&loopcount&" loop for "('$ammo.length'-1)" goto "#return" : "#dokeys" set "local4" to 0 set "local5" to 0 : "keyloop" if "key_&local4&" <= 0 then "keynext" loop start if "local5" >= "lyr_sk_w" then "#return" set "vch('lyr_sk_x'+'local5'),('lyr_sk_y')" to 12 set "vco('lyr_sk_x'+'local5'),('lyr_sk_y')" to "local4" inc "local5" by 1 loop for "('key_&local4&'-1)" : "keynext" inc "local4" by 1 if "local4" < 256 then "keyloop" goto "#return" : "#draw" set "local3" to 0 if "('spr&playersprite&_y'-'scrolledy')" >= "('vh'-'spr_p_h'/2)" then "drawnext" set "local3" to "('vh'-'lyr_s_h')" : "drawnext" put c?? Sprite "local" at "local2" "local3" goto "#return" : "keyenter" zap "keyenter" 1 set "spr&local&_off" to 1 end : "keyenter" restore "keyenter" 1 goto "drawloop"
Example 3.2
. "Global robot" set "commands" to 4096 set "maxhealth" to 100 set maxhealth to "maxhealth" set "enter_menu" to 0 set "bminx" to 1 set "bminy" to 1 set "bmaxx" to 81 set "bmaxy" to 26 set "vw" to 80 set "vh" to 25 set "spr_yorder" to 1 set "spr_p_x" to 0 set "spr_p_y" to 0 set "spr_p_w" to 3 set "spr_p_h" to 3 set "spr_p_cx" to 0 set "spr_p_cy" to 2 set "spr_p_cw" to 3 set "spr_p_ch" to 1 set "spr_d_x" to 3 set "spr_d_y" to 0 set "spr_d_w" to 3 set "spr_d_h" to 3 set "spr_d_cx" to 0 set "spr_d_cy" to 0 set "spr_d_cw" to 3 set "spr_d_ch" to 3 set "spr_k_x" to 6 set "spr_k_y" to 0 set "spr_k_w" to 2 set "spr_k_h" to 3 set "spr_k_cx" to 0 set "spr_k_cy" to 0 set "spr_k_cw" to 2 set "spr_k_ch" to 3 set "lyr_s_x" to 0 set "lyr_s_y" to 3 set "lyr_s_w" to 50 set "lyr_s_h" to 2 set "lyr_sh_x" to 10 set "lyr_sh_y" to 3 set "lyr_sh_w" to 25 set "lyr_sh_h" to 1 set "lyr_sa_x" to 43 set "lyr_sa_y" to 3 set "lyr_sa_w" to 5 set "lyr_sa_h" to 1 set "lyr_sk_x" to 8 set "lyr_sk_y" to 4 set "lyr_sk_w" to 40 set "lyr_sk_h" to 1 set "spr_sh_x" to 8 set "spr_sh_y" to 0 set "spr_pb_x" to 8 set "spr_pb_y" to 1 set "spr_pb_w" to 1 set "spr_pb_h" to 1 set "lyr_pb_x" to 0 set "lyr_pb_y" to 5 set "lyr_pb_w" to "('bmaxx'-'bminx')" set "lyr_pb_h" to "('bmaxy'-'bminy')" put "@sprites.mzm" Image_file p02 at 0 0 put "@statusbar.mzm" Image_file p02 at "lyr_s_x" "lyr_s_y" copy block at "#&lyr_pb_x&" "#&lyr_pb_y&" for "lyr_pb_w" "lyr_pb_h" to "@blank.mzm" 1 set "local2" to "playerx" set "local3" to "playery" set "local4" to "scrolledx" set "local5" to "scrolledy" . "Uberleet expression hack method:" . "set \"local4\" to \"(('scrolledx'<'bminx'*('bminx'-'scrolledx'))+('scrolledx'+'vw'>'bmaxx'*('bmaxx'-'vw'-'scrolledx'))+'scrolledx')\"" . "set \"local5\" to \"(('scrolledy'<'bminy'*('bminy'-'scrolledy'))+('scrolledy'+'vh'>'bmaxy'*('bmaxy'-'vh'-'scrolledy'))+'scrolledy')\"" restore "justentered" 1 | "justentered" set "spr&playersprite&_off" to 1 set "spr&statusbar&_off" to 1 set "spr&playerbullets&_off" to 1 loop start set "spr('keysprite&loopcount&')_off" to 1 loop for "('num_keys'-1)" loop start set "spr('doorsprite&loopcount&')_off" to 1 loop for "('num_doors'-1)" set "num_keys" to 0 set "num_doors" to 0 lockscroll scrollview position "local4" "local5" set "player_x" to "local2" set "player_y" to "local3" put player at 0 0 : "playerloop" . "... Lines after this point have not changed." --------------------------------------------------------------- . "The player, status bar, key, and door robots have not changed." --------------------------------------------------------------- . "Player bullet robot" set "local" to "robot_id" . "@spr&local&" gotoxy "local" 0 restore "justentered" 1 | "justentered" set "playerbullets" to "local" set "pbullets" to 0 set "pbullets_add" to 0 set "pbullets_remove" to 0 set "spr&local&_vlayer" to 1 set "spr&local&_refx" to "lyr_pb_x" set "spr&local&_refy" to "lyr_pb_y" set "spr&local&_width" to "lyr_pb_w" set "spr&local&_height" to "lyr_pb_h" put c?? Sprite "local" "bminx" "bminy" : "drawloop" goto "#add" goto "#move" goto "#check" goto "#remove" goto "#draw" wait for 1 goto "drawloop" : "#add" . "TODO" goto "#return" : "#move" . "TODO" goto "#return" : "#check" . "TODO" goto "#return" : "#remove" . "TODO" goto "#return" : "#draw" . "TODO" goto "#return"
Example 3.3
. "The global, player, status bar, key, and door robots have not changed." --------------------------------------------------------------- . "Player bullet robot" set "local" to "robot_id" . "@spr&local&" gotoxy "local" 0 restore "justentered" 1 | "justentered" set "playerbullets" to "local" set "pbullets" to 0 set "pbullets_add" to 0 set "pbullets_remove" to 0 set "spr&local&_vlayer" to 1 set "spr&local&_refx" to "lyr_pb_x" set "spr&local&_refy" to "lyr_pb_y" set "spr&local&_width" to "lyr_pb_w" set "spr&local&_height" to "lyr_pb_h" put c?? Sprite "local" "bminx" "bminy" : "drawloop" if "pbullets_add" > 0 then "#add" if "pbullets" > 0 then "#move" if "pbullets_remove" > 0 then "#remove" if "pbullets" > 0 then "#check" if "pbullets_remove" > 0 then "#remove" put "@blank.mzm" Image_file p02 at "lyr_pb_x" "lyr_pb_y" if "pbullets" > 0 then "#draw" set "spr&local&_cy" to -1 wait for 1 goto "drawloop" : "#add" loop start set "local2" to "pbullets_add&loopcount&" set "pbullets&pbullets&_x" to "('spr&local2&_width'/2+'spr&local2&_x'-'bminx')" set "pbullets&pbullets&_y" to "('spr&local2&_height'/2+'spr&local2&_y'-'bminy')" . "Uberleet expression hack version" . "set \"pbullets&pbullets&_vx\" to \"('spr&local2&_lastmove'%2*2-1*('spr&local2&_lastmove'/2))\"" . "set \"pbullets&pbullets&_vy\" to \"('spr&local2&_lastmove'%2*2-1*('spr&local2&_lastmove'/2-1*-1))\"" goto "#add('spr&local2&_lastmove')" inc "pbullets" by 1 loop for "('pbullets_add'-1)" set "pbullets_add" to 0 goto "#return" : "#move" loop start inc "pbullets&loopcount&_x" by "pbullets&loopcount&_vx" inc "pbullets&loopcount&_y" by "pbullets&loopcount&_vy" if "(('pbullets&loopcount&_x'>=0)a('pbullets&loopcount&_y'>=0)a('pbullets&loopcount&_x'<'lyr_pb_w')a('pbullets&loopcount&_y'<'lyr_pb_h'))" = 1 then "movenext" set "pbullets_remove&pbullets_remove&" to "loopcount" inc "pbullets_remove" by 1 : "movenext" loop for "('pbullets'-1)" goto "#return" : "#check" loop start set "spr&local&_cx" to "pbullets&loopcount&_x" set "spr&local&_cy" to "pbullets&loopcount&_y" set "spr&local&_cwidth" to "spr_pb_w" set "spr&local&_cheight" to "spr_pb_h" set "spr&local&_clist" to 1 if "spr_collisions" <= 0 then "checknext" set "local2" to 0 : "collide" if "spr_clist&local2&" = "playersprite" then "checknext" send "spr('spr_clist&local2&')" to "playershot" inc "local2" by 1 if "local2" < "spr_collisions" then "collide" set "pbullets_remove&pbullets_remove&" to "loopcount" inc "pbullets_remove" by 1 : "checknext" loop for "('pbullets'-1)" goto "#return" : "#remove" loop start dec "pbullets" by 1 set "local2" to "pbullets_remove('pbullets_remove'-'loopcount'-1)" set "pbullets&local2&_x" to "pbullets&pbullets&_x" set "pbullets&local2&_y" to "pbullets&pbullets&_y" set "pbullets&local2&_vx" to "pbullets&pbullets&_vx" set "pbullets&local2&_vy" to "pbullets&pbullets&_vy" loop for "('pbullets_remove'-1)" set "pbullets_remove" to 0 goto "#return" : "#draw" loop start copy block at "#&spr_pb_x&" "#&spr_pb_y&" for "spr_pb_w" "spr_pb_h" to "#('lyr_pb_x'+'pbullets&loopcount&_x')" "#('lyr_pb_y'+'pbullets&loopcount&_y')" loop for "('pbullets'-1)" goto "#return" : "#add0" set "pbullets&pbullets&_vx" to 0 set "pbullets&pbullets&_vy" to -1 goto "#return" : "#add1" set "pbullets&pbullets&_vx" to 0 set "pbullets&pbullets&_vy" to 1 goto "#return" : "#add2" set "pbullets&pbullets&_vx" to -1 set "pbullets&pbullets&_vy" to 0 goto "#return" : "#add3" set "pbullets&pbullets&_vx" to 1 set "pbullets&pbullets&_vy" to 0 goto "#return"
Example 3.4
. "Global robot" set "commands" to 4096 set "maxhealth" to 100 set maxhealth to "maxhealth" set "ammo" to 10000 set "enter_menu" to 0 set "bminx" to 1 set "bminy" to 1 set "bmaxx" to 81 set "bmaxy" to 26 set "vw" to 80 set "vh" to 25 set "spr_yorder" to 1 . "... And all the rest." --------------------------------------------------------------- . "Player robot" lockplayer set "local" to "robot_id" gotoxy "local" 0 set "playersprite" to "local" . "@spr&local&" restore "justentered" 1 | "justentered" set "spr&local&_vlayer" to 1 set "spr&local&_refx" to "spr_p_x" set "spr&local&_refy" to "spr_p_y" set "spr&local&_width" to "spr_p_w" set "spr&local&_height" to "spr_p_h" set "spr&local&_cx" to "spr_p_cx" set "spr&local&_cy" to "spr_p_cy" set "spr&local&_cwidth" to "spr_p_cw" set "spr&local&_cheight" to "spr_p_ch" goto "#draw" : "drawloop" if uppressed then "#up" if leftpressed then "#left" if rightpressed then "#right" if downpressed then "#down" wait for 1 goto "drawloop" : "#up" set "spr&local&_lastmove" to 0 if spacepressed then "shoot" if "player_y" <= "bminy" then "edgecollide" if c?? Sprite_colliding "local" at 0 -1 then "collision" dec "player_y" by 1 goto "#draw" goto "#return" : "#down" set "spr&local&_lastmove" to 1 if spacepressed then "shoot" if "player_y" >= "('bmaxy'-'spr&local&_height')" then "edgecollide" if c?? Sprite_colliding "local" at 0 1 then "collision" inc "player_y" by 1 goto "#draw" goto "#return" : "#left" set "spr&local&_lastmove" to 2 if spacepressed then "shoot" if "player_x" <= "bminx" then "edgecollide" if c?? Sprite_colliding "local" at -1 0 then "collision" dec "player_x" by 1 goto "#draw" goto "#return" : "#right" set "spr&local&_lastmove" to 3 if spacepressed then "shoot" if "player_x" >= "('bmaxx'-'spr&local&_width')" then "edgecollide" if c?? Sprite_colliding "local" at 1 0 then "collision" inc "player_x" by 1 goto "#draw" goto "#return" : "#draw" put c?? Sprite "local" at "player_x" "player_y" set "spr&local&_setview" to 1 if "scrolledx" < "bminx" then "#fixleft" if "scrolledx" > "('bmaxx'-'vw')" then "#fixright" if "scrolledy" < "bminy" then "#fixup" if "scrolledy" > "('bmaxy'-'vh')" then "#fixdown" . "Uberleet expression hack method:" . "set \"local2\" to \"(('scrolledx'<'bminx'*('bminx'-'scrolledx'))+('scrolledx'+'vw'>'bmaxx'*('bmaxx'-'vw'-'scrolledx'))+'scrolledx')\"" . "set \"local3\" to \"(('scrolledy'<'bminy'*('bminy'-'scrolledy'))+('scrolledy'+'vh'>'bmaxy'*('bmaxy'-'vh'-'scrolledy'))+'scrolledy')\"" . "scrollview position \"local2\" \"local3\"" goto "#return" : "collision" loop start goto "#collide('spr_clist&loopcount&')" send "spr('spr_clist&loopcount&')" to "touch" loop for "('spr_collisions'-1)" goto "#return" : "edgecollide" send "global" to "edge&spr('local')_lastmove&" goto "#return" : "#fixleft" scrollview position "bminx" "scrolledy" goto "#return" : "#fixright" scrollview position "('bmaxx'-'vw')" "scrolledy" goto "#return" : "#fixup" scrollview position "scrolledx" "bminy" goto "#return" : "#fixdown" scrollview position "scrolledx" "('bmaxy'-'vh')" goto "#return" : "shoot" take 1 AMMOS else "#return" set "pbullets_add&pbullets_add&" to "local" inc "pbullets_add" by 1 goto "#return" --------------------------------------------------------------- . "Key robot" set "local" to "robot_id" set "local2" to "thisx" set "local3" to "thisy" set "local4" to "this_color" gotoxy "local" 0 . "@spr&local&" restore "justentered" 1 | "justentered" set "spr&local&_lpos" to "num_keys" set "keysprite('spr&local&_lpos')" to "local" inc "num_keys" by 1 set "spr&local&_vlayer" to 1 set "spr&local&_refx" to "spr_k_x" set "spr&local&_refy" to "spr_k_y" set "spr&local&_width" to "spr_k_w" set "spr&local&_height" to "spr_k_h" set "spr&local&_cx" to "spr_k_cx" set "spr&local&_cy" to "spr_k_cy" set "spr&local&_cwidth" to "spr_k_cw" set "spr&local&_cheight" to "spr_k_ch" put "local4" Sprite "local" at "local2" "local3" end : "touch" inc "key_&local4&" by 1 dec "num_keys" by 1 set "spr('keysprite&num_keys&')_lpos" to "spr&local&_lpos" set "keysprite('spr&local&_lpos')" to "keysprite&num_keys&" set "spr&local&_off" to 1 die : "playershot" set "local5" to "('local4'%16)" * "~&+local5&Ouch, you shot me!" end --------------------------------------------------------------- . "Door robot" set "local" to "robot_id" set "local2" to "thisx" set "local3" to "thisy" set "local4" to "this_color" gotoxy "local" 0 . "@spr&local&" restore "justentered" 1 | "justentered" set "spr&local&_lpos" to "num_doors" set "doorsprite('spr&local&_lpos')" to "local" inc "num_doors" by 1 set "spr&local&_vlayer" to 1 set "spr&local&_refx" to "spr_d_x" set "spr&local&_refy" to "spr_d_y" set "spr&local&_width" to "spr_d_w" set "spr&local&_height" to "spr_d_h" set "spr&local&_cx" to "spr_d_cx" set "spr&local&_cy" to "spr_d_cy" set "spr&local&_cwidth" to "spr_d_cw" set "spr&local&_cheight" to "spr_d_ch" put "local4" Sprite "local" at "local2" "local3" end : "touch" if "key_&local4&" <= 0 then "end" dec "key_&local4&" by 1 dec "num_doors" by 1 set "spr('doorsprite&num_doors&')_lpos" to "spr&local&_lpos" set "doorsprite('spr&local&_lpos')" to "doorsprite&num_doors&" set "spr&local&_off" to 1 die : "end" end : "playershot" set "local5" to "('local4'%16)" * "~&+local5&Ouch, you shot me!" end