summaryrefslogtreecommitdiff
path: root/main.f90
diff options
context:
space:
mode:
authorJeffrey Armstrong <jeffrey.armstrong@approximatrix.com>2014-08-21 11:21:01 -0400
committerJeffrey Armstrong <jeffrey.armstrong@approximatrix.com>2014-08-21 11:21:01 -0400
commitbcdef9aafc02bd8cd5703d353d105e1fc15b0820 (patch)
treea3f26e87448b0b397e3e36c5067c2457057345e5 /main.f90
parentcfbab1a4d15174c88e538eb18cfaf43650442319 (diff)
downloadfetris-master.tar.gz
fetris-master.zip
The next piece is now visible under the scoreHEADmaster
Diffstat (limited to 'main.f90')
-rw-r--r--main.f9016
1 files changed, 12 insertions, 4 deletions
diff --git a/main.f90 b/main.f90
index 1d31363..b7052bb 100644
--- a/main.f90
+++ b/main.f90
@@ -23,6 +23,8 @@ real(kind=8)::current_time, last_update
g%falling = new_piece()
g%piece_stuck = .FALSE.
+ g%waiting = new_piece()
+
call system_clock(count_rate=count_rate)
playing = .TRUE.
@@ -30,6 +32,7 @@ real(kind=8)::current_time, last_update
last_update = 0
last_score = -1
call draw_score(g)
+ call draw_next(g)
do while(playing)
@@ -41,6 +44,8 @@ real(kind=8)::current_time, last_update
last_update = current_time
call move_piece(g)
redraw = .TRUE.
+ else
+ !call MilliSleep(50)
end if
if(g%piece_stuck) then
@@ -48,16 +53,19 @@ real(kind=8)::current_time, last_update
last_score = g%score
call check_rows(g)
- new_p = new_piece()
- if(.NOT. check_piece(g, new_p, new_p%r, new_p%c)) then
+ !new_p = new_piece()
+ if(.NOT. check_piece(g, g%waiting, g%waiting%r, g%waiting%c)) then
loser = .TRUE.
playing = .FALSE.
call clear_keys()
exit
else
- g%falling = new_p
+ g%falling = g%waiting
g%piece_stuck = .FALSE.
call clear_keys()
+
+ g%waiting = new_piece()
+ call draw_next(g)
end if
end if
@@ -126,5 +134,5 @@ contains
end do
end subroutine clear_keys
-
+
end program fetris \ No newline at end of file