Sta radi tvoj "inteligentan neprijatelj" kad dodje do sudara sa tobom? Najelegantnije resenje bi bilo da za
npr:
Collision Event with object neprijatelj:
if abs(hspeed) is larger than 0
set variable izuzetak to 1
if abs(vspeed) is larger than 0
set variable izuzetak to 2
set variable speed to 0
Key Press Event for <Left> Key:
if object is aligned with grid with cells of 40 by 40 pixels
set the horizontal speed to -4
if izuzetak is equal to 1
set the horizontal speed to -4
set variable izuzetak to 0
Key Press Event for <Up> Key:
if object is aligned with grid with cells of 40 by 40 pixels
set the vertical speed to -4
if izuzetak is equal to 2
set the horizontal speed to -4
set variable izuzetak to 0
Key Press Event for <Right> Key:
if object is aligned with grid with cells of 40 by 40 pixels
set the horizontal speed to 4
if izuzetak is equal to 1
set the horizontal speed to 4
set variable izuzetak to 0
Key Press Event for <Down> Key:
if object is aligned with grid with cells of 40 by 40 pixels
set the vertical speed to 4
if izuzetak is equal to 2
set the horizontal speed to 4
set variable izuzetak to 0