r/visualbasic • u/NovaPTV • Feb 09 '21
Need help with OOB
Hi guys,
I'm working on a game in visual basic and I've got down most of the basics I just need help with the 'npc' class. Right now what I have is one picture box that moves around the form and uses a collision detection algorithm 'score points'. I'm trying to get it so that it isn't just one picture box but many of them are spawned gradually. I'm not the best at object-oriented programming so I'm not sure how to go about this because right now all I have is that one picture box.
Thanks
1
u/PostalElf VB.Net Intermediate Feb 09 '21
You're going to have to start getting used to creating controls - like pictureboxes - using code instead of the designer. Something like this. If you want the new controls to also use the collision detection algro, you'll want to make the control an object that inherits from the base picturebox class.
3
u/revennest Feb 10 '21
My advice here is for get you enjoy to create some small game for yourself, most important about create game is complete it, you can get other thing along the way but if you try to make a finest from start, you going to be burn out very quickly; so it doesn't matter how cranky you game just make sure you complete it, no matter how good you game, if it's not complete is just a demo, a trailer and it will burn you up that make you don't think to make a game again.
OOP is about reuse, access control and maintain code; not performance so you need to remember this, OOP make you code easier with some price to pay so beware of it price on bottle neck of your code.
Try WPF instead Windows Form, you have more freedom and can go farer on this.
Did you ever used simple game maker engine like RPG Maker, those should help you get how to do with design view.