@@ -13,7 +13,7 @@ extern int characterIdx;
13
13
extern int tauntIdx ;
14
14
15
15
#define MAX_LIVES 20
16
- #define LEVEL_CHANGE_SCORE 100
16
+ #define LEVEL_CHANGE_SCORE 400
17
17
18
18
static double OBSTACLE_PROBABILITY = 0.02 ;
19
19
static Vector2 playerPosition = {0 };
@@ -42,6 +42,7 @@ static Texture2D button = {0};
42
42
static Camera2D camera = {0 };
43
43
Texture2D grassland = {0 };
44
44
Texture2D household = {0 };
45
+ Texture2D sofaset = {0 };
45
46
46
47
Music oof = {0 };
47
48
Music gameOST = {0 };
@@ -282,14 +283,22 @@ void InitGameScreen(void) {
282
283
Image image = LoadImage ("resources/char.png" );
283
284
ImageResizeNN (& image , image .width * 4 , image .height * 4 );
284
285
player = LoadTextureFromImage (image );
286
+ UnloadImage (image );
285
287
286
288
Image grasslandImage = LoadImage ("resources/grassland.png" );
287
289
ImageResizeNN (& grasslandImage , grasslandImage .width * 4 , grasslandImage .height * 4 );
288
290
grassland = LoadTextureFromImage (grasslandImage );
291
+ UnloadImage (grasslandImage );
289
292
290
293
Image householdImage = LoadImage ("resources/household.png" );
291
294
ImageResizeNN (& householdImage , householdImage .width * 4 , householdImage .height * 4 );
292
295
household = LoadTextureFromImage (householdImage );
296
+ UnloadImage (householdImage );
297
+
298
+ Image sofasetImage = LoadImage ("resources/sofa_set.png" );
299
+ ImageResizeNN (& sofasetImage , sofasetImage .width * 4 , sofasetImage .height * 4 );
300
+ sofaset = LoadTextureFromImage (sofasetImage );
301
+ UnloadImage (sofasetImage );
293
302
294
303
playerSpriteWidth = player .width / 10 ;
295
304
playerSpriteHeight = player .height / 20 ;
@@ -1157,6 +1166,7 @@ void UnloadGameScreen(void) {
1157
1166
UnloadTexture (button9 );
1158
1167
UnloadTexture (button );
1159
1168
UnloadTexture (player );
1169
+ UnloadTexture (sofaset );
1160
1170
UnloadMusicStream (oof );
1161
1171
UnloadMusicStream (gameOST );
1162
1172
UnloadMusicStream (click );
@@ -1305,16 +1315,29 @@ void DrawObstaclesHome(void) {
1305
1315
int dy = y - vy * 3 ;
1306
1316
assert (dx < 3 );
1307
1317
assert (dy < 3 );
1308
- int oj = dx ;
1309
- int oi = 18 + dy ;
1310
1318
1311
- Rectangle obstacleRect =
1312
- {.x = 16 * 4 * oj , .y = 16 * 4 * oi , .width = 16 * 4 , .height = 16 * 4 };
1313
- DrawTextureRec (
1314
- household ,
1315
- obstacleRect ,
1316
- (Vector2 ){x * playerSpriteWidth , y * playerSpriteHeight },
1317
- WHITE );
1319
+ int choice = rng_u64 ((uint64_t )vy << 31 | vx ) % 5 ;
1320
+ if (choice < 3 ) {
1321
+ int oj = choice * 3 + dx ;
1322
+ int oi = dy ;
1323
+ Rectangle obstacleRect =
1324
+ {.x = 16 * 4 * oj , .y = 16 * 4 * oi , .width = 16 * 4 , .height = 16 * 4 };
1325
+ DrawTextureRec (
1326
+ sofaset ,
1327
+ obstacleRect ,
1328
+ (Vector2 ){x * playerSpriteWidth , y * playerSpriteHeight },
1329
+ WHITE );
1330
+ } else {
1331
+ int oj = dx ;
1332
+ int oi = 18 + dy ;
1333
+ Rectangle obstacleRect =
1334
+ {.x = 16 * 4 * oj , .y = 16 * 4 * oi , .width = 16 * 4 , .height = 16 * 4 };
1335
+ DrawTextureRec (
1336
+ household ,
1337
+ obstacleRect ,
1338
+ (Vector2 ){x * playerSpriteWidth , y * playerSpriteHeight },
1339
+ WHITE );
1340
+ }
1318
1341
} else {
1319
1342
int oi = 23 + obstacleType / 8 ;
1320
1343
int oj = obstacleType % 8 ;
0 commit comments