Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Discussion / DNG - Berzerk! remake [DBP]

Author
Message
LBFN
17
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 27th Aug 2011 21:10
Quote: "YAY IM OFF POST APPROVAL"


I'm glad for that also.

I saw your loadroom() function. It is redundant to have the map array and the coord array. You could just as easily use the map array to provide the needed collision info.

I view the code I have submitted as a streamlined version of yours. The arrays are different, but I think are a little more easily accessed. Still, if your heart is set on using your code, we can make it work.

I don't get the


code. I read what you said about DBP processing arrays, but I have never seen that at all and view it as unnecessary.

thisotherguy
12
Years of Service
User Offline
Joined: 22nd Aug 2011
Location:
Posted: 27th Aug 2011 21:27
while your code is a reduced version, it also takes away a lot of the functionality. the "mazes" thus generated are not mazes at all, but are just a 6x6 grid of rooms with doors on all four sides open. the maze generator (which is what is inside the setupmaze() function in my snippet and which you culled) comes up with a configuration of doors that makes it challenging but always possible to reach any other room from the one you are currently in. there is no map array in the loadroom() function, it is only present in your code. if you dont want a maze, and instead simply want a grid with doors on all four sides of each room im afraid i mistook you and wasted all this time coming up with an algorithm that creates a maze.

Darkseid?
thisotherguy
12
Years of Service
User Offline
Joined: 22nd Aug 2011
Location:
Posted: 27th Aug 2011 21:39
if you read the comments i added to the code, i explain why i added +6 to each of the maze array indices. this is because darkbasic, unlike some other languages, reads code within a negative if then block, which causes an error, since it results in calling indices that are below or above the uppermost or bottom index in the array. to fix this, i increased the size of the maze array by 12, and sandwiched the actual data between 6 dummy values at the beginning and end of the array, so that when the compiler reads the if then condition (despite knowing it wont have to execute it) it wont return an error. that is why i added 6 to all index values referring to the maze array.

Darkseid?
Darkzombies
13
Years of Service
User Offline
Joined: 25th Dec 2010
Location: In multiple tabs, most likely youtube.
Posted: 27th Aug 2011 22:31 Edited at: 27th Aug 2011 22:48
I would do art, but I can't animate at all... objects maybe, but mobs, definetly not

EDIT: I did something simple, if this is good enough, I guess I can do art. I'll just attach it.

-------------------SIG---------------------------------

Attachments

Login to view attachments
MrValentine
AGK Backer
13
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 28th Aug 2011 06:33
Bearing in mind guys we should be explaining at every step what each piece of code does and how they function... this is essentially for beginners to learn things we all seem to be pros'

Maybe we should slow down and start to explain how things work and why they work in such a way following the spirit of DNG

Just a thought

thisotherguy
12
Years of Service
User Offline
Joined: 22nd Aug 2011
Location:
Posted: 28th Aug 2011 13:57 Edited at: 29th Aug 2011 03:25
edit: code is rem'd now

Darkseid?
Libervurto
17
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 28th Aug 2011 14:32 Edited at: 28th Aug 2011 15:30
I've done a little editing. Tidied up the layout, simplified a few bits of code and changed CheckRez() to accept parameters.


[edit]
I agree there is a lack of commenting in the code. Remember that if you don't explain your code you force others to work it out which takes time and slows down the project. For the Space Invaders project we made a separate glossary file which explained all of the variables and functions used in the code.

Why are CurrSprite and CurrImg declared as globals when they are only used in the GetFreeSprite and GetFreeImage functions? Wouldn't it be more straight forward to only declare them locally inside their respective functions?

Join DNG today! We are a game development team open to all. Visit our Headquarters to learn more.
LBFN
17
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 28th Aug 2011 15:17
thisotherguy:
I believe I made it clear what was expected as far as the maze goes. Here are some quotes from what I said:

The code you submitted does not comply with this. We will move forward with what I have submitted (I haven't really looked at Obese's edits yet, but will post up an edited version later today.)

