Jump to content

  • Log In with Google      Sign In   
  • Create Account

FREE SOFTWARE GIVEAWAY

We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.


Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!


roadysix

Member Since 25 Mar 2009
Offline Last Active May 22 2013 08:43 AM

#4982358 Is c++ better?

Posted by roadysix on 21 September 2012 - 07:00 AM

If, like me (and so many others), you enjoy programming for what it is, and not just because you want to make a game, then you will probably enjoy tinkering in c++. Though, if all you're looking for is something a little more powerful than Gamemaker to take your ideas to the next level then best bet is to stick with python, C# or some other high level/managed language.

If you want to try C++, SDL/SFML as has already been mentioned, are choice libraries to develop applications such as games so don't forget to check those out (I would personally recommend SFML simply because I am familiar with it somewhat and seems generally cleaner than its C based competitor).


#4915033 Advice for 2d level design in SFML

Posted by roadysix on 20 February 2012 - 08:19 PM

I still don't understand level editors at all. Are they worth using? How do they work with your program?


Ok, think of it like this, how would you plot all the positions of every object/tile in your level? by manually inputting all the coordinates? seems a bit tedious.. you could come up with a file format which tiles different sprites based on a number index in text file. Such a file might look something like this:

w h
1 1 1 1 1 1 1 1
1 0 0 0 0 0 2 1
1 0 0 0 0 1 1 1
1 1 1 1 0 0 0 1
1 0 0 0 0 0 0 1
1 1 1 1 1 1 1 1

where 0 represents empty space 1 a solid block and 2 something else. However this becomes tedious to edit/manage when levels become large with more than a few different types of objects, also if your not using a tile based system this will fail altogether.

Enter the Map/Level Editor, a tool that allows you to design levels visually which makes managing large levels easier with the ability to supply additional information such as collision/layers objects that exist in the map, tiles and more. Generally, the map editor will output all the necessary data in a file which can then be read by your application that runs the game.

In the end a Map/Level editor does what an useful tool does.. makes your job easier.


#4912694 I Need Some Help

Posted by roadysix on 13 February 2012 - 01:19 PM

Yes, there is plenty more too add, here's a start:

* Post in the help wanted section, for a better response.
* What kind of game/'s do you need built (details please).
* Payment?
* What kind of skills do you need? certain projects require certain tools and skillsets.
* Who are you, what are you trying to achieve (as group/company)?


#4906302 Moving 2D Sprite from Position 1 to Position 2

Posted by roadysix on 25 January 2012 - 08:27 PM

Sounds to me like your requirements are; upon mouse click a sprite should move towards the area clicked at a constant rate.
Heres how to do it:

* First, in some sort of mouse click event save the position clicked, we will call this position target of type Vector2
* Second, you need to find the direction your sprite should move in with a tiny bit of vector math, like so:-

Vector2 direction = (target - position); // gives the direction needed to travel from position to target
direction.Normalize( ); // we need it as a unit vector

* Finally, you want to move your sprite towards the clicked point by incrementing the position by the direction vector multiplied by some constant (in your case this seems to be 1f so we dont even need to do the multiplication but ill put it in there anyway as a speed scalar

position += direction * speed

and that will get you what (I think) you want.

EDIT: oh, sorry i forgot, to stop the sprite when it reaches its destination just check to see if the sprite is within a radius == speed from the target if so set the position = target and the speed / direction to zero.. like so:

if ((target-position).Length( ) <= speed)
{
position = target;
speed = 0;
}



#4792011 template parameter 'T' is ambiguous

Posted by roadysix on 29 March 2011 - 10:13 PM

hello, run into something i feel is a little weird, heres the situation;

I have a few template vector classes for obvious reasons and these vector classes have global operator overloads. I noticed that when i try to do the following;

math::vector2f u(...);
u *= 2;

or something along those lines i get the error in the title.
i also have a bunch of other functions that have similar behaviours eg. math::clamp(x, min, max) where if all parameters are not exactly the same it spits out the above error.
so i cant for example;

type::real_t x = 0.0f; //real_t == float in this case
//...
type::real_t a = math::clamp(x, 0.0, 1.0);

the above sample is particularly irritating because type::real_t can be either float or double and changed with a single define so if i got to some point and decided to change from one type to another it could break existing code without an explicit cast!

I know why the compiler is doing this (it cant decide which parameter it should take the type of hence the ambiguity) its just annoying.

this may be a long shot, but is there no way to tell the compiler to default to the first parameters (or even any single parameters) type in these kinds of situations? then the other parameters will be implicitly cast to that type.... hmm on second thought it might be a good thing that it requires each parameter to be exactly the same type (these functions have one template parameter 'T' by the way.. would be a whole other rant if each were different template parameters haha)

thoughts?
perhaps i should just prefer function overloads in this case :/ ...

EDIT: Actually no that would still produce the same problem... perhaps i should just make a single function and have it take parameters of type::real_t.. yeah that should do it..


PARTNERS