Commit Graph

98 Commits

Author SHA1 Message Date
4d27a2671a Cleanup Brick.render() 2018-11-22 20:52:20 +04:00
451ca13566 Add missing semicolon. 2018-11-22 18:55:15 +04:00
9e44b1e93f Change desktop resolution to 1/5th of native resolution 2018-11-22 17:39:13 +04:00
7ff4d3307a Add gdx-tools dependency, add TextureSetup class 2018-11-22 17:36:28 +04:00
9e8e00e9af Add random shape and type control to GridLevelLoader 2018-11-22 17:34:18 +04:00
44c3311cd9 Set powerup segment count to 20. 2018-11-22 17:31:28 +04:00
28eb4149ee Change background to black, paddle to white 2018-11-22 17:31:00 +04:00
36ae71afeb Add FileLevelLoader and FileLayout to load levels from json files
Add two levels to assets
2018-11-22 17:30:48 +04:00
90b92b1026 Remember to call super.dispose() in FieldState's dispose() 2018-11-22 17:23:53 +04:00
53feedf407 Pass spritebatch instance to all entity's render methods
Scale spritebatch and shaperenderer projections to PIXEL_PER_METER,
no longer have to scale in each entity's render method
Use a separate spritebatch for font rendering
Dispose the texture atlas
2018-11-22 15:44:13 +04:00
70f142c2fa Render bricks and ball using sprites instead of constructed polygons
Changed field width to 10 blocks instead of 11
2018-11-22 14:55:13 +04:00
bb8d4a41e3 Add hidden (press F12 at main menu) level editor mode
Saves a level.json in the external storage
2018-11-21 15:38:32 +04:00
157a247516 Calculate PIXEL_PER_METER 2018-11-21 15:26:19 +04:00
87f91cc2bc Reorder and add new brick shapes 2018-11-21 15:26:19 +04:00
3fdd394e36 Decreased brick size, increased edge padding, removed brick padding
Field is now 11 bricks wide instead of 10
Extended edge padding to Y=0
2018-11-21 15:26:19 +04:00
2a40bcabdf Use bit-or comparisons to create brick vertices, makes for shorter code
Added new brick shapes
2018-11-21 15:26:19 +04:00
ef698a38c1 Add new brick shapes. 2018-11-21 15:26:19 +04:00
2a398725f5 Override setX and setY in Brick to update box2d body's position.
Clean up Ball and Paddle's overrides
2018-11-21 15:26:19 +04:00
f90f5d5452 Add new abstract FieldState, which contains the Box2d world instance.
PlayState now extends FieldState instead of State.
Entity now takes a FieldState instead of a State instance.
Casts from State to PlayState where necessary in entities.
2018-11-21 15:26:13 +04:00
958232b2ff Remove unused Color import from Brick 2018-11-20 16:14:42 +04:00
989bb46d64 Add LevelLoader interface and Level class.
Add GridLevelLoader implementation, use to load initial level
Add logic to return to main menu when there's no more levels, or load the next
the next level
2018-11-20 16:14:15 +04:00
1aeab73cd0 Delete bricks that go below the bottom of the play field 2018-11-20 12:15:55 +04:00
5611bbc611 Add BrickLayout interace with an implementing GridLayout
Use new GridLayout to generate initial level
Remove some constructors in Birck
Add Color to BrickType enum, alter Brick to use it
2018-11-20 11:01:54 +04:00
719c32502c No longer allow balls to collect powerups 2018-11-19 23:41:48 +04:00
9df81ee854 Add dispose() to Entity and implement in Brick 2018-11-15 23:15:07 +04:00
e116f1064d Add additional brick shapes 2018-11-15 22:04:29 +04:00
4fa5841fb2 Fix correction impulse on ball 2018-11-15 22:03:12 +04:00
f70dc67878 Begin adding support for rendering different shaped bricks 2018-11-15 20:09:48 +04:00
64e00c1a1a Treat brick coordinates as their center 2018-11-15 18:19:54 +04:00
cb90c949ff New MINIMUM_ANGLE constant in Ball, currently PI/16
Apply impulses to ball when angle relative to horizontal axis is less
than MINIMUM_ANGLE. Prevents balls getting stuck going horizontally
2018-11-15 16:31:42 +04:00
998286de8d Ensure balls collide with the shield 2018-11-15 14:53:14 +04:00
9eac3353b6 Use instance bodies array 2018-11-15 14:48:32 +04:00
adebc42c16 Add Box2d collision filtering, allow collecting power ups with balls 2018-11-15 14:22:42 +04:00
74aa10de04 Refactor to use libGdx Array instead of java ArrayList
Render bricks with their box2d angle
Add ball density = 1f
2018-11-15 13:43:48 +04:00
b44b48097c Update paddle.update() to handle edge collision more nicely + cleaner code
Calculates an adjust variable which locates the paddle at exactly the
screen edge if a regular speed * dt move would put it past. Applies
the same adjust to stuck balls so they don't drift.
2018-11-15 12:24:33 +04:00
e4000998cc Complete box2d implementation, all collisions handled with box2d
Shield re-implemented as an entity with a box2d body
Multiball powerup now spawns balls at paddle instead of from block location
2018-11-15 10:34:22 +04:00
92201411b9 Refactor entity.PhysicsBody to physics.PhysicsBody
Create CollisionListener interface and Box2dContactListener
Register the Box2dContactListener with the box2d world
2018-11-14 22:26:02 +04:00
0994289c7e Begin box2d physics implementation.
Created box2d bodies for all game entities (except shield)
Scale units down to box2d friendly units (40:1 <-> pixels:box2d)
Use floats in places integers were used for position and sizing
2018-11-14 22:04:41 +04:00
fe2c68d39a Add FPS limit back 2018-11-13 22:55:39 +04:00
b3cbe0cda5 Remove magic value 2018-11-13 19:01:14 +04:00
e2c0bad9e0 Altered powerup weights (decreased glue, increased multi ball)
Allow bricks to have their colour changed.
2018-11-13 18:58:55 +04:00
ea6240bd2c Add PowerUpType enum
Handles weighted random seletion, color and instantiation, cleaning up
other sections of Brick and PlayState code.
2018-11-13 18:42:27 +04:00
0abae880d3 Add MenuState, start with it and switch back when a game is finished 2018-11-13 17:58:42 +04:00
fa7e93953b Speed ball up 2018-11-13 17:21:23 +04:00
409735d94e Scale entity units to new board units.
Rename Brick.BLOCK_ to Brick.BRICK_
2018-11-13 17:17:19 +04:00
1fe82cb5b2 Change viewport to FitViewport, board height/width to 4K
Enable font anti-aliasing
2018-11-13 17:14:33 +04:00
a56d721050 Move away from using pixel coordinates to "board coordinates"
Changed aspect ratio from 4:3 to 9:16
2018-11-13 15:58:01 +04:00
1c7e20f8e9 Move any stuck balls along with paddle when shields get added/removed 2018-11-13 12:54:09 +04:00
7588a0986b Refactored to use states
Various other refactoring, no functional differences
2018-11-13 11:51:00 +04:00
3fad2085b6 Refactor power up chance to be a variable 2018-11-13 10:21:05 +04:00