View Single Post
Old Apr 19th, 2008, 4:08 AM   #1
redfiretruck
Newbie
 
Join Date: Apr 2008
Posts: 23
Rep Power: 0 redfiretruck is on a distinguished road
VB Project (Grocery Store)

First of all, sorry about multi-threads but I honestly don't think these two are even closely similar or else I would put them both in the same thread .

This is a huge post because it has to be, I don't like when people say "here is my code, tell me what i did wrong" and I wouldn't feel right doing so... If you don't want to read it, then don't.


First of all, this isn't in order to get any achievement other than saying "yay i finished this" and it isn't for homework...


What is it? It is a Grocery Store simulation? It simulates (very badly) a person (npc) moving around the store and getting certain items and then going to the register and buying their item but only if a cashier is there of course right?

What have you done so far?
  • I have made a checker that makes sure they aren't going to walk into a wall or object (which is if it is within a certain top or left) and if it is it moves it so it won't. This is probably the thing I'm most proud of even tho it is simple .
  • I have made a random item grabber, and also a purchase code that actually purchases an item visually and in code it holds the amount of items the customers have bought...
-- Other random things that mean practically nothing xD.

What i haven't added?
  • A full analysis of all the information that has occured (tax info, item info, cash given back, bill given to pay with...)
  • Shopping carts

I'll add these later after i get the random and multi-image problem solved.

What doesn't work? (What i need help with)
  • The random class doesn't seem to work too well... What can i do to accomplish a hopefully truly random function?
  • The way i have it working (which is done with repeats) doesn't seem to be extremely functional due to it's inability to have two things moving at one time... How can i accomplish the same goal without the same limitations? My only thought is to have it with if statements and have true/false moving statements for each of the pictureboxes... But that seems like alot of work and too complicated for this...
I don't really know how people usually post their projects so I am using a zip file with the solution and all the form1.vb and stuff. Hopefully that is functional enough if it isn't what you guys usually do.

Direct Link To Download
-- Bit slow atm, dunno why but it will get there soon enough ... It is usually INSTANT 8(.

Explanation of how I have it working (since raw code is a pain to understand even if you wrote it yourself, and i hate doing comments and usually forget to because I'm so into my code xD.

The global variables...
  • b1/b2 is stored in case the cashier is Busy (1 and 2 meaning cashier #1 and cashier #2... is going to be used later when i get the multi-image working)
  • wi1, wi2, wi3 are all stored for the item the customer is with... Numbers held respectively to picturebox.
  • si, ci, pi, and bi are "soda integer" etc. They are the current count of how many soda/beer the customers have bought.
  • ccount1, ccount2, ccounttotal are all used to have the total customer count served and the amount of customers cashier #1/2 has gotten individually.
  • All the bads are the dimensions for all the objects... Bad1/2 for item 1 and so on... X being left and Y being top... Basically makes a square where the object is from the first dimension to the second dimension.
  • Black squares are the cashiers, Red is the new customer, and blue is the old customer (one that has already bought an item).
  • The function for soda/beer/cake/pill are just things to get the npc to go to that spot... It pulls a random number because I mean, how many times in a grocery store do you go to the exact spot right? .

-- I don't know how many problems there are of bad programs being shown, but I can tell you mine isn't a keylogger or anything... There aren't many lines of code and there all simple integers/images so it shouldn't be too hard to check it if you want to --

As an added note, I am not too good about making anything look good... Which is why i'm 24/7 at home and am into programming not image manipulating *cough* but anyway... As I said, I'm not too great at making things look good so this thread is a bit unorganized... But atleast i tried XD... Talking about looks, anyone else think cscgal is pretty hot?

Last edited by redfiretruck; Apr 19th, 2008 at 4:35 AM.
redfiretruck is offline   Reply With Quote