Quote: "I didn't see thisotherguy's new code so I'll add that in a bit.
"
Please don't do this. You will bring confusion as to what we will move forward with.

Quote: "I agree there is a lack of commenting in the code. Remember that if you don't explain your code you force others to work it out which takes time and slows down the project."

Point taken. I will plan to add more commetns to the code itself to try and explain what is happening.

Quote: "Why are CurrSprite and CurrImg declared as globals when they are only used in the GetFreeSprite and GetFreeImage functions? Wouldn't it be more straight forward to only declare them locally inside their respective functions?
"

They do not have to be declared as globals.

Libervurto
17
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 28th Aug 2011 15:22
Tip: There are times when you don't need to use an if statement to make a decision.
If I wanted to check the status of the spacebar, the natural way to code would be this:-
if spacekey() = 1 then ...
This is how we learned to use IF statements, but this is actually making the computer do more work than is necessary. All the IF statement does is test for a positive value (>0), so this is what it sees:-
if (spacekey() = 1) > 0 then ...
Since one is a positive number, and the only other state possible for spacekey() is zero, we can get rid of the "=1" comparison.
if spacekey() then ...
This becomes clearer when I show you the opposite condition:-
if spacekey() = 0 then ...
In this case we need the zero comparison because we want to invert the value of spacekey() and only execute the code when it's NOT being pressed. So the program sees this:-
if (spacekey() = 0) >0 then ...
While spacebar is idle, spacekey()=0 which is equal to 0 so the result of the comparison is 1, which is positive so the condition is true!

Once you understand what IF does, you can do away with it all together and instead use the results of comparisons or calculations to make decisions. In some cases this just makes things complicated, but in some situations a comparison isn't actually needed, like in this snippet from our Bezerk! project:-
function CheckRez()
if check display mode(1024,768,32) = false then exitfunction 0
endfunction 1

"check display mode(1024,768,32)" is a pain to type so I'll call it X from now on. So what this function says is: If X=0 then return 0, else return 1. But X can only be 0 or 1, so if it isn't 0 it must be 1! Therefore we can just return X and do away with the condition all together!
function CheckRez()
X = check display mode(1024,768,32)
endfunction X

Tadaa!

Join DNG today! We are a game development team open to all. Visit our Headquarters to learn more.
Libervurto
17
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 28th Aug 2011 15:30
Quote: "Please don't do this. You will bring confusion as to what we will move forward with."

Okay.

Join DNG today! We are a game development team open to all. Visit our Headquarters to learn more.
thisotherguy
12
Years of Service
User Offline
Joined: 22nd Aug 2011
Location:
Posted: 28th Aug 2011 15:44
back. ok well now that we've decided to move forward with what you have submitted, what's my next task? also, how is the program going to decide what doors will be open and which ones will be closed?

Darkseid?
LBFN
17
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 28th Aug 2011 15:58
thisotherguy:
In Berzerk! all of the doors are open, so you should not have to code open/closed. What I would like you to do is to make sure that if a room is on an outer edge of the map array, that no door could be placed on that wall. (for example, if a room is at the top of the array, you cannot have a door on top.) Then, make sure that adjoining rooms have doors that are consistent. So, a door on the right side of the room matches the door on the left side of the adjacent room to the right of it. They would both have the same Y coordinate. As always, if you need a hand or get stuck, let me know.

thisotherguy
12
Years of Service
User Offline
Joined: 22nd Aug 2011
Location:
Posted: 28th Aug 2011 16:18
when i say door, i mean whether or not a room has an exit on one side. if you play this http://www.flash-game.net/game/1758/berzerk.html for instance, all walls do not have doors in them. In other words, not all rooms have four doors (which is the way the rooms are generated in your code)

What algorithm will establish what sides a room will have doors on? it would be helpful if you had a look at this, http://en.wikipedia.org/wiki/Maze_generation

