Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 27 Jun 2001
Offline Last Active Yesterday, 09:15 AM

#5293060 Kinda hard to explain this

Posted by BeerNutts on Yesterday, 09:14 AM

Also, this is wrong:

    item_holder = input(subcores_prompt)
    if item_holder in subcores:
        print("This isn't an item, sorry.")
        active = 0
    if add_item_active == 1:


You're setting active to 0, you need to be setting add_item_active = 0


Good luck, and keep working at it!

#5292102 Any Mentors Out There?

Posted by BeerNutts on 17 May 2016 - 12:11 PM

The only difficulty that could be faced by a "whole forum of mentors" is each mentor might have a slightly different perspective on things, and everyone of them could be a good way to do things, but they are different.That could often be confusing for a begineer.


Whereas, with a single mentor, he will lead him down one specific path.  Hopefully it is a good path, but it will be a single path that he believes in, and without the confusion of the specific direction to take.

#5290990 I aspire to be an app developer

Posted by BeerNutts on 10 May 2016 - 10:52 AM

Just because you know how to program, and even if you're very good at it and know most of the ins and outs of game programming, doesn't mean you'll be able to make a living with "going commercial with any games i create".  There's a HUGE difference between knowing how to write games, and creating a good game that makes a sizable amount of money.


I'm not telling you this to get you down; rather, you might want to think about finding a career working for a company (making games if you can, else a typical programming job), and maybe work on your game making on the side.  Assuming you'll be able to make a living making games by yourself isn't a good long term plan (especially since you've just started learning to program).


Either way, good luck, and have fun.

#5287498 How did you learn making games?

Posted by BeerNutts on 18 April 2016 - 12:15 PM

They were popular in much of the US as well in the peak time frame, from 1990-1995, hitting a sudden drop-off with the invention and popularization of the World Wide Web.


For many of us (including me) the BBS was my preferred way to access Usenet groups, since paid access to a BBS that processed subjects I was interested in was far cheaper than access to the school's SLIP services as a non-student.



Haven't heard anyone mention SLIP in a long time, we used to use slurp over our terminals to access the internet and browse the web with graphics using Mosaic!  It sure beat Lynx text browser, although the text browser was great for looking up fantasy football stats :)


I suppose I should answer the questions here too:


I 1st programmed BASIC on an Apple IIe, 5th grade, probably 1986, and I made text adventure games.  I never truly "learned the language" I only learned the parts of the language needed to make text games, but, considering it was simple input and if/then mechanisms, it didn't take too long.


No, I didn't upload any of those early games anywhere, and games I'm made more recently have mostly been just for me, or I've shared wqith a few friends as a hobby.


Occasionally, I'll get the urge to dabble with game making, but it's not as often any more, and if I do, again, it's just for fun as a hobby.

#5287495 Memory Allocation

Posted by BeerNutts on 18 April 2016 - 12:03 PM

 sizeof(struct Node *) <- isn't this wrong??


for a node you should allocate sizeof(struct node) otherwise you allocate only pointer size space (4 or 8 bytes?)


Yes, this is the problem, you should be calling malloc(sizeof(struct Node)) .


However, you can make life easier using new and delete, like this

// in push()
Node* temp = new Node;
// later, in pop()
delete temp;


And, I just noticed, in pop(), why are you calling malloc() on temp again, then immediately assigning temp to headNode?  Don't malloc temp in pop().


You need to understand memory allocation a little more, then you should be able to tackle this problem fine.

#5286913 Data Structures Help!

Posted by BeerNutts on 14 April 2016 - 01:59 PM

A few things:

#0, you really should've started a new thread for this.


#1, there's a major leak since you call malloc() every time push is called, you need to have a cooresponding call to free() when you pop or pop_all.  My suggesiton is to make pop() such that it calls free() on the node being deleted, and then, in pop_all, just call pop() until isEmpty() is true.


#2, you shouldn't have Queue as an include file (.inl).  Just make it a separate .cpp file and include it when compiling.


#3, it's bad practice to have a single include file (LibIncludes.h) which includes all the include files you need.  Just include the files the current file needs to operate properly on it's own.


