2019-02-11 09:02:56

Yeah, everything in math would be global. In that case, you'd either need a function for each vector, or to use some data structure to store multiples, like a dictionary or an array. Multiple functions would probably be easier, since BGT's dictionaries are kinda awful.
I have stored vectors in dictionaries before, using functions to get and set so I don't have to deal with all of that mess. This also made it possible to serialize / deserialize the data for saving / loading. I still wouldn't recommend it in general.

ごめんなさいのときですね?

Thumbs up

2019-02-11 10:06:23 (edited by JLove 2019-02-11 10:24:54)

The problem is a logistical one. If I have one function per vector, ghow do I make sure that they all get called?  Once a function calls another, it is exited, if I remember correctly.  So, it's not like I can just have one function call each of them.  For example:

void UpdateVecs()
{
SetDis();
SetForce();
SetVel();

}
Legistically I'm not sure what the best way to handle it would be.  I might be able to do something where I create Booleans  for each and run checks against them, then update if true.  I.e.:
bool UpdVel = false;
bool UpdAcc = false;

Then before movement is called, set it to true, and in the game loop say:
if(UpdAcc)
SetAcc();

Again, I am tired, so not sure whether that would work or not.  And the thing is, all of those will need to be updated each time before the ball moves.

Thumbs up

2019-02-17 04:53:41

@Cae,
Looking at this code to see if I can understand the collision detection you have, to get an idea of how to do it.  What is all the dictionary stuff for?  Why would I need the dictionary for math stuff?  I doubt I need all of these different forms, right?  All I have is a ball, 2 rackets, the net, and the ground.

Thumbs up

2019-02-17 11:08:17

What dictionary stuff are you referring to? If you mean the dictionaries in fobj and group3d, those are just in case a game wants to add properties without making a subclass. Ex, terrain, friction, elasticity, etc. You don't need them; they're supposedly for convenience.
In 2d, there were some references to a dictionary I used to log when shapes were being destroyed, but I should have removed or commented out all of those.

ごめんなさいのときですね?

Thumbs up