I have already written code that made sure if a room is on an outer edge no door can be placed on that wall, and that adjoining rooms have doors that are consistent in their position, in addition to ensuring door configurations for rooms do not block off sections of the maze. This is all present in working order in the setupmaze() function, however, since this was rejected, I would appreciate if you could teach me the alternative method.

Darkseid?
LBFN
17
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 28th Aug 2011 22:27 Edited at: 29th Aug 2011 07:17
Quote: "This is all present in working order in the setupmaze() function, however, since this was rejected, I would appreciate if you could teach me the alternative method.
"


Okay, I have done the work to show you a way that you can do this. It was necessary to alter the SetOuterWalls function to include the map x and y coordinates.

EDIT: Please understand that this is not how the function will ultimately end up, as we are simply working on getting the doors placed correctly at this point. When we get it working, we will then get the character moving around and the room won't change until the player actually goes through a door. I don't want you to think your time is being wasted, because it is not; you are building in the code and getting things working and in order. It will be fairly easy to convert once we get done.






The call to it (from the BurnRoom function) looks like this


As you scroll through the maze, there are no doors at the top of the maze and doors that are at the bottom of one room match those at the top of the room below. If you scroll down to the bottom of the maze, it still will put a door on the bottom, which needs to be coded yet. I left this and the other issues for you, and my intent here is to help you see how it can easily be done.

So, you can see, this one simple change makes it work.

Note: the -6 is there because I want to look at the room above. If we had made an 8 X 8 grid of rooms, it would have been -8.

EDIT:
Okay, I have incorporated Obese's suggestions and have updated the code:


I also added a man figure that is placed at the north doorway (if the room has a north door). You will need the attached file in the media folder to run it.

Do you want the main character to be a regular guy or a guy in a spacesuit? or perhaps something else. Let me know and I will see what I can do.

Attachments

Login to view attachments
Darkzombies
13
Years of Service
User Offline
Joined: 25th Dec 2010
Location: In multiple tabs, most likely youtube.
Posted: 29th Aug 2011 02:08 Edited at: 29th Aug 2011 02:38
All good work, I still don't know what I can do on this.

READ MY LAST POST

And just a suggestion, add alpha instead of black background?

EDIT: I just made some font with a font creator I found on the forums. (Just thought It would help) It's attached.

Join DNG today! We are a game development team open to all. Visit our Headquarters to learn more.

Attachments

Login to view attachments
LBFN
17
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 29th Aug 2011 02:27
DarkZombies:

Why don't you try your hand at designing wall pieces? They need to be 32 X 32 each. We need four different sets in total. You could create a bitmap that is 320 X 32 and include the following pieces:
vertical, horizontal, upper left corner, upper right corner, lower left corner, lower right corner. Leave the extra space on the right side of the bitmap blank for now. I plan to use it for what I would call caps that will provide a nice ending on the vertical and horizontal. It would be easier for me to show you what I mean after you get done creating something. If you need a reference, you could look at the blue.bmp image I submitted already. The one you will be making will be a little wider than that, but you should get the basic idea.

Quote: "And just a suggestion, add alpha instead of black background?"


I don't understand what you mean by this comment. Are you talking about adding color? The plan is to make the floor a related but slightly different color than the wall tiles, and that depends upon where you are at in the maze (remember the four quadrants idea?) If you meant something else, let me know.

Darkzombies
13
Years of Service
User Offline
Joined: 25th Dec 2010
Location: In multiple tabs, most likely youtube.
Posted: 29th Aug 2011 02:40 Edited at: 29th Aug 2011 02:46
No, by alpha I mean transparency, it's what they call it in gimp and such.

Too lazy to make a signature.
Daygamer
14
Years of Service
User Offline
Joined: 16th Mar 2010
Location: United States
Posted: 29th Aug 2011 06:45
@LBFN,

I'm sorry I haven't posted in a while. Again!

Quote: "We have progressed faster than expected and actually have a working maze at this point, so making a mockup screen is no longer necessary. Do you have any experience coding music or sound effects? A function is needed to load all of the music (which really are sound effects or altered speech). Can you work on this please?"


