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 - lane

Pages: [1] 2
1
General / shapes and sprites
« on: December 28, 2017, 11:46:01 pm »
Quote
Haven't coded in a minute, but I was wondering if I could have a main.cpp that would act as the guide of a program and run other .h & .cpp files with other functions in them.

For example: the main.cpp would say run a function from test.cpp. And test.cpp was building a rectangle shape and building some sprites. Could I draw those shapes and sprites to the main.cpp window?

Thanks :)

I'm Dumb.

2
General / Re: help on project
« on: November 20, 2016, 04:04:50 am »
You know what, I found an easy way to do it. now I need help with AI..

How do I go about rotating a stationary sprite to follow an enemy sprite? I would like to have the ship point at the enemy.

3
General / help on project
« on: November 19, 2016, 09:01:41 pm »
I am needing assistance on how to "make a copy" of a sprite. I have a menu on the side that has ships on them. I want to be able to left click on the sprite (clicked once, does not have to be held), have the sprite follow the mouse onto the playing field, then right click to place the sprite. <-- I have all of that part done. What I want now is to be able to go back to the place of the original sprite and click and drag a brand new ship onto the playing field without disturbing the other ship I placed earlier.

If anything is unclear or you have questions, please let me know.

4
General / Re: Player interaction
« on: May 01, 2016, 05:11:46 pm »
I have given some time for my brain to rest, so that I have a clear mind for this quest. I have many issues with learning what I need to do. I understand I need to make classes for my buttons and objects, but I have no idea how to: a.) make the class drawable and b.) fill the class with useful functions. I don't know what to put in these classes! I try to look at examples, but there is no clear understanding for me. I still do not understand how you can make an object(for example a texture or sprite) to be brand new to the button or the game for making the copy of it. Is there any reference's that can make this clear for me? Can someone explain these for me? :-[

5
General / Re: Player interaction
« on: April 23, 2016, 05:07:02 am »
Thank you both for your posts! I now have a place to start! I definitely have some things to search out and to test before I continue.  8)

Some questions:

Quote
This function will create a new object, a brand new object, the button that you made doesn't even need to know what it just did.

I am curious of how to do this. How would I create a brand new object?

I will most likely have more questions as I continue this goal..



6
General / Player interaction
« on: April 22, 2016, 05:05:05 am »
Hello, I have a question about how a player can interact with 'objects' in a game. With my small project I would like for the player to use the mouse and drag a copy of a sprite to a location on the map. For example, you have a menu that shows a red square, the player clicks on the square and drags it to a location. The red square will still be in the menu, but the mouse is dragging a red square as well. If you need me to explain this better just ask..

I am not sure of where to start on this process nor on how it is done. If anyone has done this, could you share some information?  :)

Thanks,
lane

7
General / Re: Sprite rotation
« on: April 10, 2016, 04:17:01 am »
Quote
Think about how the size of a circle is determined. From there, can you figure out if a point is inside of or outside of the circle?

radius?? I'm lost  :-[

sf::CircleShape circle(100);

If I knew how to find that I would be fine...

8
General / Re: Sprite rotation
« on: April 10, 2016, 02:45:36 am »
How would I be able to create a circle 'range' for my bullet? For example, I have a ship that shoots a bullet and I want the bullet to set its position back at the ship when it exceeds a circle shape. I know how to create the bounds for a square or rectangle, but I have no clue how to do that with a circle.

9
General / Re: Sprite rotation
« on: April 06, 2016, 05:15:40 am »
That is Awesome! I think I'm starting to (very slightly) get vectors. How can I have that only update when I hit space? My issue is that when I shoot, it goes the direction I want, but now it is following my ship's rotation and moves with my ship if I move. I would like this bullet to go a specific distance and not move after 'shot' even though my ship will move after

10
General / Re: Sprite rotation
« on: April 05, 2016, 05:52:39 am »
How do I go about moving the sprite according to the ship's rotation? Is there a formula for something like this? I have no target I'm shooting at, just open space. Any help on this would be AWESOME!

11
General / Re: Sprite rotation
« on: April 03, 2016, 09:02:29 pm »
You're right, lol!
Thank You! 8)

Quick question though: if I were to make this ship shoot something, how would I go about doing that? Would I have to position the sprite/picture where the ship's location is then draw it and move it according to the ships orientation?

