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!


GKANG

Member Since 19 Apr 2012
Offline Last Active Feb 22 2013 08:13 PM

Topics I've Started

Issues with animating for a durating, relative to game loops?

14 February 2013 - 04:01 PM

I want to code something similar to how the animate function works with jQuery:

 

var duration = 500, moveY = "50px", moveX = "70px";
$("#someBox").animate({top: moveY, left: moveX}, duration);

 

Here I have a box or container which would move right 70px and down 50px, and that animation would take 500 milliseconds. Now to make this relevant to my game, I'm attempting to make Pokémon style, grid-locked movement:

 

- Press right

--- Player loses control

--- Character runs through one animation cycle

--- Moves right one tile (eg. 16px)

--- Happens over 0.5 seconds

--- Character stops, player gains control

 

Right now I can make it so that the character moves in a direction for X amount of time, but it doesn't explicitly move a set amount of pixels per say.. I have a float for moveSpeed and it's just playerPos.x += moveSpeed for the amount of time. I also tried doing playerPos.x += GRID_SIZE, which guarantees that he moves the exact amount of space, but it just teleports and doesn't animate in a transitional movement. It's important that the player sticks strictly to the grid and is never off-centre.

 

In short, I'd like to make this function:

 

player.move(direction, distance, duration);

 

I'm also having trouble with limiting my game loop / making things happen at regular intervals, so this is likely making my problem much harder. Anyway I hope this is clear enough. If not, I'd be happy to try and explain further. Thanks in advance.

 


So. That Calculus Thing.

21 September 2012 - 03:02 PM

So here I am, starting to make games in 2D to learn the ropes. However, I feel like I'm kind of stuck because whenever I buy a book / try to learn something like OpenGL I'm always greeted with a lovely equation that is completely alien to me.

Now I know that math is pretty much essential to program in 3D and even 2D, but like, HOW essential? Would you guys recommend that I just go head on into math at the same time as programming? I mean, I'm at basic algebra level right now and it aint cutting it.

Thoughts?

Trouble with getting a BITMAP from a class (Allegro

21 August 2012 - 05:29 PM

I'm trying to make an Actor class, where in the constructor I send in a file location for the bitmap. Then I want to use a GetSprite() function to return the BITMAP and use it in the blit() function to draw it to the screen. I get no errors, but the program crashes immediately. I think this is because the image isn't being put into the address where the BITMAP *Sprite points to, but maybe not I dunno. My function call was something like: Actor Guy("image.bmp");

I ended up changing my approach since this ended up just not working, and decided to instead send in an enum. With the enum (eg. INVADER), I was going to use a switch statement in my constructor to assign the correct image there, meaning that there were no mistakes when sending in a file location when creating the object.

Here's the code:

[source lang="cpp"]class Actor { public: Actor(int a, int b, TEAM Type) : HP(a), Speed(b) { switch(Type) { case INVADER: Sprite = load_bitmap("invader.bmp", 0); break; case PLAYER : Sprite = load_bitmap("player.bmp", 0); break; } } void Move() { PosX += Speed; } void Draw() { blit(Sprite, screen, 0, 0, 0, 0, ScreenHeight, ScreenWidth); } private: BITMAP *Sprite; int PosX, PosY, HP, Speed; };[/source]

This just doesn't work, though. If I comment out the call to Draw() in my main loop the program runs and exits fine. When I try to Draw though, it crashes just like before.

What's going on, I'm kinda lost.

Installing Allegro for use with Code::Blocks

19 August 2012 - 09:16 AM

I'm trying to install 4.4 for use with the Code::Blocks IDE. Here's what I did:

1) Downloaded allegro-4.4.2-mingw-4.5.2.
2) Extracted to get three folders: bin, include, lib.
3) Copied all contents from these Allegro folders to the same-titled folders in MinGW (eg. bin contents to C:\Program Files (x86)\CodeBlocks\MinGW\bin).
4) Made a new Win32 GUI project with some test code.
5) Went to Project -> Build Options... -> Linker settings -> Other linker options: -lalleg -> OK.
6) F8 build the program, error message: ld.exe cannot find -lalleg

I did this following a tutorial but I'm guessing the problem lies with linking the files. Just to note, I also copied my .dll files into System32.
Any help getting this up and running?

What I should know / learn to pursue a career in Programming?

17 May 2012 - 12:33 AM

I'm 21 years old and live in England, and up until a year or so ago everything I did in school / college was about Music. Music theory, technology, production, live sound, industry etc. Little did I know back then that this was utterly pointless, even with a love for music, since these qualifications get you pretty much nowhere. Same goes for Art students a lot of the time, great subject, not so great for jobs.

Now today I love programming, and you can actually get in the area professionally. However, I've been looking at some of the listings and they seem to have super HIGH END requirements which look nearly impossible to accomplish.

So what do I need to do in order to reach a goal like that? Getting to the stage where I can be comfortable enough to apply for a Software Development job without feeling like you won't have a clue what you're doing? I know I could have started way younger, but I'm not old yet. I'm pretty sure that I should be going back to school, which I'm totally okay with. What I'm not sure about is what sort of subjects I'm going to need to take so that I have the well rounded knowledge programmers need.

As for now, I know this much:
- I need to program a huge amount on my own, in my own time.
- I need to have a logical brain, knowledge alone isn't enough.
- I preferably need to learn multiple languages to a standard where I can use them on a somewhat competent basis.
- I should learn Advanced Math and perhaps Physics (?).
- I may need to learn more about how languages work technically?

As you can probably guess, I'll be heading to University after college, so the subjects I take in college are basically going to be for support. I'd love for you guys to help me out, I'm totally ready to dedicate to this.

Thanks in advance.

PARTNERS