Okay but wouldn't that just really simple like



Or do you have something more fancy in mind?

Just to let you know, I'm am very determined not to fizzle out of this project. I had hoped to have more time this weekend, but nevertheless I'm dedicated to this project. thanks everyone.

LBFN
17
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 29th Aug 2011 07:38 Edited at: 29th Aug 2011 07:41
Quote: "Just to let you know, I'm am very determined not to fizzle out of this project. I had hoped to have more time this weekend, but nevertheless I'm dedicated to this project. thanks everyone.
"

That is good to hear. thisotherguy and I have progressed on the game much more quickly than I expected. My hope is that you will benefit from being a part of creating this game.

Anyway, there is much more to it than what you posted.
1. You will need to create a function that loads the music and call it from within the program (likely early in the code, maybe after the LoadImages() function.

2. Another function, named GetFreeMusic() should be created and it should be patterned after the GetFreeImage() and GetFreeSprite() functions. I would locate it in the code near those same functions.

3. You will need to create a variable for each music file based upon what it is. These variables would all need to be global, as they will be used in and out of functions.

4. Don't get confused because they are music files, but they really are sound effects. We are using .mp3 format for all of the sound effects to save memory and lessen the time the game takes to download and to run.

Lastly, you could experiment with playing the music files at different speeds to see if you can alter them a little bit more, to give the impression that it is multiple robots speaking. When you figure out what speeds work best, plug them in with code.

I realize that you are still learning functions, but what better way to come to understand them then to create code that uses them and play around with it to see how it reacts to different things. If you get stuck, or need help, you can post here or email me directly if you like and I will do my best to assist you.

If you can have a good understanding of functions when we are done with this game, then it will have been a profitable experience for you.

LB

thisotherguy
12
Years of Service
User Offline
Joined: 22nd Aug 2011
Location:
Posted: 29th Aug 2011 09:27 Edited at: 29th Aug 2011 10:05
here is a snippet combining all the of the features of the code snippets submitted above. (i had an extensive look at the game design document and made sure it complies with all points.) you will need to download an edited version of the player animation file which we can use temporarily, until the original is modified to include shooting etc. it is not commented yet, that can be done if any of the code finds its way into the main project file that lbfn has.
@LBFN:
1) The coord array in this code is analogous to the map array that was previously being used, but since it is three dimensional, with values for room number, x and y tile coordinates it eliminates the need for StartX and StartY.
2) I have added a "set display mode 1024,768,32 command which was previously missing in the code, otherwise the resolution is not set after checking whether it is available.
3) One more wall design has been added to the burnroom() function, which now uses the coord array.
4) Collision detection has been added, however the background the character was drawn on is either not properly blacked out or i am doing something wrong, because it is not fully transparent.
5) The player now appears before the door they came out of.
6) While these are not present in the original game, it would be nice to have different animations for the character walking up or down.



Darkseid?

Attachments

Login to view attachments
Darkzombies
13
Years of Service
User Offline
Joined: 25th Dec 2010
Location: In multiple tabs, most likely youtube.
Posted: 29th Aug 2011 10:02 Edited at: 29th Aug 2011 10:03
This post seems to have gotten slower... I'll probally jynx that but oh well lol.

Did you read my post, its like 6 up? Well I made a font lol.
See if you can use it. I don't know how to use sprite sheets or anything thats not a single image. If you could teach me that would be nice.

Too lazy to make a signature.
thisotherguy
12
Years of Service
User Offline
Joined: 22nd Aug 2011
Location:
Posted: 29th Aug 2011 10:10
I read your animation post and i opened the file but all i saw was a red comma like thing. Dunno if its just me lol. Also saw the font, very nice. Could you start coding the main menu? You could use the font for that. PS. its probably seemed slower cause ive stopped needing to double post.

Darkseid?
LBFN
17
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 29th Aug 2011 16:17 Edited at: 29th Aug 2011 21:30
thisotherguy:

