16
SFML projects / BGB: Bull's Game Builder
« on: October 15, 2008, 09:36:48 pm »
ooh squirell .. i would love to look at your implementation of it
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
#include "Affectorfactory.h"
#include "Random.h"
#include "ConfigData.h"
#include "Variant.h"
Where are these?
They wasn't included in your package!
#include "Affectorfactory.h"
#include "Random.h"
#include "ConfigData.h"
#include "Variant.h"
Where are these?
They wasn't included in your package!
y += force - offset;
//change it to a static const to keep c++ typesafety
static const float MAX_FORCE = 205.f;
...
//gravity should realy be a constant :)
const float gravity = 31.4f;
...
//and here we make sure it is kept time based
y += (force - offset) * frameRate;
Didn't work. the variable force has already been multiplied with the frame time when we get to that line of code.Code: [Select]if(!standing)
force += gravity * frameRate;
y += force - offset;
could i have any problems with that coz laurent said to inherit sf::Drawable ?
well to have a little solution i added a functionCode: [Select]
Shape get()
{
return Shape;
}
App.Draw(bat.get());
it works but i doubt its best solution
class Bat
{
public:
void Draw(const sf::RenderWindow &rw) const
{
rw.Draw(shape);
}
private:
sf::Shape shape;
};
class Bat : public sf::Shape
{
public:
void MySpecialFunc();
};
and how can i get the direction from where my ball came? only collision is not enough, i need to know where the ball hit ,
my bat can be moved up down left and right, so i need to know in what direction the ball should bounce
and how do i do it when i want to manage many bricks that disappear when hit?
something like a bool exists?
Quote from: "heishe"plus if you use sdl + opengl you don't automatically get this nice oop layout that sfml has.
How do you handle events with SDL and without a loop ?
Hi, in the process of making a game and it became very clear to me that i need to use a heavy amount of layers.
Is there a function for doing this (like moving the objects in 3d space) or do i need to write my own functions like Layer1() Layer2() which them contains app draw and that?
And i wondered if there was an easy way of loading VERY EASY models into SFML (in 3D) or opengl from Blender?
well now that works, but now i have another prblem:
in out there is the current score, when a new game is started
the timer is at 0.00, when the game befor had lets say 111.11 s, then
in the new game 0.0011 is shown because i only use out.seekp(0) to get new data in it how can i clear a ostringstream ?
int main()
{
float myval = 0.5f;
std::string myval_str;
{
std::stringstream ss;
ss << myval;
myval_str = ss.str();
}
}
2 mins of googling and i found what i was looking for^^
( i´m glad i remember anything since the days i learnd c++ =)
out << seekp(0);
was all i needed to add
sry for spamming
template<class T>
std::string ToString(T val)
{
std::stringstream ss;
ss << val;
return ss.str();
}