Skip to content

Commit

Permalink
bonus length increased + pacman is faster during bonus
Browse files Browse the repository at this point in the history
  • Loading branch information
HenJi committed Nov 6, 2011
1 parent b3f7642 commit c063b85
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/default.opa
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ Default = {{
|> _.f2

pacman = {
base = Base.make(13, 16, {right}, 10)
base = Base.make(13, 16, {right}, pacman_speed)
next_dir = {right}
mouth_step = 0
mouth_incr = 1
Expand All @@ -97,7 +97,7 @@ Default = {{
@private make_ghost(ai, prison, color, eye_color) =
~{x y} = Set.random_get(ghost_prison) |> Option.get
{ ~ai ~color ~eye_color
base = Base.make(x, y, {up}, 11)
base = Base.make(x, y, {up}, ghosts_speed)
prison = some(prison)
eye_step = 0
eye_steps = 32
Expand Down
10 changes: 7 additions & 3 deletions src/food.opa
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
@client Food = {{

check(pos, food, cur_steroids) =
speed =
if Option.is_none(cur_steroids) then pacman_speed
else pacman_speed_on_steroids
match Map.extract(pos, food) with
| (food, {none}) -> (food, 0, cur_steroids)
| (food, {none}) -> (food, 0, cur_steroids, speed)
| (food, {some=f}) ->
(food, d) =
if food == Map.empty then (Default.food, clear_bonus)
else (food, 0)
match f with
| {normal} -> (food, food_points+d, cur_steroids)
| {normal} -> (food, food_points+d, cur_steroids, speed)
| {steroids} ->
new_steroids = match cur_steroids with
| {none} ->
Expand All @@ -17,7 +20,8 @@
| {some=s} ->
{cycles = s.cycles+steroid_len
combo = s.combo}
(food, steroid_points+d, some(new_steroids))
(food, steroid_points+d,
some(new_steroids), pacman_speed_on_steroids)

draw(g, ctx:Canvas.context) =
food = g.food
Expand Down
5 changes: 4 additions & 1 deletion src/opacman.opa
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,13 @@ info_width = 250

food_points = 10
steroid_points = 100
steroid_len = 5*fps /* frames */
steroid_len = 6*fps /* frames */
clear_bonus = 500
life_points = 2500

pacman_speed = 10
pacman_speed_on_steroids = 8
ghosts_speed = 11

/* Defaults */

Expand Down
7 changes: 4 additions & 3 deletions src/pacman.opa
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,9 @@
y = mod(grid_heigth + p.base.pos.y + dy, grid_heigth)
}

(food, dscore, steroids) =
if cur_step != p.base.max_steps/4 then (g.food, 0, g.on_steroids)
(food, dscore, steroids, max_steps) =
if cur_step != p.base.max_steps/4 then
(g.food, 0, g.on_steroids, p.base.max_steps)
else Food.check(pos, g.food, g.on_steroids)
score = g.score + dscore
lives = g.lives + (score/life_points - g.score/life_points)
Expand All @@ -89,7 +90,7 @@
{ p with
mouth_step = mouth
mouth_incr = dmouth
base = { p.base with ~pos ~dir ~cur_step } }
base = { p.base with ~pos ~dir ~cur_step ~max_steps} }
{g with ~pacman ~food ~score ~lives ~on_steroids}

}}

0 comments on commit c063b85

Please sign in to comment.