Very impressive stuff! Really nice work.

If you would like to use CREATE ANIMATED SPRITE, which is fine, all of the images would have to be laid out for the man walking. What I mean by this is that if you decided not to use CREATE ANIMATED SPRITE, you could pull the images off of the bitmap and store them in an array. You could then use images 1 - 4 and then reuse images 3, 2 and 1 (in that order) to produce half of the walking animation. Basically, CREATE ANIMATED SPRITE requires creating / loading a larger bitmap, but gives you the ease of using animated sprites.

I am working on revising the player's walking right animation so that it will work with the code and intend to edit this post to include it.

I can do the animation for the player walking up and down also. FYI, we will use .bmp format for the player images. I used .jpg before because you can upload .jpg format on the forum, but we need better quality than .jpg can give.

Your revised version of the code will be incorporated into the existing code for an updated version of the game.

Darkzombies:
EDIT: saw the font - looks good, but looks nearly identical to the one posted by Rich Dershimer found here:
http://forum.thegamecreators.com/?m=forum_view&t=184828&b=8

thisotherguy
12
Years of Service
User Offline
Joined: 22nd Aug 2011
Location:
Posted: 29th Aug 2011 20:39
@LBFN thanks. pretty sure there was a post somewhere up there by darkzombies that had a font attached. have another look.

Darkseid?
Darkzombies
13
Years of Service
User Offline
Joined: 25th Dec 2010
Location: In multiple tabs, most likely youtube.
Posted: 29th Aug 2011 21:19
@thisotherguy Well I would, but I don't know how to use sprite sheets, only seperate images, can you teach me?

Too lazy to make a signature.
Daygamer
14
Years of Service
User Offline
Joined: 16th Mar 2010
Location: United States
Posted: 29th Aug 2011 23:11
@LBFN, Great, looking forward to starting on my task I think I'll probably have a little more success with this one

thisotherguy
12
Years of Service
User Offline
Joined: 22nd Aug 2011
Location:
Posted: 29th Aug 2011 23:42 Edited at: 30th Aug 2011 12:55
will write an explanation and get back to you tomorrow. you can look at the loadimages() function meanwhile and see if you can figure it out. basically you load a bitmap, then cut it up into squares and store the squares in different locations which you can access later.

Darkseid?
Daygamer
14
Years of Service
User Offline
Joined: 16th Mar 2010
Location: United States
Posted: 30th Aug 2011 03:09
I've begun work on the function I'm calling LoadSoundMusic(). Original eh

So, first of all. You guys are just editing the whole code right? How can everyone else tell what changes you made with 300 lines.

Also, I can't find where the sounds were posted. Has Mr. V posted them somewhere.

Thanks

MrValentine
AGK Backer
13
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
LBFN
17
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 30th Aug 2011 04:08 Edited at: 30th Aug 2011 04:16
Quote: "So, first of all. You guys are just editing the whole code right? How can everyone else tell what changes you made with 300 lines.
"


That is a good question. Since the code is always being worked on, I am keeping the most updated, stable version in a snippet in the first post of this thread. I have just finished incorporating thisotherguy's changes and made some changes myself to the code. For your convenience, I am including it here. Please use this to complete your work on the soundFX. There are two .bmp files you will need in the media folder. A link to them is included in the first post of the thread.

To say we have really moved forward would be an understatement. We have a character that moves around the maze from room to room, and when he goes through the door of one room, he enters another that has a doorway at the same place as the one he just left. If he gets too close to the walls, he is fried (well, not really, but it does print it on the screen). Much of the code has had additional comments placed to help everyone see what is being done.

We still need to work on the wall placements within the rooms, but it is coming along nice.



EDIT:
MrValentine, when I click the links or paste it into my browser, it plays the sound effect, but I cannot download it. We need the actual .mp3 files themselves.


MrValentine
AGK Backer
13
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 30th Aug 2011 05:00
Quote: "MrValentine, when I click the links or paste it into my browser, it plays the sound effect, but I cannot download it. We need the actual .mp3 files themselves."


