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
@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.
@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
@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++.
@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. :<
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?
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.
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.
@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.
@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.
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
@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.
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.
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.
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.
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
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
askmiller 4 months ago
Allegro doesn't recognize bitmaps loaded with a function-_- any help with this?
DemangoProductions 5 months ago
@DemangoProductions What's the function's return type?
LusikkaMage 5 months ago
@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 5 months ago
@DemangoProductions and the brackets were in the correct place youtube's commenting system just messed it up
DemangoProductions 5 months ago
@DemangoProductions -_- at you, too. I'm just trying to help. :P
CoderRach 5 months ago
@CoderRach i don't really know what a function's return type is...
DemangoProductions 5 months ago
@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.
CoderRach 5 months ago
@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 5 months ago
@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 5 months ago
@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 5 months ago
@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 5 months ago
@CoderRach (You'd have to write the LoadImages function yourself, that's not part of Allegro.)
CoderRach 5 months ago
@CoderRach took me a while but i finally understand :) thanks ^,..,^ (I do however feel like i have made you mad *chuckle*)
DemangoProductions 5 months ago
@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. :<
CoderRach 5 months ago
nvm i posted that last comment midway through i see how to do it now that i watched the whole thing
440DECA 6 months ago
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 6 months ago
@440DECA Are you using masked_blit?
LusikkaMage 6 months ago
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 6 months ago
@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 6 months ago
@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...
DrunkenWaffle 6 months ago
@LusikkaMage NEVER MIND! NEVER MIND! I figured it out :P
DrunkenWaffle 6 months ago
@LusikkaMage does allegro will also be animating the sprites automatically??
farooqmss 9 months ago
@farooqmss No, you have to code the animation logic manually. It's briefly covered in part 8
LusikkaMage 9 months ago
Comment removed
cplusplusgamer 1 year ago
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 1 year ago
@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.
LusikkaMage 1 year ago
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 1 year ago
@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 1 year ago
@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 1 year ago
@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 1 year ago
@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 1 year ago
@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 1 year ago
@LusikkaMage I am using DevC++
iTheEliteOne 1 year ago
@iTheEliteOne
Where is the image and the game?
Please send me the Path of the image and the path of your game.exe
AnewBANDareHERE 1 year ago
What do you mean by blit the buffer?
ddhhT 1 year ago
Could I use my own sprites for programming? o.o
naichengwei1 1 year ago
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 1 year ago
@bluecoolaid112 lol just realiezed im watching the wrong video this for allgro and im doing sdl
bluecoolaid112 1 year ago
i made stupid mistake: i had all of my initialization code in a seperate function.
i called this function after loading my image : /
7arnebcab7 1 year ago
I have a problem: The program wont load my image but throw an exception.
the image actually exists but it wont load it.
7arnebcab7 1 year ago
@7arnebcab7 Are you giving it the correct path? And, are you using \\ or /?
LusikkaMage 1 year ago
This has been flagged as spam show
Hey guys did anyone worked out how to turn on weapon unlock with cheat downloaded at CodCheat(.)com
JoshPerrick 1 year ago
Does the sprite have to contain that specific magenta color?
Elliotpwnztehvlogger 2 years ago
@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.
LusikkaMage 1 year ago
im so confused here, when i debug it gives me a error... saying i have to break or continue... any idea whats going on?
McClover 2 years ago
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...
TheReasonWhyGuy 2 years ago
Aheh. It's the song from Rawr Rinth. I uploaded it to the public domain music page under "Suburban Dinosaur"
LusikkaMage 2 years ago
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.
papano12 2 years ago
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.
LusikkaMage 2 years ago
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.
papano12 2 years ago
Put them next to the .exe file.
bwrightau 2 years ago
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.
stereo123 2 years ago
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.
ccricers 2 years ago
I'm following the SDL tutorials, nice work with BOTH API:s :D
Z3r0XoL 2 years ago
Yaaaaaay~~ :D
Internet Education :)
robotwo 2 years ago
non power of two textures/images should be not much of an issue these days.
infinityk 2 years ago
I dont actually think I've ever used non power of two sprites in any games i've made.
TheReasonWhyGuy 2 years ago
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.
TomCatFort 2 years ago
Both Direct3D and OpenGL APIs have supported NPOT textures for quite some time. Which modern graphics cards in particular are you talking about?
infinityk 2 years ago
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.
TomCatFort 2 years ago
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.
LusikkaMage 2 years ago
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.
LusikkaMage 2 years ago
Yes. XNA uses DirectX.
TomCatFort 2 years ago
why is my internet suddenly so freaking slow?!?!?!?!?!?
eatcomics 2 years ago
Stop torrenting pron1!!
LusikkaMage 2 years ago
Well I didn't know it was a trojan!!!!!!!
eatcomics 2 years ago
Interesting =p
maxiart 2 years ago
I must say that, these videos are very superior. :)
Good job.
DIABLOVT12 2 years ago
just shows what happens when you don't have the distraction of the internet at home ;-) Good work
amcadam26 2 years ago
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.
LusikkaMage 2 years ago
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
LusikkaMage 2 years ago