Reputation
1,035
Top tag
Next privilege 2,000 Rep.
Edit questions and answers
Badges
2 9
Newest
 Custodian
Impact
~27k people reached

  • 0 posts edited
  • 4 helpful flags
  • 50 votes cast
Jul
4
comment How Many Particles at a Time?
The answer is 2876 particles.
Jun
25
answered how to handle interactive choice in the middle of the game loop?
Jun
7
comment Working but flawed bullet spread (vector math)
Glad to help an enthusiastic coder !! Let me know if my pseudo-code leads you to a bullet spawn that fits your needs. Right now i'm out of time, but i might edit later to improve a bit all that.
Jun
7
revised Working but flawed bullet spread (vector math)
added 21 characters in body
Jun
7
comment Working but flawed bullet spread (vector math)
No copy !! just look at what you write here : you are writing a = b, so it would be a MAJOR language flaw if a = b was understood as a = copy (b), since for instance you would have (a != b) right after writing a = b; !!!! And forget about ’->’ if i may. (or look here stackoverflow.com/questions/13476430/… )
Jun
7
comment Working but flawed bullet spread (vector math)
Ok, you made the very common mistake (no shame here) about what is an object '==' a pointer. I use to think of it as an arrow : when you write ‘bullet = activeFirearm.bullet[i]‘, you are now having ‘bullet‘ as an arrow designating the very object that is stored at the i-th position in the activeFirearm.bullet array. Any change to ‘bullet‘ is right the same as a change to this i-th object. (Maybe you could think of it about 'synonym', if you prefer.)
Jun
7
comment Working but flawed bullet spread (vector math)
I'm not sure i understand your last question. Are you thinking of the case where the player switches weapon ??
Jun
7
comment Working but flawed bullet spread (vector math)
Yes, only when you are using a lot (>16 or 32, depending on CPU) of variables at the same time (for instance : in the same loop) then the compiler will have to swap registers. Ever did that ? I never did, even in quite complex algorithm. Concretely, you can forget about sparing your vars, and always factorize your code. The extra bonus being, like in this code above, that we always know what we are dealing with. For instance the 'var bullet = ...' line makes obvious we're iterating the bullet array to process each bullet.
Jun
7
comment Working but flawed bullet spread (vector math)
This code is not creating any object : it uses variables to hold reference to the various object. So yes, there are more variables, but just to take the bullet example, factorising it in the code above trades 1 local var for ... 6 indirection and 6 array access if you keep using activeFirearm.bullet[i]. No doubt it will be faster. And remember, after compilation, a local var will most likely create ZERO overhead -they are just using a CPU register-.
Jun
7
revised Working but flawed bullet spread (vector math)
added 3 characters in body
Jun
7
revised Working but flawed bullet spread (vector math)
added 3 characters in body
Jun
7
answered Working but flawed bullet spread (vector math)
Jun
3
comment How can I calculate “All squares within R” in a natural looking manner?
do you wish to do anti-aliasing ( == playing on the color to suggest the right shape) ? It could work only with small enough squares.
Mar
13
comment Collision between AABB and Circle
You're welcome. I updated with drawings. Notice that it works better if your AABB boxes are squarish
Mar
13
revised Collision between AABB and Circle
added 254 characters in body
Mar
13
answered Collision between AABB and Circle
Feb
8
comment How to handle transparent pixels in a spritesheet
What about auto-detecting the 'baseline' of each sprite ?
Jan
30
comment What's the fastest way checking if two moving AABBs intersect?
Thanks for the update (and hurra for the schemes :-)), this was not my question but helped me understand that your algorithm already handles the case when A completely passes through B.
Jan
30
comment What's the fastest way checking if two moving AABBs intersect?
Thanks, most interesting. Could you please explain how do you handle the case when A and B intersect during the move, but end the move without intersection ?
Jan
16
comment Rotate arrow on canvas
You're welcome. For the circle border, it's the common mistake : you forgot to beginPath() before drawing (stroke()) the line. (jsfiddle.net/gamealchemist/jxrdtLxx/4). Yo !