Right click the href links and save as

LBFN
17
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 30th Aug 2011 06:08
Quote: "Right click the href links and save as
"


okay thanks, that did it.

I was hoping for a robotic voice for all but the intro and game over scripts. Something like this:
http://www.mediafire.com/?udo38bb838uumm2

Can you do something like this MrValentine?

MrValentine
AGK Backer
13
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 30th Aug 2011 06:13
gosh that mediafire is well annoying...

umm I am considering doing V2's with my own voice more heavily interrupted and modified... unfortunately I already sold my X-fi card a few weeks back... otherwise it had great voice changers built in... urm voice morphers... give me a few days... I am currently doing a website for a client and it needs completing inside the next 11 hours.

LBFN
17
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 30th Aug 2011 06:37 Edited at: 30th Aug 2011 21:24
There's a problem with MediaFire? First I have heard of any trouble with it. I've always had good luck with it and I have used a few others with so-so results.

Take your time making the files, there is no hurry, especially when real-world work needs to be done. Daygamer can use the other files for now to give him something to work with. Looking forward to seeing what you come up with.

EDIT:

I have updated the man.bmp file (link in the first post of the thread) so that the player faces down and up when moving that way. I have also updated the code (also in the first post of the thread) to reflect the changes in the player animations.

POST EDIT:

I am working on a robot that I think looks decent. Let me know if you want to include it.



Attachments

Login to view attachments
MrValentine
AGK Backer
13
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 30th Aug 2011 06:43
Cheers

thisotherguy
12
Years of Service
User Offline
Joined: 22nd Aug 2011
Location:
Posted: 30th Aug 2011 21:37
ok if were farther along than expected i vote we pause here for a couple of days and try to answer questions like darkzombies' and generally get everyone up to speed. lbfn could you please write an explanation of the code you are using to get images off the sprite sheet. i would but im not good at explaining stuff.

-robot looks good.
-50 is a better delay when youre playing the player sprite imo.
-we might also need diagonal pointing animations (if its not too much trouble lol)

Darkseid?
Daygamer
14
Years of Service
User Offline
Joined: 16th Mar 2010
Location: United States
Posted: 31st Aug 2011 06:04
I've got a function that will load our music files(sounds.) It looks rather repetitive which is never good. I will post it with the whole code when I'm done, but I just wonder if I could get some pointers.

Quote: "
Another function, named GetFreeMusic() should be created and it should be patterned after the GetFreeImage() and GetFreeSprite() functions. I would locate it in the code near those same functions. "


I'm not forgetting about that. Is that what assigns the name of the music file, so we don't have to remember sound 4, sound 7, ect?



Am I close with this? thanks all

Also, I've been messing around with the robot voice too. I attached a it.

Attachments

Login to view attachments
LBFN
17
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 31st Aug 2011 16:32 Edited at: 31st Aug 2011 19:29
Daygamer:

That would need some tweaking in order to work correctly. Here is how you would do it using the GetFreeMusic() function.

First, establish global variable names for the sounds early in the code:


The reason we make them global is that variables used in functions are local unless declared otherwise. So, whenever local variables are used in a function, they will lose their values once you exit the function.

You can choose whatever names you want, I just made these up arbitrarily. You should give them names that will make sense when playing the music in the game.


Right after that in the code, set the initial value of CurrMusic to 0. Since we increment the CurrMusic variable in the GetFreeMusic() function, the first one will be 1.

The function would look like this:



and the GetFreeMusic() function like this:


I like the 'get the humanoid' clip - sounds robotic to me.

EDIT:
Quote: "lbfn could you please write an explanation of the code you are using to get images off the sprite sheet."


Sure. First off, I don't normally use PLAY SPRITE in my games. It has it's quirks and I would rather handle sprites manually. That said, I wanted to go ahead and include it in this game so everyone could see how it can be done.

The SetupPlayer() function is used to grab the player's images. Here it is:


An image for the player is established as well as the sprite number. The way CREATE ANIMATED SPRITE works is that you tell it the number of frames to assign to an image.
You supply how many images wide and how many images high you want it to make. It basically slices up your main image into individual frames.

So, in the function, I have told it to slice the image 7 wide by 14 high frames. This gives us 98 frames of animation. The man.bmp image is 252 X 672 pixels. If you divide 252 by 7, you get 36. Divide 672 by 14 and you get 48. So each individual frame is 36 X 48. Based upon where we are at on the main image, I can know what frames correspond to what movement. So, if frames 1 to 14 are images of the man walking right, I know what to put when calling the PLAY SPRITE command.

The player sprite is offset to the very center of it. This was necessary to make it collide correctly with the walls.
Anyway, to play the sprite's animations, you use the PLAY SPRITE command and include the frames you want it to play.
This code is an excerpt from the MovePlayer() function, when the user has pressed the upkey:



You'll notice a workaround here. PLAY SPRITE will keep playing the sprite images until it gets done. But what if the player decides to go a different direction before the animation is done playing? The answer is that even if you move to the right initially and the animation is in the process of playing and then you suddenly decide to move up, the sprite will move up and keep playing the animation for walking right. It looks silly. So, we check the sprite's frame to see if it is within the frames for moving upward (upward movement frames start at 29 and end at 42). If it is not within these frames, we set the sprite's frame to the start of the animation we want; in this case 29.

thisotherguy:
Quote: "-50 is a better delay when youre playing the player sprite imo.
"

okay, I'll change it to 50 and see how it works.

Quote: " -we might also need diagonal pointing animations (if its not too much trouble lol)
"


You're a taskmaster (j/k)!

It can be done, I will see what I can do.

Can you work on the SetupRobots() function and place the robots throughout the entire maze? Say, randomly place 3 - 11 robots per room. No robots touching each other and not touching a wall. You can use the temp robot image I shared a while back for now.

thisotherguy
12
Years of Service
User Offline
Joined: 22nd Aug 2011
Location:
Posted: 31st Aug 2011 21:28
lol yeah sorry about that i have an annoying bossy streak. working on it
Quote: "Can you work on the SetupRobots() function and place the robots throughout the entire maze? Say, randomly place 3 - 11 robots per room. No robots touching each other and not touching a wall. You can use the temp robot image I shared a while back for now."

on it, will get you moving robots in 3-4 days, have a flight tonight and am doing freshman orientation over the next few days.
Darkzombies: thats a pretty good explanation for a start i think, see if you can use that to write code that loads an animated sprite from a sprite sheet.

Darkseid?
Darkzombies
13
Years of Service
User Offline
Joined: 25th Dec 2010
Location: In multiple tabs, most likely youtube.
Posted: 31st Aug 2011 22:59 Edited at: 31st Aug 2011 23:01
still seems a bit complicated lol.
I know all the commands, and how to do stuff... but I tend to do it bad... if you don't beleive me lol. This is what I'm working on.



Also I'll attach my temp images and .dbpro and .dba files.

Too lazy to make a signature.

Attachments

Login to view attachments
Libervurto
17
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 1st Sep 2011 01:02 Edited at: 1st Sep 2011 01:03
@Daygamer
Adding to what LBFN said. It's a good idea to give your variable names a prefix like "snd_robot" to show they reference sounds. If you just used "robot" as a name, and you have a similar system for referencing images, then you'd get a conflict between "robot" as the robot sound reference and "robot" as the robot image reference, unless by chance they are the same number.

The data command can be very useful when initialising the game and loading media.

Maybe that isn't useful to you, but I just wanted to show a different way you could do it. Or is this what you were aiming for?

Join DNG today! We are a game development team open to all. Visit our Headquarters to learn more.
LBFN
17
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 1st Sep 2011 18:21
Alright, I have added the animations for the player moving up and right, left and down, etc. The file can be downloaded from the link in the first post of the thread.

