Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

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.


Messages - Girby2K11

Pages: [1] 2
1
General / How to add scoring?
« on: June 06, 2011, 08:01:41 pm »
Thanks. Going to test now.

2
General / How to add scoring?
« on: June 06, 2011, 05:29:48 pm »
Hi, i am wondering how to add a scoring thing e.g. when i tap space, it adds 1 to the score.

I was using this method. Text.SetText(score);
but that seems to have failed. I am quite confused.

3
General / Decent photo editor program?
« on: June 05, 2011, 03:13:56 pm »
Quote from: "Lupinius"
An image is always a square. To do collission detection you could check the color of different parts of your maze and if it's white/transparent you would have no collision.


Ah, thanks. Could i do this by using sf::Color?

4
General / Decent photo editor program?
« on: June 04, 2011, 05:09:11 pm »
Quote from: "chrusty"
Not 100% sure what you specifically meant with bounding box. Fireworks have a feature where you can export certain tiles as slices into separate images with specific output format; also note the editor is more suited for web development, but you can do small game graphics as well. Its also lot easier to prototype game scene with many small tiles and throw in some advanced features with effects, lightning, blending, ... etc.


Im talking about on gimp when you create e.g. A maze, there is a border around it, therefore when writing collision on the picture the whole picture is one object.

I wan't something were i can make the border around the maze.

5
General / Decent photo editor program?
« on: June 03, 2011, 09:12:27 pm »
So with adobe fireworks i can model my own maze without the border that is a rectangle?

6
General / Decent photo editor program?
« on: June 02, 2011, 08:48:26 pm »
I was trying to make a maze game where you collect points by entering secret places, but i realised on the photo editing programs there is a bounding box, so when i load the image and run the game the bounding box kills it. I coukd make a maze by loading atleast 50 images/sprites, which is long. What do you use? I am currently using gimp.

7
General / How to use "Simple Collision Detection?"
« on: May 09, 2011, 05:23:09 pm »
I no nothing about vector math, but I will check it out.

8
General / I need help with this game i am trying to make.
« on: May 09, 2011, 12:06:57 am »
Quote from: "Father_Sloth"
Can I ask how you would do collision with the bat if it is drawn from the centre?

Also whenever I use your method for bouncing the ball off the bat it always goes towards the bottom left corner, what am I doing wrong?

 - Simon


I am not too good with collision detection, ask Dimple, he gave me a really good and quick tutorial for collision detection.

9
General / How to use "Simple Collision Detection?"
« on: May 07, 2011, 04:01:45 pm »
Quote from: "Dimple"
That moves it only in one direction because you are telling it to move only to one direction. :) What you want to do is to figure out which side of the rectangle is actually hit and move the object accordingly. For example, if the object is coming straight down when it hits the object, you want to move the object up to keep it above the rectangle. You should be able to figure it out by comparing the coordinates, a bit like the collision detection is done. For example to find out if the object is coming from the top, you could do something like this
Code: [Select]

if(object.x() + object.size().x > object2.x() && object.x() < object2.x() + object2.size().x && object.y() > object2.y())


Btw. sprite.move(x, y) moves the sprite horizontally the amount of x and vertically the amount of y.


How can i make the object collide and not move any closer and gravity? Can i make a test lets say... the screen edges is the collision detection and i make balls keep bouncing and hitting the walls?

10
General / How to use "Simple Collision Detection?"
« on: May 02, 2011, 08:14:29 pm »
How would that bit of code move the sprite? Also I want to make a gravity test like the ball is in a cage but the ball keeps bouncing and hitting the side of the screen what would that look like? The code?

11
General / How to use "Simple Collision Detection?"
« on: May 02, 2011, 06:40:33 pm »
Hope you had a great weekend  :D So with this collision detection how would I actually be able to make the sprite not move any further once it has hit the rectangle? I have tried
Code: [Select]
sprite1.move(speed * ElapsedTime, 0); but it only goes left(I think) but I want the whole box to be protected.

12
General / How to use "Simple Collision Detection?"
« on: April 30, 2011, 01:50:13 pm »
Quote from: "Dimple"
Here's one that I wrote in maybe two minutes. I'll try to explain it to you later (gotta go right now) but the idea is exactly the same that I tried to explain to you in the other thread.

Add this before your main-function
Code: [Select]

static bool checkCollision(sf::Sprite sprite1, sf::Sprite sprite2) {

    if(sprite1.GetPosition().x  + sprite1.GetSize().x > sprite2.GetPosition().x && sprite1.GetPosition().x < sprite2.GetPosition().x + sprite2.GetSize().x && sprite1.GetPosition().y + sprite1.GetSize().y > sprite2.GetPosition().y && sprite1.GetPosition().y < sprite2.GetPosition().y + sprite2.GetSize().y)
        return true;

    return false;
}

It's used like this
Code: [Select]
if(checkCollision(Object1, Object2))
             std::cout << "Collision!";


OK thanks, you are really helping me out i appreciate this.

13
General / How to use "Simple Collision Detection?"
« on: April 30, 2011, 01:36:05 pm »
Quote from: "Dimple"
You can't manually set the size of the bounding box without modifying the BoundingBoxTest-function (unless there's something you can do with the sprites themselves that I'm not aware of). What are the dimensions of your images?

Do you need to rotate the sprites btw? If not then writing your own detection function is really easy.


I think i would prefer to make my own collision, is it possible if you could't write a collision detection and ill input it on my code and see if it works?

14
General / How to use "Simple Collision Detection?"
« on: April 30, 2011, 01:07:59 pm »
Quote from: "Dimple"
It doesn't matter whether if the objects are on the screen or not, the detection works exactly the same. I wanted you to put them far from each other so that you could see if the program closes no matter where the objects are (ie. the collision detection function doesn't work).


Ok i have just moved the characters to the end of the screen and the program doesn't shut, but the bounding box is so big, cant i resize it? And not make the program close but make the object move not collide?

15
General / How to use "Simple Collision Detection?"
« on: April 30, 2011, 12:51:37 pm »
Quote from: "Dimple"
If adding that causes the program exit, it means that the function returns true so there should be a collision. Try to put the sprites further away from each other. Put them on opposite edges of the screen.


Or should i put the character off the screen but then use the keys to control him back in the view?

Pages: [1] 2
anything