#4, the Queue class should only be responsible for handling the data for insertion and retrieval, it should not be printing as well; rather, retreive the data from the Queue class, and print the results in the main class (or make a separate class call QueuePrint if you so desire).  Right now your Queue class is useless as an actual Queue.  it simply prints the data it has, a user can't use it at all to add and retreive items for use.


Just a few thoughts I had.


good luck!

#5285616 Data Structures Help!

Posted by BeerNutts on 07 April 2016 - 12:45 PM

You must have changed something else, but isn't this a problem too:

  linkedList.data = null;

You're assign null to an unknown data type.  It will probably work for all types, but it's not good programming.


and this

  headNode = linkedList;

headNode is a pointer to a node, while linkedList is a node.  That shouldn't compile. I suppose this would work though:

  headNode = &linkedList;

#5285484 how we do a collision?

Posted by BeerNutts on 06 April 2016 - 02:42 PM

Spatial hashing:

See here and here

#5285481 I need help with having multiple player objects please!

Posted by BeerNutts on 06 April 2016 - 02:23 PM

null; my advise would be to forget source control at this stage.  You're just starting to learn to program, adding in another step for you is just overkill.


These problems are totally normal for someone learning.  You'll soon understand what you did wrong, and why, and you'll be a better programmer because of it.


However, if you truly want help, post a small snippet of your code that shows the 2 player objects getting initialized, and the player object's class definitions.  Someone on here will be able to help you in a second.


Good luck, and have fun!

#5284064 What game is suitable for a beginner to make (with C++)?

Posted by BeerNutts on 29 March 2016 - 09:04 AM

Guys, the OP has already tried working on Snake, but there's a lack of fundamental programming knowledge that needs to be learned.  So, my suggestion was to get a better foundation of programming before trying to make a game.


And, snake does have a little more complexity than other beginner games when the snake is growing, and how to handle moving the body parts.  Pong is a much better suggestion IMO, although the text-based one would probably be best at this point.

#5283384 What's wrong with this snake game code?

Posted by BeerNutts on 25 March 2016 - 08:54 AM

Luna Wu, there's a certain amount of basic programming knowledge required before you can make a game, even snake.  Right now, you're just blindly trying things without understanding what they are doing, and this shows a lack of some fundamental knowledge.


While it's fun to learn programming by writing games, it also means you're going to get frustrated by it.  A better line of attack right now might be doing another C++ tutorial so you can understand the what and the why you should do things a certain way.


Even snake, which seems so simple, has a little bit of complexity with how you move the snake's body parts as it grows which I bet will cause even more frustration down the road.  I would suggest you even step back and make a pong clone 1st, and go from there.

#5282411 Handle input

Posted by BeerNutts on 21 March 2016 - 01:46 PM

Why don't you use sfml instead?  It's perfect for 2d games, and it has abstracted out input, audio, windows, views, network, etc. already for you and you don't have to fool with Windows Messaging garbage.


But, fwiw, your solution is fine for a simple game where you just want to check each frame if a key is being pressed or not.

#5269879 Time button is pressed

Posted by BeerNutts on 07 January 2016 - 12:44 PM

You're going to have to provide more detail.  Are you writing a program?  If so, what language?  Are you using any external libraries to handle input? Details, please.

#5266841 Event Handling within an ECS

Posted by BeerNutts on 17 December 2015 - 05:50 PM

A solution I've done before is t simply have a Collision Component added to entities that are colliding.  This component has which other entity is being collided with, and has a flag noting whether it's an initial collision, a sustain collision, or a just separated collision.  You can then have your collision system operate on entities with collision components, and call the functions required when collisions happen.


Just another way of doing things, not the right way, or the only way, just another possibility.

#5266448 [Help] How to create a game like original gangstaz

Posted by BeerNutts on 15 December 2015 - 07:02 AM

Peke, you better start from the bottom, and not worry about making your Gangstaz type game until you have a better grasp of what making games are all about.  I'd suggest you start with Unity and search for some tutorials to get you started, maybe even with some C# tutorials to start with.  Once you have a better understanding of what it takes to make a game, then you can look towards making specific games.


Good luck and have fun!