'------------------- you have nothing else to do, give me a picture! ------------------------------------------------------------------------------------------
pic
(0) = _LOADIMAGE("puzzle.jpg", 32) 'picture puzzle
' ---------------------- SETTINGS --------------------------------------------------------------------------------------------------------------------------
monx = 1200 'resolution X
monrat = 0 'monitor ratio 0=16:9 1=4:3
moving_speed(0) = 7 'TILE move speed start value
rotating_speed(0) = 6 'TILE rotation speed start value
st_rotating = 1 'rotation start value
rotating_moving_chance = 20 'during the game the chance is 1:x to change direction or rotation of the TILE
tile_ratiomax = 1.4 'the ratio of the larger and smaller sides of TILE should not be greater than this (filter out very rectangular tiles)
bg_file$ = "" 'background picture jpg ,if bg_file$="" then be a grey background
'------------------------ ADVANCED SETTING
monpuzzle = 70 'percentage size max puzzle weight in the window
inwindow = 28 'percentage size for windows, auto reposition if tile is over
shuffling_cycle = 100 'the mixing is so many cycles long 90 is ok
puzzle_r = 720 '1 rotation scale = 360/puzzle_rnnecessary rotation possibilities (faster rotation)
puzzle_b = 8 'thickness of tile over black background
puzzle_s_ratio = .6 'two matching tile encounter detection sensitivity multiplier (real sensitivity is proportional to tile size)
together_speed = 6 'fast tile speed when unification
together_speed_slow = 1 'slow tile speed when unification
dislimit = 2 'what the minimum deviation (pixel,angle) should change when unification ?
keyviewy = 3: keyviewx = 2 'start location draw to setup text
moving_speed(1) = 20 'TILE move speed when shuffling
rotating_speed(1) = 20 'TILE rotation speed when shuffling
'------------------------- SETTING CONSTANT VALUES -----------------------------------------------------------------------------------------------------------------
'creating blackunder border
lwindow_x1 = monx * inwindow / 100: lwindow_x2 = monx - lwindow_x1: lwindow_y1 = mony * inwindow / 100: lwindow_y2 = mony - lwindow_y1
CONST pip180
= 3.14159265 / 180: en$
(1) = "enable": en$
(0) = "disable" 'calculating tiles size - ideal placement depending on whether the image is portrait or landscape
'parcelling / shuffle variations creation searching
tile_size_x
= _WIDTH(pic
(0)) / shx: tile_size_y
= _HEIGHT(pic
(0)) / shy: ratio
= tile_size_y
/ tile_size_x
IF tile_size_x
> tile_size_y
THEN ratio
= 1 / ratio
IF (ratio
<= tile_ratiomax
) AND shc
< shc_max
THEN sh
(shc
, 1) = shx: sh
(shc
, 0) = shy: sh
(shc
, 7) = shy
* shx: shc
= shc
+ 1 FOR t1
= 0 TO shc
- 1:
FOR t2
= 0 TO shc
- 1:
IF sh
(t2
, 7) > sh
(t1
, 7) THEN SWAP sh
(t2
, 7), sh
(t1
, 7):
SWAP sh
(t2
, 7), sh
(t1
, 7):
SWAP sh
(t2
, 7), sh
(t1
, 7) sh
(t
, 4) = (sh
(t
, 2) - 1) * 8: sh
(t
, 5) = sh
(t
, 4) + LEN(sh$
(t
)) * 8: sh
(t
, 6) = (sh
(t
, 3) - 1) * 16:
NEXT t
'initial values to get to the cycle on which to choose
start_area_x_s = monx * .55 - psx / 2: start_area_y_s = mony / 2 - psy / 2: start_area_rotate_s = 360 / puzzle_r * 0: puzzle_x = 2: puzzle_y = 2: first_start = 1
start_area_x = start_area_x_s: start_area_y = start_area_y_s: start_area_rotate = start_area_rotate_s
'----------------------- henceforth no defining values should be used ------------------no constant values -------------------------------------------------
restart_point: 'this is the restart point to which you can return at any time by division without collision
tiles = puzzle_x * puzzle_y: psxppx = psx / puzzle_x: psyppy = psy / puzzle_y: ptx = psx / puzzle_x / 2: pty = psy / puzzle_y / 2
REDIM mp
(999, 12), dmp
(19999, 12), px
(3), py
(3), tiles
(tiles
- 1, 14), posx
(puzzle_x
, puzzle_y
), join
(tiles
- 1, tiles
- 1, 7), area_posinfo
(tiles
- 1, 15)
'hit sensitivity tile -proportional value
st1 = 2: ss1 = 80 'For 2 tile, 80 sensitivity is ergonomic
st2 = 40: ss2 = 60 'For 40 tile, 50 sensitivity is ergonomic
puzzle_s2 = (((tiles - st1) / ((st2 - st1) / (ss2 - ss1)) + ss1) * puzzle_s_ratio) ^ 2
'creating tiles
atiles
= 0:
FOR ax
= 0 TO puzzle_x
- 1:
FOR ay
= 0 TO puzzle_y
- 1 tiles
(atiles
, 0) = _WIDTH(pic
(0)) / puzzle_x
* ax: tiles
(atiles
, 1) = _HEIGHT(pic
(0)) / puzzle_y
* ay
'original picture tile coordinates tiles
(atiles
, 2) = _WIDTH(pic
(0)) / puzzle_x
* (ax
+ 1): tiles
(atiles
, 3) = _HEIGHT(pic
(0)) / puzzle_y
* (ay
+ 1) tiles(atiles, 4) = ax 'coordinate in puzzle X
tiles(atiles, 5) = ay 'coordinate in puzzle Y
tiles(atiles, 6) = atiles 'melyik area-ba ?
IF first_start
THEN tiles
(atiles
, 6) = 0 posx
(ax
, ay
) = atiles: atiles
= atiles
+ 1:
NEXT ay
, ax
'tiles neighbor finding
t1
= SGN(t3
AND 1): t2
= SGN(t3
AND 2): ax
= (t1
* 2 - 1) * t2
+ tiles
(atiles
, 4): ay
= (t1
* 2 - 1) * (t2
XOR 1) + tiles
(atiles
, 5) IF (ax
< 0 OR ax
> puzzle_x
- 1) OR (ay
< 0 OR ay
> puzzle_y
- 1) THEN tiles
(atiles
, 7 + t3
) = -1 ELSE tiles
(atiles
, 7 + t3
) = posx
(ax
, ay
)
'create areas position on display and mouse rotation points
area_posinfo(0, 0) = puzzle_x / 2: area_posinfo(0, 1) = puzzle_y / 2: area_posinfo(0, 2) = start_area_x: area_posinfo(0, 3) = start_area_y
area_posinfo(0, 4) = start_area_rotate: area_posinfo(0, 5) = 0: area_posinfo(0, 6) = sh_rand_m * sh_rand_v: area_posinfo(0, 7) = sh_rand_m * sh_rand_v
area_posinfo
(0, 8) = sh_rand_m
* sh_rand_v: area_posinfo
(0, 9) = 0: area_posinfo
(0, 10) = 0:
FOR t
= 1 TO tiles
- 1: area_posinfo
(t
, 5) = -1:
NEXT t
FOR atiles
= 0 TO tiles
- 1: avx
= 0: avy
= 0: av
= 0 'the geometric mean of the area, if any tiles in it FOR atiles2
= 0 TO tiles
- 1:
IF tiles
(atiles2
, 6) = atiles
THEN av
= av
+ 1: avx
= avx
+ tiles
(atiles2
, 4): avy
= avy
+ tiles
(atiles2
, 5) area_posinfo(atiles, 0) = avx / av + .5 'X coordinate puzzle rotating point
area_posinfo(atiles, 1) = avy / av + .5 'X coordinate puzzle rotating point
area_posinfo(atiles, 2) = start_area_x '(monx - psx) / 2 '+ psx / puzzle_x * area_posinfo(atiles, 0) 'X coordinate in monitor
area_posinfo(atiles, 3) = start_area_y '(mony - psy) / 2 '+ psy / puzzle_y * area_posinfo(atiles, 1) 'Y coordinate in monitor
area_posinfo(atiles, 4) = start_area_rotate '0 'ROTATE scale in monitor
area_posinfo(atiles, 5) = atiles 'draw order
area_posinfo(atiles, 6) = sh_rand_m * sh_rand_v 'X shuffling vector
area_posinfo(atiles, 7) = sh_rand_m * sh_rand_v 'Y shuffling vector
area_posinfo(atiles, 8) = sh_rand_m * sh_rand_v 'rotating shuffling angle
area_posinfo(atiles, 9) = 0 'command X over limit
area_posinfo(atiles, 10) = 0 'command Y over limit
ELSE area_posinfo
(atiles
, 5) = -1 'draw order = no ,because missing in area
_DEST mon:
_SOURCE bg: theend
= 0: shuffling_timer
= shuffling_cycle
* (first_start
XOR 1): first_start
= 0
'---------------- BOSS CYCLE ---------------------------------------------------------------------------------------------------------------------------
'keyboard and mouse commands
mb1_click
= mb1
AND mb1
<> mb1_old: mb2_click
= mb2
AND mb2
<> mb2_old
shift_ok
= _KEYDOWN(49) OR (mb1
AND keyview_act
= 3) 'ikey$ = "1" '(mb1 AND keyview_act = 3) OR (_KEYDOWN(100304) OR _KEYDOWN(100303)) ctrl_ok
= _KEYDOWN(50) OR (mb1
AND keyview_act
= 4) 'ikey$ = "2" '(mb1 AND keyview_act = 4) OR (_KEYDOWN(100306) OR _KEYDOWN(100305)) only1
= ctrl_ok: together
= ABS(shift_ok
OR ctrl_ok
OR theend
) AND (actual_elements
> 1) rotating_speed
(0) = rotating_speed
(0) - ABS(keyview_act
= 2) * (mw
+ mb1_click
- mb2_click
) - (ikey$
= "*") + (ikey$
= "/") moving_speed
(0) = moving_speed
(0) - ABS(keyview_act
= 1) * (mw
+ mb1_click
- mb2_click
) - (ikey$
= "+") + (ikey$
= "-") rotating_speed
(0) = (ABS(rotating_speed
(0) < 0) XOR 1) * rotating_speed
(0): moving_speed
(0) = (ABS(moving_speed
(0) < 0) XOR 1) * moving_speed
(0) mb1_old = mb1: mb2_old = mb2
'shuffling operation
shuffling
= ABS(shuffling_timer
> 0): shuffling_timer
= (shuffling_timer
- 1) * shuffling: shuffling_speed_act
= SIN(3.1415 / shuffling_cycle
* shuffling_timer
) shuffle_m
= (moving_speed
(1) * shuffling_speed_act
* shuffling
) + moving_speed
(0) / 4 * (shuffling
XOR 1) shuffle_r
= (rotating_speed
(1) * shuffling_speed_act
* shuffling
) + rotating_speed
(0) / 10 * (shuffling
XOR 1):
GOSUB shuffling
'MOUSE1 POSITION
moving
= moving
* (ABS(mb1
= 0 AND moving
) XOR 1) moving_tile = act_area: moving = 1: smovex = mousex: smovey = mousey: sareax = area_posinfo(moving_tile, 2): sareay = area_posinfo(moving_tile, 3)
IF moving
THEN area_posinfo
(moving_tile
, 2) = mousex
- smovex
+ sareax: area_posinfo
(moving_tile
, 3) = mousey
- smovey
+ sareay
'MOUSE ROTAITION (wheel)
IF act_area
<> -1 THEN area_posinfo
(act_area
, 4) = area_posinfo
(act_area
, 4) - mw
* (360 / puzzle_r
) * 32:
IF mw
THEN GOSUB to_underground: mw_act
= 1
IF sh_act
<> -1 AND mb1
THEN 'if complete 100% and choice a new variation puzzle_x
= sh
(sh_act
, 1): puzzle_y
= sh
(sh_act
, 0): sh_act
= -1: area
= 0:
DO UNTIL area_posinfo
(area
, 5) <> -1: area
= area
+ 1:
LOOP start_area_x
= area_posinfo
(area
, 2): start_area_y
= area_posinfo
(area
, 3): start_area_rotate
= area_posinfo
(area
, 4):
GOTO restart_point
'AREA-ROTATION NORMALIZE
DO WHILE area_posinfo
(area
, 4) > puzzle_r
- 1: area_posinfo
(area
, 4) = area_posinfo
(area
, 4) - puzzle_r:
LOOP DO WHILE area_posinfo
(area
, 4) < 0: area_posinfo
(area
, 4) = area_posinfo
(area
, 4) + puzzle_r:
LOOP
'drawing and mouse-commands sensitive
damp
= 0: act_area
= -1: act_tile
= -1:
_PUTIMAGE:
FOR area_order
= 0 TO tiles
- 1:
'area scanning of order NEXT area
'find next area or find empty area
IF area
< tiles
AND area
<> -1 THEN 'if area is not empty amp
= 0:
FOR atiles
= 0 TO tiles
- 1 'work actual tile
'rotating to draw
px(0) = psxppx * (tiles(atiles, 4)): py(0) = psyppy * (tiles(atiles, 5)): px(1) = psxppx * (tiles(atiles, 4) + 1): py(1) = py(0)
px(2) = px(0): py(2) = psyppy * (tiles(atiles, 5) + 1): px(3) = px(1): py(3) = py(2)
angle
= 360 / puzzle_r
* INT(area_posinfo
(area
, 4)) * pip180
* st_rotating
'where i to draw tile
rotp_x = psxppx * area_posinfo(area, 0): rotp_y = psyppy * area_posinfo(area, 1)
FOR t
= 0 TO 3: oldx
= px
(t
) - rotp_x: oldy
= py
(t
) - rotp_y
x
= (oldx
* COS(angle
)) + (oldy
* SIN(angle
)): y
= (oldy
* COS(angle
)) - (oldx
* SIN(angle
)) px(t) = x + rotp_x + area_posinfo(area, 2): py(t) = y + rotp_y + area_posinfo(area, 3)
join(area, atiles, t * 2) = px(t): join(area, atiles, t * 2 + 1) = py(t) 'possible or non-existent tiles drawing position
'current TILE drawing assessment
'the question is whether the act_tile_old is included in the current AREA of eppen.
'if not, there is a chance that you will need to flash in the case of MOUSE2.
'if we put ACT_TILE_OLD in the current area, would you have a neighbor in the corresponding AREA? if so, flash it
atiles_st
= -1:
IF tiles
(atiles
, 6) = area
THEN '-1 tile nem kell mutatni,0 actual tile ,1 help neighbor tile atiles_st
= 0: atiles_d
= atiles:
GOSUB draw2
'tile az aktualis kirajzolando FOR a_n
= 0 TO 3: anei
= tiles
(act_tile_old
, 7 + a_n
):
IF anei
<> -1 THEN act_ne
= tiles
(anei
, 6):
IF act_ne
= area
THEN atiles_st
= 1: atiles_d
= atiles:
GOSUB draw2:
EXIT FOR
'write the correct order to dmp array (direct maptriangle commands)
NEXT area_order: act_area_old
= act_area: act_tile_old
= act_tile
'direct draw _maptriangle using dmp array
FOR t
= 0 TO damp
- 1:
_MAPTRIANGLE (dmp
(t
, 0), dmp
(t
, 1))-(dmp
(t
, 2), dmp
(t
, 3))-(dmp
(t
, 4), dmp
(t
, 5)), pic
(dmp
(t
, 6)) TO(dmp
(t
, 7), dmp
(t
, 8))-(dmp
(t
, 9), dmp
(t
, 10))-(dmp
(t
, 11), dmp
(t
, 12)), mon
, _SMOOTH:
NEXT t
'calculating elements
actual_elements
= 0:
FOR t
= 0 TO tiles
- 1: actual_elements
= (ABS(area_posinfo
(t
, 5) <> -1)) + actual_elements:
NEXT t
'any text and setup view and registration command
setup_minx
= (keyviewx
+ setupminlen
- 1) * 8: setup_active
= ((mousex
< 10 OR setup_active
) AND (setup_minx
> mousex
)) OR actual_elements
= 1 keyviewc = 7: fcalc = 1
keyview$
(0) = "- R - rotating (" + en$
(st_rotating
) + ")": keyview$
(1) = "- +,- - moving speed (" + STR$(INT(moving_speed
(0))) + ")" keyview$
(2) = "- *,/ - rotating speed (" + STR$(INT(rotating_speed
(0))) + ")": keyview$
(3) = "- 1 - Together1 command (" + en$
(ABS(shift_ok
)) + ")" keyview$
(4) = "- 2 - Together2 command (" + en$
(ABS(ctrl_ok
)) + ")": keyview$
(5) = "- N - New Game": keyview$
(6) = "- ESC - Exit" keyview_act
= -1: setupminlen
= 0:
FOR t
= 0 TO keyviewc
- 1:
IF setupminlen
< LEN(keyview$
(t
)) THEN setupminlen
= LEN(keyview$
(t
)) x1
= (keyviewx
- 1) * 8: x2
= x1
+ LEN(keyview$
(t
)) * 8: y1
= (keyviewy
- 1 + t
) * 16: y2
= y1
+ 16COLOR col_inact:
PRINT "Right mouse button helps you where to put it":
END IF
'writing to display shuffle variations if only 1 area active = completed is 100%
sh_act
= -1:
IF actual_elements
= 1 THEN FOR t
= 0 TO shc
- 1:
IF (sh
(t
, 4) < mousex
AND sh
(t
, 5) > mousex
) AND (sh
(t
, 6) < mousey
AND (sh
(t
, 6) + 16) > mousey
) THEN IF sh_act
<> -1 THEN 'draw grid to picture area
= 0:
DO UNTIL area_posinfo
(area
, 5) <> -1: area
= area
+ 1:
LOOP: gx0
= join
(area
, 0, 0): gy0
= join
(area
, 0, 1): gx1
= join
(area
, puzzle_y
- 1, 4) gy1 = join(area, puzzle_y - 1, 5): gx2 = join(area, tiles - puzzle_y, 2): gy2 = join(area, tiles - puzzle_y, 3): gx3 = join(area, tiles - 1, 6)
gy3
= join
(area
, tiles
- 1, 7):
COLOR _RGB32(255, 255, 255) FOR t
= 1 TO sh
(sh_act
, 0) - 1: x1
= gx0
+ (gx1
- gx0
) / (sh
(sh_act
, 0)) * t: y1
= gy0
+ (gy1
- gy0
) / (sh
(sh_act
, 0)) * t
x2
= gx2
+ (gx3
- gx2
) / (sh
(sh_act
, 0)) * t: y2
= gy2
+ (gy3
- gy2
) / (sh
(sh_act
, 0)) * t:
LINE (x1
, y1
)-(x2
, y2
):
NEXT t
FOR t
= 1 TO sh
(sh_act
, 1) - 1: x1
= gx0
+ (gx2
- gx0
) / (sh
(sh_act
, 1)) * t: y1
= gy0
+ (gy2
- gy0
) / (sh
(sh_act
, 1)) * t
x2
= gx1
+ (gx3
- gx1
) / (sh
(sh_act
, 1)) * t: y2
= gy1
+ (gy3
- gy1
) / (sh
(sh_act
, 1)) * t:
LINE (x1
, y1
)-(x2
, y2
):
NEXT t
fto
= area_posinfo
(act_area
, 5):
FOR atiles
= 0 TO tiles
- 1:
IF area_posinfo
(atiles
, 5) > fto
THEN area_posinfo
(atiles
, 5) = area_posinfo
(atiles
, 5) - 1NEXT atiles: area_posinfo
(act_area
, 5) = tiles
- 1:
RETURN
joining: 'a1 area will be what we're looking at, a2 area will be overwritten if it's okay
disx = join(a1area, a1tiles, t * 2) - join(a2area, a1tiles, t * 2): disy = join(a1area, a1tiles, t * 2 + 1) - join(a2area, a1tiles, t * 2 + 1)
'found a match here between area1 and area2 in the a1tiles tile.
FOR a2tiles
= 0 TO tiles
- 1: analy
(tiles
(a2tiles
, 4), tiles
(a2tiles
, 5)) = ABS(tiles
(a2tiles
, 6) = a1area
OR tiles
(a2tiles
, 6) = a2area
):
NEXT a2tiles
tile_sum
= 0:
FOR anax
= 0 TO puzzle_x
- 1:
FOR anay
= 0 TO puzzle_y
- 1:
IF analy
(anax
, anay
) THEN tile_sum
= tile_sum
+ 1: sax
= anax: say
= anay
NEXT anay
, anax: analy
(sax
, say
) = 2: discovery
= 1:
DO: discovery_old
= discovery:
FOR anax
= 0 TO puzzle_x
- 1:
FOR anay
= 0 TO puzzle_y
- 1 FOR t
= 0 TO 3: t1
= SGN(t
AND 1): t2
= SGN(t
AND 2): prex
= (t1
* 2 - 1) * t2
+ anax: prey
= (t1
* 2 - 1) * (t2
XOR 1) + anay
IF analy
(prex
, prey
) = 1 THEN analy
(prex
, prey
) = 2: discovery
= discovery
+ 1 FOR t
= 0 TO tiles
- 1:
IF tiles
(t
, 6) = a1area
THEN tiles
(t
, 6) = a2area
tile_to_center:
FOR atiles
= 0 TO tiles
- 1: avx
= 0: avy
= 0: av
= 0 FOR atiles2
= 0 TO tiles
- 1:
IF tiles
(atiles2
, 6) = atiles
THEN av
= av
+ 1: avx
= avx
+ tiles
(atiles2
, 4): avy
= avy
+ tiles
(atiles2
, 5) area_posinfo(atiles, 0) = avx / av + .5: area_posinfo(atiles, 1) = avy / av + .5 'X-Y coordinate puzzle rotating point (to mouse rotation)
ELSE area_posinfo
(atiles
, 5) = -1 'empty area
auto_inwindow: 'does not allow the area to exit the screen too much'
minx = 9999999999: maxx = -minx: miny = minx: maxy = maxx
IF join
(area
, atiles
, t
) > maxy
THEN maxy
= join
(area
, atiles
, t
) IF join
(area
, atiles
, t
) < miny
THEN miny
= join
(area
, atiles
, t
) IF join
(area
, atiles
, t
) > maxx
THEN maxx
= join
(area
, atiles
, t
) IF join
(area
, atiles
, t
) < minx
THEN minx
= join
(area
, atiles
, t
) NEXT t:
NEXT atiles: movex
= (lwindow_x1
- maxx
) * ABS(maxx
< lwindow_x1
) + (lwindow_x2
- minx
) * ABS(minx
> lwindow_x2
) movey
= (lwindow_y1
- maxy
) * ABS(maxy
< lwindow_y1
) + (lwindow_y2
- miny
) * ABS(miny
> lwindow_y2
) area_posinfo(area, 2) = area_posinfo(area, 2) + movex: area_posinfo(area, 3) = area_posinfo(area, 3) + movey
area_posinfo
(area
, 9) = ABS(movex
): area_posinfo
(area
, 10) = ABS(movey
):
NEXT area:
RETURN
DO: shok
= 1: area_posinfo
(area
, 2) = area_posinfo
(area
, 2) + area_posinfo
(area
, 6) * shuffle_m
area_posinfo(area, 3) = area_posinfo(area, 3) + area_posinfo(area, 7) * shuffle_m
area_posinfo(area, 4) = area_posinfo(area, 4) + area_posinfo(area, 8) * shuffle_r * (1 / 360 * puzzle_r)
rand
= (INT(rotating_moving_chance
* RND(1)) = 1) AND shuffling
= 0:
IF rand
THEN area_posinfo
(area
, 8) = -area_posinfo
(area
, 8) IF area_posinfo
(area
, 9) OR rand
THEN area_posinfo
(area
, 6) = -SGN(area_posinfo
(area
, 6)) * sh_rand_m: area_posinfo
(area
, 8) = sh_rand_v
* sh_rand_m: shok
= 0 IF area_posinfo
(area
, 10) OR rand
THEN area_posinfo
(area
, 7) = -SGN(area_posinfo
(area
, 7)) * sh_rand_m: area_posinfo
(area
, 8) = sh_rand_v
* sh_rand_m: shok
= 0
IF only1
THEN area
= only1_area
- 1 ELSE area
= -1 difx = start_area_x_s - area_posinfo(area, 2): dify = start_area_y_s - area_posinfo(area, 3)
rotdif1 = (start_area_rotate_s - area_posinfo(area, 4)): rotdif2 = (start_area_rotate_s - (area_posinfo(area, 4) + puzzle_r))
rotdif3 = (start_area_rotate_s - (area_posinfo(area, 4) - puzzle_r))
area_posinfo
(area
, 2) = start_area_x_s: area_posinfo
(area
, 3) = start_area_y_s: area_posinfo
(area
, 4) = start_area_rotate_s: only1_area
= -1:
EXIT DO IF ABS(rotdif
) < dislimit
AND ABS(difx
) < dislimit
AND ABS(dify
) < dislimit
THEN speed
= together_speed_slow
ELSE speed
= together_speed
speed = together_speed_slow
area_posinfo(area, 4) = (area_posinfo(area, 4) + (rotdif * (1 / 360 * puzzle_r) / 20 * speed)): area_posinfo(area, 2) = area_posinfo(area, 2) + difx / 10 * speed
area_posinfo
(area
, 3) = area_posinfo
(area
, 3) + dify
/ 10 * speed:
IF only1
THEN EXIT DO
draw2:
'which area (tile in area) under mouse ?
oldx = (px(0) + px(1) + px(2) + px(3)) / 4 - mousex: oldy = (py(0) + py(1) + py(2) + py(3)) / 4 - mousey
x
= (oldx
* COS(-angle
)) + (oldy
* SIN(-angle
)): y
= (oldy
* COS(-angle
)) - (oldx
* SIN(-angle
)) IF (-ptx
< x
AND ptx
> x
) AND (-pty
< y
AND pty
> y
) AND atiles_st
= 0 THEN act_area
= area: act_tile
= atiles
'title part of it all
qx0 = tiles(atiles_d, 0): qy0 = tiles(atiles_d, 1): qx1 = tiles(atiles_d, 2): qy1 = qy0
qx2 = tiles(atiles_d, 0): qy2 = tiles(atiles_d, 3): qx3 = tiles(atiles_d, 2): qy3 = qy2
'draw black border under tile
draw_actual_border
= ((area
= act_area_old
AND und_flash
) XOR 1) AND atiles_st
= 0 AND puzzle_b
> 0: draw_actual
= atiles_st
= 0 OR atiles_st
= help_flash
IF draw_actual_border
THEN 'draw border FOR t
= 1 TO puzzle_b
- 1 mp(amp, 0) = 0: mp(amp, 1) = 0: mp(amp, 2) = 9: mp(amp, 3) = 0: mp(amp, 4) = 0: mp(amp, 5) = 9: mp(amp, 6) = 1: mp(amp, 7) = px(0) + t
mp(amp, 8) = py(0) + t: mp(amp, 9) = px(1) + t: mp(amp, 10) = py(1) + t: mp(amp, 11) = px(2) + t: mp(amp, 12) = py(2) + t: amp = amp + 1
mp(amp, 0) = 9: mp(amp, 1) = 9: mp(amp, 2) = 9: mp(amp, 3) = 0: mp(amp, 4) = 0: mp(amp, 5) = 9: mp(amp, 6) = 1: mp(amp, 7) = px(3) + t
mp(amp, 8) = py(3) + t: mp(amp, 9) = px(1) + t: mp(amp, 10) = py(1) + t: mp(amp, 11) = px(2) + t: mp(amp, 12) = py(2) + t: amp = amp + 1
'draw tile
mp(amp, 0) = qx0: mp(amp, 1) = qy0: mp(amp, 2) = qx1: mp(amp, 3) = qy1: mp(amp, 4) = qx2: mp(amp, 5) = qy2: mp(amp, 6) = 0: mp(amp, 7) = px(0)
mp(amp, 8) = py(0): mp(amp, 9) = px(1): mp(amp, 10) = py(1): mp(amp, 11) = px(2): mp(amp, 12) = py(2): amp = amp + 1: mp(amp, 0) = qx3
mp(amp, 1) = qy3: mp(amp, 2) = qx1: mp(amp, 3) = qy1: mp(amp, 4) = qx2: mp(amp, 5) = qy2: mp(amp, 6) = 0: mp(amp, 7) = px(3): mp(amp, 8) = py(3)
mp(amp, 9) = px(1): mp(amp, 10) = py(1): mp(amp, 11) = px(2): mp(amp, 12) = py(2): amp = amp + 1
'SIMPLE PUZZLE GAME BY MASTERGY, 2020