Search Results

Search found 2 results on 1 pages for 'ratata'.

Page 1/1 | 1 

  • Facing a character towards the mouse

    - by ratata
    I'm trying to port a simple 2d top down shooter game from C++(Allegro) to Java and i'm having problems with rotating my character. Here's the code i used in c++ if (keys[A]) RotateRight(player, degree); if (keys[D]) RotateLeft(player, degree); void RotateLeft(Player& player, float& degree) { degree += player.rotatingSpeed; if ( degree >= 360 ) degree = 0; } void RotateRight(Player& player, float& degree) { degree -= player.rotatingSpeed; if ( degree <= 0) degree = 360; } And this is what i have in render section: al_draw_rotated_bitmap(player.image, player.frameWidth / 2, player.frameHeight / 2, player.x, player.y, degree * 3.14159 / 180, 0); Instead of using A-D keys i want to use mouse this time. I've been searching since last night and came up to few sample codes however noone of them worked. For example this just made my character to circle around the map: int centerX = width / 2; int centerY = height / 2; double angle = Math.atan2(centerY - mouseY, centerX - mouseX) - Math.PI / 2; ((Graphics2D)g).rotate(angle, centerX, centerY); g.fillRect(...); // draw your rectangle Any help is much appreciated.

    Read the article

  • multiple compiling errors with basic C++ application on VS2010 Beta 1

    - by ratata
    I just recently installed VS2010 Beta 1 from the Microsoft website , I started a basic C++ Win32 Console Application , that generated the following code: #include "stdafx.h" int _tmain(int argc, _TCHAR* argv[]) { return 0; } I tried compiling the code just to see how it runs and just then I encountered several(over a 100) compiling errors. Here is the first part of the build output: 1>ClCompile: 1> stdafx.cpp 1>c:\program files\microsoft visual studio 10.0\vc\include\crtdefs.h(520): error C2065: '_In_opt_z_' : undeclared identifier 1>c:\program files\microsoft visual studio 10.0\vc\include\crtdefs.h(520): error C2143: syntax error : missing ')' before 'const' 1>c:\program files\microsoft visual studio 10.0\vc\include\crtdefs.h(520): warning C4229: anachronism used : modifiers on data are ignored 1>c:\program files\microsoft visual studio 10.0\vc\include\crtdefs.h(520): error C2182: '_invalid_parameter' : illegal use of type 'void' 1>c:\program files\microsoft visual studio 10.0\vc\include\crtdefs.h(520): error C2491: '_invalid_parameter' : definition of dllimport data not allowed 1>c:\program files\microsoft visual studio 10.0\vc\include\crtdefs.h(520): error C2059: syntax error : ')' 1>c:\program files\microsoft visual studio 10.0\vc\include\crtdefs.h(527): error C2065: '_In_opt_z_' : undeclared identifier 1>c:\program files\microsoft visual studio 10.0\vc\include\crtdefs.h(527): error C2143: syntax error : missing ')' before 'const' 1>c:\program files\microsoft visual studio 10.0\vc\include\crtdefs.h(527): warning C4229: anachronism used : modifiers on data are ignored pastebin for the full list I thought maybe the include files got mixed up by some other compiler version I have installed previously( I have VS 2008 as well) so I reinstalled VS2010 just to overwrite the headers but that didn't do much. Thanks in advance for any help you might offer as I am helpless

    Read the article

1