added carrot item, not handling drop of items other than tomato yet however

This commit is contained in:
Stefan Stefanov 2025-01-08 22:53:35 +02:00
parent 498e5cb4a2
commit 0fa4bb23e9
3 changed files with 14 additions and 0 deletions

BIN
assets/carrot_item.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 204 B

View file

@ -46,6 +46,9 @@ InventoryItem :: enum {
tomato,
tomato_seed,
tomato_seedling,
carrot,
carrot_seed,
carrot_seedling,
//Other
}
@ -130,11 +133,15 @@ init_hotbar_from_inventory :: proc() {
append(&hotbar.tool_slots, item)
}
case .tomato_seed:
fallthrough
case .carrot_seed:
if amount > 0 {
append(&hotbar.seed_slots, item)
}
case .tomato:
case .tomato_seedling:
case .carrot:
case .carrot_seedling:
}
}
}

View file

@ -8,6 +8,7 @@ pickup_sound_data: []u8 : #load("../assets/sounds/pickup_sound.mp3")
player_spritesheet_sprite: []u8 : #load("../assets/player.png")
tomato_spritesheet_sprite: []u8 : #load("../assets/tomato.png")
tomato_item_sprite: []u8 : #load("../assets/tomato_item.png")
carrot_item_sprite: []u8 : #load("../assets/carrot_item.png")
sell_button_sprite: []u8 : #load("../assets/sell_button.png")
background_sprite: []u8 : #load("../assets/background.png")
tool_ui_npatch_sprite: []u8 : #load("../assets/tool_ui_npatch.png")
@ -29,6 +30,7 @@ tool_ui_npatch: rl.NPatchInfo
tile_dirt_dry_texture: rl.Texture2D
tile_dirt_wet_texture: rl.Texture2D
tomato_texture: rl.Texture2D
carrot_texture: rl.Texture2D
hoe_texture: rl.Texture2D
scythe_texture: rl.Texture2D
watering_can_texture: rl.Texture2D
@ -97,6 +99,7 @@ load_resources :: proc() {
tile_dirt_dry_texture = load_texture_from_memory(tile_dirt_dry_sprite)
tile_dirt_wet_texture = load_texture_from_memory(tile_dirt_wet_sprite)
tomato_texture = load_texture_from_memory(tomato_item_sprite)
carrot_texture = load_texture_from_memory(carrot_item_sprite)
hoe_texture = load_texture_from_memory(hoe_sprite)
scythe_texture = load_texture_from_memory(scythe_sprite)
@ -117,6 +120,7 @@ load_resources :: proc() {
// Starting inventory
player_inventory[.tomato_seed] = 5
player_inventory[.carrot_seed] = 5
player_inventory[.hoe] = 1
player_inventory[.watering_can] = 1
player_inventory[.scythe] = 1
@ -135,6 +139,9 @@ load_resources :: proc() {
.tomato = &tomato_texture,
.tomato_seed = &tomato_texture,
.tomato_seedling = &tomato_texture,
.carrot = &carrot_texture,
.carrot_seed = &carrot_texture,
.carrot_seedling = &carrot_texture,
}
}