Hello fellow programmers, I am currently studying at university and for my coursework I was asked to create an Alien, and then later on, a simple game which would include my previously drawn creature in some way.
I have made a very simple shooting game which I thought could work. White balls are falling from the top of the screen and at the bottom there is a ship which shoots these down. Now, I have made this prototype without my Alien, and now I am struggling to import it into the game. I wanted to use my Alien instead of the white balls but this proved difficult so I decided to make the green "triangle ship" at the bottom to be my alien. I also need some kind of scoring system and possibly lives. I have spent many hours today trying to figure this out but no luck so I'm begging for your help. This coursework is due in 2 days time and it would be perfect if my Alien was in the game. The Alien uses a class, this is the code for the main body and all the methods, please ignore the movement and the bouncing part of the program as it is not needed for the game.
myAlien.draw_Face(); //draws alien myAlien.draw_left_ear(); //draws left ear myAlien.draw_right_ear();//draws right ear myAlien.draw_body();//draws the body myAlien.draw_eye();//draws the eye myAlien.draw_eye_ball();//draws the eyeball myAlien.draw_mouth();//draws the mouth myAlien.draw_nose();//draws the nose myAlien.movement_of_alien();//calculates movement myAlien.alien_bounce();//bouncing
Methods etc:
class Alien {
//Variables int bodyXLocation; int bodyYLocation; int bodyWidth; int bodyHeight; int eyeWidth; int eyeHeight; int eyeXLocation; int eyeYLocation; int eyeballWidth; int eyeballHeight; int eyeballXlocation; int eyeballYlocation; int earleftWidth; int earleftHeight; int earleftXlocation; int earleftYlocation; int earrightWidth; int earrightHeight; int earrightXlocation; int earrightYlocation; int mouthXlocation; int mouthYlocation; int mouthHeight; int mouthWidth; int noseXlocation; int noseYlocation; int noseHeight; int noseWidth; int speedXLocation; int speedYLocation;
Alien(int tempX, int tempY, int tempWidth, int tempHeight, int tempXSpeed, int tempYSpeed) { bodyXLocation = tempX; bodyYLocation = tempY; bodyWidth = tempWidth; bodyHeight = tempHeight; speedXLocation = tempXSpeed; speedYLocation = tempYSpeed; //Changeable Parameters } //This method draws the alien void draw_Face() { this.draw_left_ear(); this.draw_right_ear(); this.draw_body(); this.draw_eye(); this.draw_eye_ball(); this.draw_mouth(); this.draw_nose(); this.alien_bounce(); }