Sort by time | Sort by thread (beta)

Link to this comment:

Share to:
see all

All Comments (65)

Sign In or Sign Up now to post a comment!
  • Ok, last video, I was so confused, after a few tries I got the basics KINDA but after this video my mind exploded and now I get it. It all makes sense now O.o

  • Allegro doesn't recognize bitmaps loaded with a function-_- any help with this?

  • @DemangoProductions What's the function's return type?

  • @LusikkaMage -_- i'll just post the function's code

    void load_res

    { BITMAP *one = NULL; one = load_bitmap("res/0.bmp", NULL);

    }

    END_OF_FUNCTION(load_res)

  • @DemangoProductions and the brackets were in the correct place youtube's commenting system just messed it up

  • @DemangoProductions -_- at you, too. I'm just trying to help. :P

  • @CoderRach i don't really know what a function's return type is...

  • @DemangoProductions Then you should STOP with Allegro, and go back and learn C++. Functions are one of the FIRST things you learn in C++, and if you don't understand them you shouldn't be writing games. AntiRTFM has some C++ video tutorials on YouTube.

  • @DemangoProductions Here are some things to take into account:

    (1) BITMAP* one is only in scope for the load_res function. It does not touch main at all.

    (2) You have a memory leak because, since the BITMAP is going out of scope at the end of the function, you're not freeing it.

    (3) I think you need to review your C++ basics; you do not seem to understand the concept of functions.

  • @CoderRach yeah the 3 is that get's me... i haven't learned functions properly... where could I learn about them? about 1: how do i make it "touch"*giggle* the main? about 2: i have to destroy_bitmap at the end of every function?

  • @DemangoProductions You can check out AntiRTFM for some C++ video tutorials on YouTube.

    You only need destroy_bitmap when your BITMAP goes out of scope, if this were scoped properly then you wouldn't want it at the end of this function, no.

    One thing you can do short of writing a whole manager structure is to declare the BITMAP in main before the game loop starts

    BITMAP* background, character, grass;

    and then call a function to set it

    LoadImages( background, character, grass );

    Cont.

  • @CoderRach But then you'd need to deal with pointers and references, and that's another thing you should be familiar if not comfortable with in C++ prior to starting with game programming in C++.

  • @CoderRach (You'd have to write the LoadImages function yourself, that's not part of Allegro.)

  • @CoderRach took me a while but i finally understand :) thanks ^,..,^ (I do however feel like i have made you mad *chuckle*)

  • @DemangoProductions Naw, I'm just trying to communicate a lot of information in a limited amount of space. YouTube comments aren't exactly made for programming discussion. :<

  • nvm i posted that last comment midway through i see how to do it now that i watched the whole thing

  • i put the background in my paint file as magenta(255,0,255) and it still appered with my sprite? how do i make just the sprite appear with no background?

  • @440DECA Are you using masked_blit?

  • You'll have to include the file path for the image file, correct? If so, how would I make it so I can import it on any computer? I don't want it to be C:\Users\Ryan\Desktop\Project\­Picture, I want it to be able to work on every computer. :|

  • @DrunkenWaffle Paths will automatically be in the folder containing the .exe, so if you have your "Game" folder with "game.exe" inside it, and a "Image" folder inside that place, then you just point it to the Image folder, and nothing else.

  • @LusikkaMage Alright, thanks. However, another error arises...(sorry :S) When I attempt to load the image into the game, I get the following error:

    Unhandled exception at 0x10005d89 in AllegroProj.exe: 0xC0000005: Access violation reading location 0x00000000.

    I've done some searching on Google, and it appears it has something to do with pointers...

  • @LusikkaMage NEVER MIND! NEVER MIND! I figured it out :P

  • @LusikkaMage does allegro will also be animating the sprites automatically??

  • @farooqmss No, you have to code the animation logic manually. It's briefly covered in part 8

  • Comment removed

  • Is there a bitmap command that would allow me to turn multiply my 32x32 grass texture across the entire screen? or will i have to go into an image editor and manually do it.

  • @girandsamich Use a for-loop or a nested for-loop to draw tiles at each 32nd pixel. (i=0; i<scr_w/32; i++)

    draw at x=(i*32); , etc.

  • Okay I need some help, I can't load my image, here is what I have, I added it right after the buffer:

    BITMAP *image = load_bitmap ("elliot.bmp", NULL);

    Now I did this:

    if (image == NULL){return 0;}

    and my programmed closed right away so I am guessing it is not loading it correctly, any help please?

    BTW Great videos so far ^__^

  • @iTheEliteOne if you're trying to open "elliot.bmp", then the image file has to be in the same directory as your .exe file. it's relative to the .exe's path.

  • @LusikkaMage It is in the same directory. Do I initialize the bitmap image and display it in the game loop or some place else? Currently I have the bitmap image line out of the game loop and the masked_blit in the game loop. Also do i need to clear it at the end of the game loop like we did with the buffer?

  • @iTheEliteOne You'll only clear the buffer, not the other images. The bitmaps definitely should not be defined inside of the game loop, that would be a huge waste of processing.

    Are you creating bitmaps after initializing Allegro? Because the program is closing, there has to be something that's not right with the image loading.

  • @LusikkaMage Here is my code (Sorry but you will have to backspace the spaces that I put in the URL, youtube doesn't allow links :( )

    pastebin. c o m /tL7x7DA1

    And by perfectly I mean I get a red window.

  • @iTheEliteOne Like I said, I don't think it has to do with the code, I think it has to do with the location of the image. What compiler are you using? If it creates a "bin" folder, put the image in there.

  • @LusikkaMage I am using DevC++

  • @iTheEliteOne

    Where is the image and the game?

    Please send me the Path of the image and the path of your game.exe

  • What do you mean by blit the buffer?

  • Could I use my own sprites for programming? o.o

  • Im using one of your pictures off your website the one with the grass in stick on it and SDL did not remove pink color automaticaly how can i change it

  • @bluecoolaid112 lol just realiezed im watching the wrong video this for allgro and im doing sdl

  • i made stupid mistake: i had all of my initialization code in a seperate function.

    i called this function after loading my image : /

  • I have a problem: The program wont load my image but throw an exception.

    the image actually exists but it wont load it.

  • @7arnebcab7 Are you giving it the correct path? And, are you using \\ or /?

  • Does the sprite have to contain that specific magenta color?

  • @Elliotpwnztehvlogger Allegro will automatically change that magenta color to transparent. You don't HAVE to use it, though I'm not sure if there's a command in Allegro change the transparent color. If there isn't, you'll have to write code to make your color transparent automatically.

  • im so confused here, when i debug it gives me a error... saying i have to break or continue... any idea whats going on?

  • The music at the end of this video is stuck in my head DX, do you have it for download, I didn't find it on your website...

  • Aheh. It's the song from Rawr Rinth. I uploaded it to the public domain music page under "Suburban Dinosaur"

  • I don't know where to put the x.bmp or o.bmp on my hard drive so that the program can access them. I tried putting them just in c:\ and then changing:

    xSprite = load_bitmap( "x.bmp", NULL);

    oSprite = load_bitmap( "o.bmp", NULL);

    to:

    xSprite = load_bitmap( "c:\x.bmp", NULL);

    oSprite = load_bitmap( "c:\o.bmp", NULL);

    Doing that just crashed the console screen whenever I compiled and ran the code as did leaving trying to compile and run the straight copied code.

  • since \ is used for things like "\n" you have to use "\\" instead of "\".

    So C:\\image.bmp

    However, you shouldn't put it on the harddrive.

    If you have the path as just "x.bmp", it will load the image from the same directory as where the .exe is.

    I'd put something like "\\gfx\\x.bmp", that way your path would be something like

    C:\MyGame\gfx\x.bmp

    So, no matter where the user puts the game, it'll still go to the right folder.

  • Perhaps u should post a Tutorial on how to do that.. I read somewhere it said I have to add the Image to my Directories?

    Heehaw someone needs to make a tutorial on exactly step by step to Getting the file to.

  • Put them next to the .exe file.

  • Great videos, i'll check the sdl ones too.

    Do you think OOP has any place in simple games? I made a pong in allegro with C. I'm now starting to get into actionscript (easier to share, no downloads) and the 2 books i got are full of OOP. I knew i'd have to learn it sooner or later, but i remember reading that it just wasn't needed for the kind of simple retro games that interest me.

  • Final texture size depends on the API too. I know that in DirectX by default any non ^2 texture stored in memory gets scaled to the next biggest ^2 size.

  • I'm following the SDL tutorials, nice work with BOTH API:s :D

  • Yaaaaaay~~ :D

    Internet Education :)

  • non power of two textures/images should be not much of an issue these days.

  • I dont actually think I've ever used non power of two sprites in any games i've made.

  • Yes they are! Many modern (new) graphics card does not support non power of 2 textures. As I know with SDL it is not a problem (somehow and maybe not be true), but with OpenGL or DirectX it is. And if you has some not use area of an image/texture you can put a copyright text there if you want.

  • Both Direct3D and OpenGL APIs have supported NPOT textures for quite some time. Which modern graphics cards in particular are you talking about?

  • I know they have support for them. I don't speak of any particular cards. Mine does not support NPOT textures and it's just 1.5 years old.

  • I have seen games not work on some lower-end laptops and computers purely because the images weren't the right size.

    Since we're making such basic games, we might as well err on the side of caution since it's very likely someone will play it on a laptop or poopeh compy.

    Plus, later on you get acceleration with your hardware if you use 2^x textures, rather than irregular ones.

  • Though come to think of it, it was an XNA game for a class. Is XNA hardware rendered? That might be part of the issue, since Allegro and SDL are software rendered.

    Either way, I think it'd be good to keep it standardized, for simplicity reasons, and just to be safe with all computers.

  • Yes. XNA uses DirectX.

  • why is my internet suddenly so freaking slow?!?!?!?!?!?

  • Stop torrenting pron1!!

  • Well I didn't know it was a trojan!!!!!!!

  • Interesting =p

  • I must say that, these videos are very superior. :)

    Good job.

  • just shows what happens when you don't have the distraction of the internet at home ;-) Good work

  • This is sort of true, but also a hindrance since, if I get stuck on something, I generally have to wait until the next day to check it out.

  • For the video I just uploaded, I wanted to verify what the ogg vorbis format license was, and everyone I texted was like "uh, I'm not at a comp sry. :("

    ;-; !

    How was I the only nerd on a computer on Friday night?? :o

Loading...
0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more