xDancinpoptartx

Member
  • Content count

    23
  • Joined

  • Last visited

Community Reputation

131 Neutral

About xDancinpoptartx

  • Rank
    Member
  1. BallShooter Demo

    You should definitely turn BallShooter into an app for the phone! Maybe add a timer to where you get one ball and it freezes and you have a set time to catch the rest of them and if the time runs out, the balls rest and you have to try again.
  2. Hello World!

    Will it be a set adventure? Or will it be randomly generated so the experience is different each time?
  3. [JAVA]First Game help[JAVA]

    So for this game I want to make the ball to change direction when it hits the bottom of the screen. So i have    public void ballmove() { y += 1; }   that moves it no problem but how would i make it go the opposite direction when it hits the top of the screen or bottom.
  4. I need help makeing the ball hit the bottom and bouncing back up. I tried this but it just hits and stays in one spot which i know why but what else would i do? public void ballmove() { y += 1; if (y == 420) { y -= 1; } }    
  5. My fault I forgot to clear the screen problem solved thanks for all the help!
  6. It still [quote name='ptrrf' timestamp='1354812132' post='5007799'] 1) You don't need to call SDL_ShowCursor on every cycle. Call this function before the main loop. 2) Personally, I think is better to check SDL_PollEvent on a "while" like this: [source lang="cpp"]while(SDL_PollEvent(&event)) { // Handle events here }[/source] 3) Put the function apply_surface() after manage the events. You must separate the event manager code and the draw code. (Just put that apply_surface() before the SDL_Flip(), on the place where SDL_ShowCursor() is actually.) [/quote] It still draws the sprite every time even after I moved the apply_surface() and changed it to while(SDL_PollEvent(&event)).
  7. I made my sprite move with the mouse but everytime I move it redraws to the screen what can I do to fix this? [source lang="cpp"]#include "SDL/SDL.h" #include <stdbool.h> int x; int y; void apply_surface(int x, int y, SDL_Surface* source, SDL_Surface* destination ) { SDL_Rect offset; offset.x = x; offset.y = y; SDL_BlitSurface(source, NULL, destination, &offset); } int main(int argc, char* args[]) { //images/ints SDL_Event event; SDL_Surface* sprite = NULL; SDL_Surface* back = NULL; SDL_Surface* screen = NULL; back = SDL_LoadBMP("back.bmp"); sprite = SDL_LoadBMP("char.bmp"); bool done = true; //init SDL_Init(SDL_INIT_EVERYTHING); screen = SDL_SetVideoMode(560, 560, 32, SDL_SWSURFACE); SDL_WM_SetCaption("Game", NULL); apply_surface(0, 0, back, screen); SDL_SetColorKey(sprite, SDL_SRCCOLORKEY, SDL_MapRGB(sprite->format, 255, 0, 255)); while (done) { if (SDL_PollEvent(&event)) { if (event.type == SDL_QUIT) { done = false; } if(event.type == SDL_MOUSEMOTION) { x = event.motion.x; y = event.motion.y; apply_surface(x, y, sprite, screen); } } SDL_ShowCursor(SDL_DISABLE); SDL_Flip(screen); } SDL_FreeSurface(sprite); SDL_FreeSurface(back); return 0; }[/source]
  8. [SDL] Help with keyboard input and sprite movement

    Nvm i figured it out. Thanks for all the help!
  9. [SDL] Help with keyboard input and sprite movement

    So where do I put the apply_surface because i put it after the poll event like this [source lang="cpp"]while (!done) { if (SDL_PollEvent(&event)) { if (event.type == SDL_QUIT) { done = true; } Uint8* keystate = SDL_GetKeyState(NULL); if(keystate[SDLK_DOWN]) { y = y+1; } } apply_surface(x, y, sprite, screen); }[/source]
  10. I was using SDL but i decided to switch to SFML so I did but i get an error of cannot fin -lSDLmain which is weird because i made a new project and changed all the settings to SFML. Im stuck can someone please help.
  11. I'm new to SDL and I was wondering why this keyboard movement wasn't working. [source lang="cpp"]#include "SDL/SDL.h" #include <stdbool.h> //SURFACES/variables SDL_Surface *background = NULL; SDL_Surface *buffer = NULL; SDL_Surface *sprite = NULL; int y = 250; int x = 250; //apply void apply_surface(int x, int y, SDL_Surface* source, SDL_Surface* destination) { SDL_Rect offset; offset.x = x; offset.y = y; SDL_BlitSurface(source, NULL, destination, &offset); } //start int main( int argc, char* args[] ) { //init SDL_Init( SDL_INIT_EVERYTHING ); background = SDL_LoadBMP("bg.bmp"); sprite = SDL_LoadBMP("char.bmp"); SDL_SetColorKey(sprite, SDL_SRCCOLORKEY, SDL_MapRGB(sprite->format, 230, 0, 230)); SDL_Event event; bool fullscreen = false; bool done = false; //loops if (fullscreen == false ) { buffer = SDL_SetVideoMode(500, 500, 32, SDL_SWSURFACE); } //APPNAME SDL_WM_SetCaption("Game", NULL); //apply surface/flips apply_surface(0, 0, background, buffer); apply_surface(x, y, sprite, buffer); SDL_Flip(buffer); //quit while(!done) { while(SDL_PollEvent (&event)) { switch (event.type) { case SDL_QUIT: { done = true; break; } case SDL_KEYDOWN: { if(event.key.keysym.sym == SDLK_DOWN) { y = y+1; } } } } } //END SDL_FreeSurface(background); SDL_FreeSurface(sprite); SDL_Quit(); return 0; } [/source]
  12. Java game programing help.

    I am not trying to have a animation play i just want the image facing the direction you are moving, and thank you for the link it actually helped me solve another problem i was having.
  13. I need a 8-bit condom. I am making a funny game and i need a condom in 8bit to be made for me. Any one want to help?
  14. Ok, i got movement and a sprite. how do i move it right and it shows the right image and when i move it left it shows the image facing left and down and up?
  15. Need java Timer code help.

    Why wont my Timer work? [CODE] import javax.swing.JPanel; import java.awt.Image; import javax.swing.ImageIcon; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Timer; public class Board extends JPanel implements ActionListener { Image BR; Charecter Char; Timer time; int DELAY = 5; public Board(){ Char = new Charecter(); ImageIcon ii = new ImageIcon(this.getClass().getResource("/Resources/BackRoads.jpg")); BR = ii.getImage(); time = new Timer(5, this); time.start(); } class TimerListener implements ActionListener{ public void actionPerformed(ActionEvent e) { repaint(); } } public void paint(Graphics g){ super.paint(g); Graphics2D g2d = (Graphics2D)g; g2d.drawImage(BR, 0, 0, null); } @Override public void actionPerformed(ActionEvent e) { // TODO Auto-generated method stub } } [/CODE]