I have also updated the code so that the player can move in 8 directions and the appropriate animation is played (user presses up and right arrows at the same time to go up and right, for example). It seems to be working fine. Again, the updated code is in the first post.

Darkzombies:
I am hopeful that you will learn something during the creation of this game that you can use when making your own game.

thisotherguy:
Good luck in the orientation. Hope everything goes well. Changed the anim speed to 50 and it seems to work fine.

LB

Libervurto
17
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 1st Sep 2011 21:01
I've gone through the whole program and given it a spring cleaning. The majority of the changes are just to make it easier to read and follow but I did change ScrWid, ScrHgt and CheckRez(). ScrWid/Hgt are now hard-coded values for the screen size which are now taken as parameters for CheckRez(). These changes mean that if in future we decide to support multiple resolutions or use a different resolution to 1024x768x32 it will be much easier to implement.


In the last project, we tagged our comments with our names, for example: OBese87{This code stinks! Who wrote this???} and we also tagged the code itself, for example

This indicates that everything inside the opening and closing tags is written by the same person (unless stated otherwise), in this case me.

You don't have to do this but it helped knowing who had written what.

Join DNG today! We are a game development team open to all. Visit our Headquarters to learn more.
Darkzombies
13
Years of Service
User Offline
Joined: 25th Dec 2010
Location: In multiple tabs, most likely youtube.
Posted: 1st Sep 2011 23:02
Gah. Just got back from the dentist...AGAIN. I need to have 2 teeth pulled and get braces.
Also if I don't get my one loose tooth out of the way. The other tooth will not come out, and they will have to pull my one tooth, stick a wire down the hole and pull up the other one.

but anyways. Anything I can do?

Too lazy to make a signature.
LBFN
17
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 2nd Sep 2011 00:10
Quote: "but anyways. Anything I can do?"


I'm surprised you are asking that. I mentioned that the font that you posted looks nearly identical to Rich Dersheimers. Take a look at the post a while back.

Also, I had asked if you could make some wall pieces. Again, look back in the thread.

I hate going to the dentist. It costs me money and is painful.

Darkzombies
13
Years of Service
User Offline
Joined: 25th Dec 2010
Location: In multiple tabs, most likely youtube.
Posted: 2nd Sep 2011 02:58 Edited at: 2nd Sep 2011 02:59
I meant coding-wise. I think only one person should be art. 2 different art styles would look weird in one game :/

Too lazy to make a signature.
LBFN
17
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 2nd Sep 2011 03:18
Darkzombies:

The only reason I am making graphics for the game is because everyone else had something to do, and I did not want the game to get hung up on not having the graphics we need. I plan to make the player and at least some of the robot graphics myself. I could make all of the graphics, of course, but wanted to involve you to give you a way that you can contribute to this game. Unless you are creating a text adventure, graphics are going to be needed in any game that you make.

We have what we need as far as coders go; we need someone to do graphics.

Darkzombies
13
Years of Service
User Offline
Joined: 25th Dec 2010
Location: In multiple tabs, most likely youtube.
Posted: 2nd Sep 2011 06:28
I can't do animations.
but I can do objects. scenery. or something like that.

Too lazy to make a signature.
LBFN
17
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 2nd Sep 2011 16:25 Edited at: 2nd Sep 2011 19:35
That is why I thought making wall tiles might work for you. You can take the blue.bmp I made as a template and create something unique and different, but is structured the same. The blue.bmp was only temporary to give us something to work with. So, be creative and make something cool.

Robot1 pic:


Attachments

Login to view attachments
Darkzombies
13
Years of Service
User Offline
Joined: 25th Dec 2010
Location: In multiple tabs, most likely youtube.
Posted: 2nd Sep 2011 20:29
I don't have my mouse at the moment (and am using a laptop)
so this is the best I can do till I get it back.

Too lazy to make a signature.

Attachments

Login to view attachments

Login to post a reply

Server time is: 2024-04-23 20:16:13
Your offset time is: 2024-04-23 20:16:13