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

Pages: 1 2 3 [4] 5 6 ... 8
46
Window / Re: sf::Event::Keypress problem
« on: April 28, 2016, 12:03:18 am »
Events detect when the key was pressed.
If you want to check if the key is pressed, use sf::Keyboard::isKeyPressed(...)

48
SFML projects / Re: Routing Game
« on: April 27, 2016, 08:57:01 pm »
Any reason you included the compressed version of the screenshot?

Question: how did you figure that out?

49
SFML projects / Re: Pointless Wars - [Turn-Based Pointless Strategy]
« on: April 27, 2016, 05:42:26 pm »
I'm making the interface less dull, adding some transitions and stuff.
Unit out:

Unit in:


Oh, by the way, did you noticed this sick new logo by @jdewojno? He had never done anything like this before, what a guy.

50
General / Re: how i can move sprite with mouse,help ASAP please
« on: April 26, 2016, 11:04:59 pm »
Use sf::Event to read when the mouse button is pressed. See detailed description.

while window is open
  handle window events (if piece is selected and mouse was pressed, update position)
  other updates go here...
end while

51
SFML website / SFML on Google
« on: April 24, 2016, 05:06:08 am »
Whenever I google some SFML feature it returns me the SFML 2.0 documentation rather than the most recent one. Why is that?

52
General / Re: Player interaction
« on: April 23, 2016, 06:29:18 pm »
How would I create a brand new object?

That's your answer:

The next best step, in my opinion, would be to do more studying of C++ in general, and learning when variables go in and out of scope, how containers work, etc.

You use a container (list, vector, map... there are many options) to store all your game objects. When I say "create a brand new object" I mean add an item to that container.

As for "then what do I do with the objects in this container", you keep updating them accordingly, until they cease to exist. For instance, once you've added your player to that list, keep updating it as long as it exists in your game. If you are not familiar with what does a game loop looks like it goes like this:

GameObjects objects
while game is open
  for each object in objects
    object.update()
  end for
end while

or

GameObjects objects
Systems systems
while game is open
  for each system in systems
    system.update(objects)
  end for
end while

For learning purposes, it doesn't matter which one you choose.

53
SFML projects / Re: Cendric: An RPG Platformer
« on: April 23, 2016, 04:01:49 am »
I've made a platformer where you controlled a pokemon trainer and your pokemons follow you around, like your NPC on the gif does, so I have a suggestion on how you can make it more smoothly.

I had an object called MoveInstruction that stored:
- The position x,y where the action occured.
- The action (jump, go down, go left or go right).

The pokemons had a list of MoveInstructions, but these instructions were only used for "mid-air" behavior. By default (meaning if the list of move instructions is empty), the pokemon would just see where is the coordinate x of his master, set that as a target and move towards it.

Whenever the master jumps or goes down, the master sent a MoveInstruction with the coordinate where the action occurred and while master is in mid-air, he kept sending MoveInstructions whenever left/right was pressed. The follower would go towards that coordinate and perform the same action, and while in air, it would move exactly like the master did. When master landed, it would stop sending instructions to the follower and when the follower landed it would resume the default behavior described above. Cycle continues.

I was very happy with the results, the followers would move like pros.

54
SFML projects / Re: Cendric: An RPG Platformer
« on: April 23, 2016, 03:17:56 am »
MSVCP140.dll missing from Cendric_v0.2.1_win64.

EDIT: Ah, I didn't read the Important Notes.

55
SFML projects / Re: Pointless Wars - [Turn-Based Pointless Strategy]
« on: April 22, 2016, 07:45:53 pm »
The server works and the client works! Here's the proof, kinda.
(click to show/hide)
Players found eachother through the server, player 1 is shown at the left on player 1 screen and player 2 is shown on the left on player 2 screen. Each player built its own army and everything worked out.

I'm surprised really. Since the beginning of the project I knew multiplayer would be the hardest part to figure out, and it was hard, but not as hard as I thought it would be. Of course, SFML makes things much easier, and the support in this community is on point, so thanks y'all. I'll make sure I put a big-ass SFML logo on the splash screen.

56
General / Re: Player interaction
« on: April 22, 2016, 06:30:16 am »
What you want is a Button and a Drag and Drop behavior. User interacts with your program using the input hardware that he has available (mouse, keyboard, etc...). You can read these inputs using sf::Events (see detailed description). You can take a look at the available SFML GUI libraries and see if you like what you see, but for learning purposes I would recommend you to make your own button, at least the first one! Buttons are the most basic GUI element and most of the other elements are just specialized buttons.

A suggestion of how to implement a button.
A button has 3 states:
- non-active: mouse outside of the button.
- hovered: mouse over button AND mouse button not pressed.
- active: mouse over button AND mouse button pressed.
A button also has a trigger, something that happens when it goes from active to hovered (trigger on release) and/or from hovered to active (trigger on press).

Make a button class, create a button, put it in your game loop, update the state according to the mouse state and make a function to be called when the button is triggered. 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.

Now your other object also behaves like a button (things happen when you click on it) so you can either inherit from button (not my favorite) or have a button inside it (weeks from now, when you start reading about ECS vs OOP you will understand this better). Now, what's the trigger of this other button?

Let 'drag' be a boolean type inside your object. This button sets drag to true on press and drag to false on release. And then in another part of your game loop you check if the object is being draged and update according to the mouse position.

Easy enough, right?

57
SFML projects / Re: [Release][GUI] SFML + ImGui lib
« on: April 22, 2016, 01:13:41 am »
About the problem I mentioned, it happens when you use sf::RenderWindow::setFramerateLimit(...). If you don't set a limit it works fine.

58
You got it.
These are two ways I use globals in my current project:
1) I have a EntityManager object that all systems need access to, so all the systems keep a pointer to that object.
2.1) I have a static class called Resources where I keep images, sounds, musics and fonts. There's no such thing as "static class" in C++, but if you declare all the methods and members as static, BAM!, you got a static class.
2.2) For the Resources class I could also instead of static class use a Singleton Design Pattern, but this is too fancy for a one-man project (IMO), which seems to be your case.

59
SFML projects / Re: Pointless Wars - [Turn-Based Pointless Strategy]
« on: April 18, 2016, 06:45:41 pm »
Game, please! I only need one coin to decide who starts!
But thanks for telling me there's a possible bias for player 1 to start!


60
SFML projects / Re: The Possible Game
« on: April 16, 2016, 01:52:02 am »
There's another game called Geometry Dash that is similar too (maybe same developer even?).
Anyway, good job! Yours looks fun too!

Pages: 1 2 3 [4] 5 6 ... 8
anything