Search results

  1. M

    GP2X Checking Whether A Sprite Is On-screen Before Drawing It

    CODE bool onScreen( sprite* s) { if ( s->x < camera.x - s->w ) return false; if ( s->x > camera.x + camera.w ) return false; if ( s->y < camera.y - s->h ) return false; if ( s->y > camera.y + camera.h ) return false; return true; } if ( onScreen( enemy[i] ) )...
  2. M

    What's Wrong With My Enemy Homing Code?

    The following code should make the enemy home in on the player: CODE void Seeker::move(int index) { //Find the angle required to move towards the player int distx = playerx-x; int disty = playery-y; int angle = atan2( disty, distx) * 57.29578; //Set the velocities dx =...
  3. M

    GP2X .mod File Being Loaded In Windows But Not On Gp2x

    My game's music (a .MOD file) plays back when I run my game in Windows but not on the GP2X. I added some code to test whether the file was being loaded: CODE Mix_Music *gamemusic = NULL; gamemusic = Mix_LoadMUS( "snd/game.mod" ); if ( !gamemusic ) { quit=true; loop=false...
  4. M

    Open2x Makefile

    I have never set up a dev environment in Linux before. In Dev-C++ under Windows it's all done for you. I'm trying to modify a Dev-C++ makefile to get my game to compile and run under Linux. Here's what I've done so far: CODE # Project: GridWars2x # Makefile created by Dev-C++ 4.9.9.2 CPP =...
  5. M

    Getting Mikmod Working

    I have #include-ed mikmod.h in my app and added the following lines to my code: CODE MikMod_RegisterAllDrivers(); MikMod_RegisterLoader(&load_mod); md_mode |= DMODE_SOFT_MUSIC; MikMod_Init(""); module = Player_Load("snd/stardust.mod", 32, 0 ); if (module) {...
  6. M

    Converting From Char To Int

    I have a sprite called "font" which contains 10 items: the numbers 0-9. If I want to draw a number on the screen I use fontClips[n], where n is the number I want from 0-9. Before anybody asks why I don't just render the text using a TTF font, the font I am using is commercial so I can't include...
  7. M

    GP2X Sprite Shows Up In Windows, But Not On Gp2x?!

    I'm having problems with one of my enemy classes. When I run my game in Windows the enemy shows up. When I run it on the GP2X the enemy doesn't show. The game responds to collisions with the enemy even though the enemy is not visible. As a test, I added a line of code to blit the enemy's sprite...
  8. M

    Semi-transparency

    I want the screen to flash white and then gradually fade back to the game. I have Googled it and the answer seems to be SDL_SetAlpha(surface, SDL_SRCALPHA, transparency) but when I try this I get "expected constructor, destructor, or type conversion before '(' token " and "expected `,' or `;'...
  9. M

    Gridwars2x

    I am writing a clone of GridWars/Geometry Wars for the GP2X. I will keep this thread up to date with my progress. DONE: - Player controls - Scrolling - Shooting - Collision detection - Diamond enemies - Pinwheel enemies - Square enemies - Seeker enemies - Butterfly enemies - Bombs - Lives -...
  10. M

    GP2X Gp2x Keys

    Another question :rolleyes: Here is a fragment of my player's input handler: CODE else if( event.type == SDL_JOYBUTTONDOWN ) { switch( event.jbutton.button ) { case VK_FY: bullets.resize(bullets.size()+1)...
  11. M

    Making An Enemy Avoid Being Shot

    I need to code some AI for one of my enemies so that it moves towards the player but moves to avoid bullets. Here's what I'm thinking: 1. Iterate through vector "bullets" to find closest bullet 2. Use the velocities and co-ordinates to predict a collision 3. No collision predicted -> Move...
  12. M

    Sprite Movement Angle Or Move To Specific Pixel

    Is it possible to specify an angle in degrees and a velocity for a sprite rather than X and Y velocities? Alternatively is it possible to make it move in a straight line towards a specified pixel?
  13. M

    Getting And Setting The Size Of An Array Of Objects

    I have created an Enemy class. I want lots of enemies on screen, so I have created an array of enemies: CODE Enemy myEnemy[5]; In my main loop I have lines like the following to make all of the enemies do their processing: CODE for ( int i = 0; i <= 4; i++ ) if ( myEnemy[i].alive == true )...
  14. M

    Per Pixel Collision

    I've just been reading the Lazy Foo Per Pixel Collision tutorial. There is a section in the sprite constructor headed "Initialize the collision boxes' width and height". I'm wondering how you would do this if your sprite has multiple frames of animation? The problem would be that when the frame...
  15. M

    [sdl] Sprite Locations When Using A Camera

    I'm writing my first ever game for the GP2X using the official SDK. I used the Lazy Foo scrolling tutorial to get my sprite moving around a scrolling background. I'm now trying to add an enemy to the game, but when I specify the x and y co-ordinates for the sprite, these co-ordinates are...
  16. M

    GP2X Open2x Sdl Download?

    When I try to download Open2x SDL development libs from the CSV I get the following: QUOTE $ cvs -d :pserver:anonymous@cvs.sourceforge.net:/cvsroot/open2x login Logging in to :pserver:anonymous@cvs.sourceforge.net:2401/cvsroot/open2x CVS password: cvs [login aborted]: connect to...
  17. M

    GP2X Sdk Documentation?

    Sorry if this is a stupid question! I downloaded the GP2X SDK but it doesn't seem to come with any documentation. Is there any I can download? Or is there a quick tutorial on creating a basic game just to get me started?
  18. M

    Anyone Who Pre-ordered Wind And Water Seen Your Sprite Yet?

    Just pre-ordered W&W and waiting for the email to ask me to send my photo for the custom sprite. Just wondering if anyone else who pre-ordered has seen theirs yet? What do you think of it?
  19. M

    Stuck On A Mission In Payback

    In city 4 on the mission where you have to kidnap the guy from his house, what do you do once he is on the helipad? I've got him on the pad but nothing happens. Pushing him into the chopper doesn't seem to do anything.
  20. M

    Unreadable Cd-r Supplied With Gp2x

    As well as the "User Guide" CD which contains a load of software, I got a white CD-R with my GP2x. The disc is unreadable. Am I missing out on something? Is it worth getting a replacement?
Back
Top