Game Objects

Peit

Newcomer
Joined
Oct 31, 2003
Messages
3
Location
Netherlands
Hello everyone :)
I've made the switch from VB6 to vb.NET recently, and i really like it.
I was not really familiar with classes in vb6, but now im using them i like it.
But, now im making a game, map editor first, and came to the part of objects in game, like buttons, doors, portals ect.
Ive made classes for these, everything with its properties and all.
But these objects need to work together, like when you push the button, the door opens. But the button does not only open doors! I want to make that it can trigger any event from any another object.

How would i make this? And how would i implement this in my map editor? Cause when i want to set up an action upon lets say pressing a button, i want to be able so select one of the objects available in the game (not too hard), but then i want to create a list with its functions available.

How could i program this?
Lets say i have an array with the objects, and i know i want to open a door by pressing a button
How would i store in the button that its function is to open a door?

Brrrrr, im confused :confused: :p

Thanks!
 
Not quite understand.

Everything is object. Let say open a door is a function of a object, so in your button press event, you just declare the object and call it's function
 
Hey, thanks for your reply!

Thats not really the problem no, sorry for not explaining this good, let me try again :)
Indeed everything is an object, and i call the open function of a door to open it.
But, i've got plenty of objects in the map. And every object's event should not hold a predefined action, but its always diffrent.
The button could open a door, but it could also make a stone fall down or let a bomb explode.
So when i put this object in my map (in the editor), i want to be able to select an object it will call a function of, and what function of this object it will call. Like selecting a door, and cause it to close. Or another function of this door, like closing/exploding.

So what i could do is like: selecting an object from my objects list, this all goes fine. But then i need to list its functions, this, of course, depends on the object type. I could check for this, and manually add all its functions to the 'select what function to call' list, but i would rather do this code-generated (because i can always add/delete functions without having to list other functions), can i do this?
And then, when the function is selected, how should i store all of this in the object? (the object that is causing it to happen - the button)
Something like giving it a private variable holding another object's function?!

Hope you understand the question better now :)
 
Theres some good articles about this and how they implemented the SIMs on www.gamedev.net and www.gamasutra.com.

Basically the sims themselves don't really have much code in them, its the objects themselves. Thats why the expansions work, they just add events to each object, so that when you add a new piano, there are actions that can be performed on the object that produces certain results, depending on the skill of the sim.

I'm not sure I'm explaining it very well, but Gamedev.Net Gamedev.net has the general (IE not language specific) articles you're looking for.
 
Thanks for your reply samsmithnz.
However, i dont seem to be albe to find the articles you're referring to on these websites :(
Quite interesting websites though!
 
I just had a look and couldn't find it either. Its bad, cos everytime I go to GameDev.net I get stuck there reading articles for days. Its so interesting. When I started my game I spent the first month just reading articles on the two sites I linked too above, I thought it really helped to warn me of the pitfalls of game development and helped to focus me on what I needed (and not to start anything too big)
 
Back
Top