anyone wanna make an UGH! remake?
Moderator: Coders of Rage
- PixelP
- Chaos Rift Regular
- Posts: 153
- Joined: Tue Oct 07, 2008 12:23 pm
- Programming Language of Choice: c/c++
- Location: sweden
- Contact:
Re: anyone wanna make an UGH! remake?
integers: x, y, w, h, xvel, yvel
booleans: flying, got_passeneger
??
I downloaded this game for like an hour ago... I haven't played so much
booleans: flying, got_passeneger
??
I downloaded this game for like an hour ago... I haven't played so much
Re: anyone wanna make an UGH! remake?
good. those are all good values. no make a class with some functions to make a player, to change variables and so on. and post the class.
next we will tackle making a physics class what will update motion and detect collision.
next we will tackle making a physics class what will update motion and detect collision.
Some person, "I have a black belt in karate"
Dad, "Yea well I have a fan belt in street fighting"
Dad, "Yea well I have a fan belt in street fighting"
- PixelP
- Chaos Rift Regular
- Posts: 153
- Joined: Tue Oct 07, 2008 12:23 pm
- Programming Language of Choice: c/c++
- Location: sweden
- Contact:
Re: anyone wanna make an UGH! remake?
What width and height will the player have, what fps are we using and what's the width and height for our game window?
Re: anyone wanna make an UGH! remake?
PixelP wrote:What width and height will the player have and what fps are we using?
you can make the width and heigth whatever you want. dont worry about FPS now. we will regulate that later.
let plan on making the level 500 X 500 pixels and the player it 20X20
Some person, "I have a black belt in karate"
Dad, "Yea well I have a fan belt in street fighting"
Dad, "Yea well I have a fan belt in street fighting"
- PixelP
- Chaos Rift Regular
- Posts: 153
- Joined: Tue Oct 07, 2008 12:23 pm
- Programming Language of Choice: c/c++
- Location: sweden
- Contact:
Re: anyone wanna make an UGH! remake?
Okey, I used 60 as fps for now...
Timer class... I'm working on the player class.
Code: Select all
//timer.h
#pragma once
class TimerClass {
private:
int start;
public:
void Begin();
int Get();
};
void TimerClass::Begin() {
start = SDL_GetTicks();
}
int TimerClass::Get() {
return SDL_GetTicks() - start;
}
Re: anyone wanna make an UGH! remake?
dont worry about a times class right now. that can come later.
work on the player class. then we will make a physics class that takes a level class and player class and makes sure the player does not gow through objects.
work on the player class. then we will make a physics class that takes a level class and player class and makes sure the player does not gow through objects.
Some person, "I have a black belt in karate"
Dad, "Yea well I have a fan belt in street fighting"
Dad, "Yea well I have a fan belt in street fighting"
- PixelP
- Chaos Rift Regular
- Posts: 153
- Joined: Tue Oct 07, 2008 12:23 pm
- Programming Language of Choice: c/c++
- Location: sweden
- Contact:
Re: anyone wanna make an UGH! remake?
Code: Select all
//player.h
#pragma once
#include "functions.h"
void draw_image(SDL_Surface* image, SDL_Surface* buffer, int x, int y, SDL_Rect* clip) {
SDL_Rect offset = {x, y};
SDL_BlitSurface(image, clip, buffer, &offset);
}
class PlayerClass {
public:
SDL_Rect pla;
int xvel, yvel;
int fall_speed;
int speed;
PlayerClass();
void get_input();
void move();
void draw();
};
PlayerClass::PlayerClass() {
pla.x = 0;
pla.y = 0;
pla.w = 20;
pla.h = 20;
xvel = yvel = 0;
fall_speed = 5;
speed = 10;
}
void PlayerClass::get_input() {
if(key[SDLK_UP]) {
yvel -= speed;
} if(key[SDLK_RIGHT]) {
xvel += speed;
} if(key[SDLK_DOWN]) {
yvel += speed;
} if(key[SDLK_LEFT]) {
xvel -= speed;
}
if(!key[SDLK_UP]) {
yvel += speed;
} if(!key[SDLK_RIGHT]) {
xvel -= speed;
} if(!key[SDLK_DOWN]) {
yvel -= speed;
} if(!key[SDLK_LEFT]) {
xvel += speed;
}
}
void PlayerClass::move() {
pla.x = xvel;
pla.y = yvel;
}
void PlayerClass::draw() {
draw_image(player_img, buffer, pla.x, pla.y, NULL);
}
Re: anyone wanna make an UGH! remake?
hange the input thing, becaus the way you have it requiers key to be global. we will do it differently.
also, dont use fall speed, use weight, and the physics class will do the calculations for us.
make those changes and start working on a physics class.
you just want a funtion that return bool if a player position is in a object position
also, dont use fall speed, use weight, and the physics class will do the calculations for us.
make those changes and start working on a physics class.
you just want a funtion that return bool if a player position is in a object position
Some person, "I have a black belt in karate"
Dad, "Yea well I have a fan belt in street fighting"
Dad, "Yea well I have a fan belt in street fighting"
- PixelP
- Chaos Rift Regular
- Posts: 153
- Joined: Tue Oct 07, 2008 12:23 pm
- Programming Language of Choice: c/c++
- Location: sweden
- Contact:
Re: anyone wanna make an UGH! remake?
Should I completly delete the input function?
Re: anyone wanna make an UGH! remake?
PixelP wrote:Should I completly delete the input function?
yes. we will handel that seperatly
Some person, "I have a black belt in karate"
Dad, "Yea well I have a fan belt in street fighting"
Dad, "Yea well I have a fan belt in street fighting"
- PixelP
- Chaos Rift Regular
- Posts: 153
- Joined: Tue Oct 07, 2008 12:23 pm
- Programming Language of Choice: c/c++
- Location: sweden
- Contact:
Re: anyone wanna make an UGH! remake?
Code: Select all
//physic.h
#pragma once
class PhysicClass {
public:
bool collision(PlayerClass* pla, ObjectClass* obj);
};
bool collision(PlayerClass* pla, ObjectClass* obj) {
if(pla->w > obj->x && pla->h > obj->y && pla->x < obj->w && pla->y < obj->h) {
return true;
}
return false;
}
Code: Select all
void PlayerClass::move() {
x = xvel;
yvel+=weight;
y = yvel;
}
Re: anyone wanna make an UGH! remake?
no, dont put any calculations in the player class. just functions that can chage values and what not. the physics stuff we will put into physics class.
Some person, "I have a black belt in karate"
Dad, "Yea well I have a fan belt in street fighting"
Dad, "Yea well I have a fan belt in street fighting"
Re: anyone wanna make an UGH! remake?
PixelP wrote:Okey.
have you made a physics class yet?
there will be
update_player
collision //check to see if there are any collisions between the player and any of the objects
Some person, "I have a black belt in karate"
Dad, "Yea well I have a fan belt in street fighting"
Dad, "Yea well I have a fan belt in street fighting"
- PixelP
- Chaos Rift Regular
- Posts: 153
- Joined: Tue Oct 07, 2008 12:23 pm
- Programming Language of Choice: c/c++
- Location: sweden
- Contact:
Re: anyone wanna make an UGH! remake?
Code: Select all
//physic.h
#pragma once
class PhysicClass {
public:
bool collision(PlayerClass* pla, ObjectClass* obj);
};
bool collision(PlayerClass* pla, ObjectClass* obj) {
if(pla->w > obj->x && pla->h > obj->y && pla->x < obj->w && pla->y < obj->h) {
return true;
}
return false;
}