Tag Info

New answers tagged


If I understand it correctly, then you want the monster to move only in horizontal or vertical direction. Which means that for every frame, you need to select the direction to move in. One way to select could be based on which distance is more. Once you choose that, then you know the direction to move (horiz: (1,0) or vert:(0,1)), so just multiply that with ...


My English is poor, but here's some pseudocode: // angle (in radians) between monster and player float angle = atan2(player.y - monster.y, player.x - monster.x); // monster.speed is the amount of pixels to move // If this doesn't work, invert cos for x and sin for y monster.x += sin(angle) * monster.speed; monster.y += cos(angle) * monster.speed;


A spinning animation can be done in several ways. An easy way is to create 2D sprites at the bottom of the machine and move them upwards until they hit the top then you move the sprite of the machine over the sprite of the symbol. If the symbol's bottom hit the bottom of that part of the machine then you make it disappear. An alternative if you want 3D is to ...


From your question I think you want a way to efficiently access a block's neighbours vertically. I'm not sure why you decided you want a std::vector instead of a grid made of a 8x8 array (you know you can iterate through every block in an array too), but I think the array is the better choice. If you really want to use a std::vector, then you may want to ...

Top 50 recent answers are included