12
General / Sprite rotation
« on: April 03, 2016, 02:15:08 am »
Hello! I am looking for a solution to have my sprite rotate correctly when I am going in a diagonal direction (holding up key and right key, down key and left key, etc.). I have a ship sprite the initially faces right, when I hit a single arrow key it will rotate appropriately to face that direction, but I can't find a way to get the diagonals to work.. I have tried an if statement with up key and right key then some logic to turn it, but it doesn't quite work. Here is my code for my ship's movement:
//Character movement
                        if(sf::Keyboard::isKeyPressed(sf::Keyboard::Up) && sf::Keyboard::isKeyPressed(sf::Keyboard::Right)){
                        if(ship.getRotation() != 315){
                                        if(ship.getRotation() > 135){
                                                ship.rotate(2);
                                        }
                                       
                                        if(ship.getRotation() <= 135 || (ship.getRotation() >= 0 && ship.getRotation() < 315)){
                                                ship.rotate(-2);
                                        }
                                }
                               
                        }
                       
                        if (sf::Keyboard::isKeyPressed(sf::Keyboard::Up)){
                                if(ship.getRotation() != 270){
                                        if((ship.getRotation() > 270) || (ship.getRotation() <= 90)){
                                                ship.rotate(-2);
                                        }
                               
                                        if((ship.getRotation() < 270) && (ship.getRotation() > 90)){
                                               
                                                ship.rotate(2);
                                        }
                                       
                                }
                                ship.move(sf::Vector2f(0,-speed[2]));
                        }
                       
                        if(sf::Keyboard::isKeyPressed(sf::Keyboard::Down)){
                                if(ship.getRotation() != 90){
                                        if((ship.getRotation() > 90) && (ship.getRotation() <= 180)){
                                                ship.rotate(-2);
                                        }
                                       
                                        if((ship.getRotation() < 90) || (ship.getRotation() > 180)){
                                                ship.rotate(2);
                                        }
                                }
                                ship.move(sf::Vector2f(0,speed[2]));
                        }
                       
                        if(sf::Keyboard::isKeyPressed(sf::Keyboard::Left)){
                                if(ship.getRotation() != 180){
                                        if(ship.getRotation() > 180){
                                                ship.rotate(-2);
                                        }
                                       
                                        if(ship.getRotation() < 180){
                                                ship.rotate(2);
                                        }
                                }
                                ship.move(sf::Vector2f(-speed[2],0));
                        }
                       
                        if(sf::Keyboard::isKeyPressed(sf::Keyboard::Right)){
                                if(ship.getRotation() != 0){
                                        if((ship.getRotation() > 0) && (ship.getRotation() < 180)){
                                                ship.rotate(-2);
                                        }
                                       
                                        if(ship.getRotation() >= 180){
                                                ship.rotate(2);
                                        }
                                }
                                ship.move(sf::Vector2f(speed[2],0));
                        }

I have a feeling it is clashing with one of the other if statements, any suggestions on this?  :D

13
Graphics / Re: Codelite and SFML
« on: March 17, 2016, 04:34:12 am »
you know what. I got it to work (I think)

Instead of statically linking it, I used the .dll s

in my Library I put just the sfml-... and then the dependencies. I then went to where the executable was being made and put the .dll s there. I think it all works, for I used the Pong example from the examples folder and got it to work!

Thank You All Very Much! I look forward to being able to code with SFML.

 8)
lane

14
Graphics / Re: Codelite and SFML
« on: March 17, 2016, 03:07:08 am »
I added in all of the libs (dependencies included).

just to make sure I did things right:

sfml-graphics-s-d
freetype
jpeg
sfml-window-s-d
opengl32
gdi32
sfml-audio-s-d
openal32
FLAC
vorbisenc
vorbisfile
vorbis
ogg
sfml-network-s-d
ws2_32
sfml-system-s-d
winmm

That is how I have it inside of my Libraries. When I try to run the example code that is in the Code::Blocks SFML tutorial, I still have issues with graphics, specifically ImageLoader.cpp and jpeg. :'(

lane

15
Graphics / Re: Codelite and SFML
« on: March 17, 2016, 01:04:39 am »
 >:( I am feeling dumber every minute!

I went to go link up my libs and includes and I even added the SFML_STATIC macro, but no luck.

This is how I have it set up.

Include path: C:/Repositories/GIT2/build/bin/include
Library path: C:/Repositories/GIT2/build/lib
Libraries: sfml-graphics-s-d;sfml-graphics-s;sfml-window-s-d;sfml-window-s;sfml-audio-s-d;sfml-audio-s;sfml-network-s-d;sfml-system-s;sfml-system-s-d

I keep getting errors about the graphics..

Pages: [1] 2
anything