Re: how do you make weapons in your inventory

My idea in your case usually is an array of a class named item or whatever you like, that has a name and an amount variable. So you handle it that way. In the loop that you check for if the player presses up/down move in the inventory, if thep layer pressed enter activate the item, you tell the game to draw a weapon, based on the item name. For instance, if the focused item is the b32 machinegun, I'd say play the drawing sound for the said gun, then draw it. Drawing the weapon is depended on your code, I can't comment something that won't confuse you about it unless I see your code. But about spawning weapons in a map. If you're coding an offline game, the simple thing is that whenever you load a map, you usually do clear all objects and previously spawned tiles and stuff alike. So there's no need of a mapname for your items. Items are of course classes. You either can use the same class as for your items in the inventory, by simpley setting the x/y/z variables in the item class, or you can code another one. Do it in any way you prefer and in the loop that you define for checking your spawned items state and stuff alike, usually named a checkloop in our open sourced games(specially mason's opensourced games), or the class name plus a loop word as the suffix so like itemloop, You check if the player's location is equal to the item's position that is right now being processed in your for loop, add an inventory item to the array we defined previously named as the same as the spawned item, and then remove the spawn item. Now your player can pick up items, and use them in their inventory, and I know this was a bit confusing because I'm probably not so good at explaning the ways of coding certain stuff yet because i'm not a native english speaker, Or you still need to practice to get a programming mind. A programming mind is one of the most important prerequisites for being able to code exactly(or possibly as near as possible to) what You want to have.

-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
  • ... AudioGames . net Forum — Developers room : bopitmaster34 via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : kianoosh via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : kianoosh via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : lord via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : roelvdwal via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : lord via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : mazen via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : SkyLord via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : lord via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : giorgi elbaqidze via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : black_mana via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : black_mana via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : giorgi elbaqidze via Audiogames-reflector

Reply via email to