Zelda Game
Author |
Message |
Imm0rtal
|
Posted: Tue Oct 26, 2004 9:23 pm Post subject: Zelda Game |
|
|
Hello All!
I am making a zelda game in turing. I have the title menu as well options ect. all completed. I had a question as to the most simple way of preventing a sprite to moving somwhere. Would I use an if statement or is there a specific command to use?
*When I finish I plan on submitting Game+Source* |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Tony
|
Posted: Tue Oct 26, 2004 9:38 pm Post subject: (No subject) |
|
|
- get input
- validate (as in make sure you're not walking into a wall)
- if allowed, move the sprite (if not, desrequard)
- repeat
|
Tony's programming blog. DWITE - a programming contest. |
|
|
|
|
Delos
|
Posted: Wed Oct 27, 2004 10:11 am Post subject: (No subject) |
|
|
To expand on tony's more than lucid proposal...
Say you have a screen, with some grass and trees. You could reinterpret this screen as a 2-dim array with traversable and non-traversable terrain (and of course a spot for your Sprite).
Now, when you get the input for movement, you simply will have to reference the sprite's current position (which space on the array it occupies) with the position to which it will move, and make sure that there's nothing there to stop it from moving...
e.g.
0 = traversable, * = sprite, 1 = large, oblique, generic non-traversable object...
0111111110
0000000010
00*1111010
0000100010
0011111110
In this screen you have a width of 10 and a height of 5. Your sprite is at (3, 3). It may move to (2, 3); (3, 2); (4, 3) but NOT (3, 4)...as (3, 4) is already occupied by something else (the large...non-traversable object).
Easy rite? |
|
|
|
|
|
Imm0rtal
|
Posted: Thu Oct 28, 2004 6:19 pm Post subject: (No subject) |
|
|
Delos wrote: To expand on tony's more than lucid proposal...
Say you have a screen, with some grass and trees. You could reinterpret this screen as a 2-dim array with traversable and non-traversable terrain (and of course a spot for your Sprite).
Now, when you get the input for movement, you simply will have to reference the sprite's current position (which space on the array it occupies) with the position to which it will move, and make sure that there's nothing there to stop it from moving...
e.g.
0 = traversable, * = sprite, 1 = large, oblique, generic non-traversable object...
0111111110
0000000010
00*1111010
0000100010
0011111110
In this screen you have a width of 10 and a height of 5. Your sprite is at (3, 3). It may move to (2, 3); (3, 2); (4, 3) but NOT (3, 4)...as (3, 4) is already occupied by something else (the large...non-traversable object).
Easy rite?
This is good. Can you give me a small snippit of source code I could possibly work with? or direct me to source on this site somewhere. |
|
|
|
|
|
cool dude
|
Posted: Thu Oct 28, 2004 9:05 pm Post subject: (No subject) |
|
|
people are not allowed to give out free source code if you don't know so don't bother asking. you can really get someone in trouble for that. sorry. |
|
|
|
|
|
gigaman
|
Posted: Thu Oct 28, 2004 9:20 pm Post subject: (No subject) |
|
|
If you want practice code i would just like to reccomend the turing source code forum. it's not specific to you but it is good practice |
|
|
|
|
|
Imm0rtal
|
Posted: Wed Nov 03, 2004 11:06 pm Post subject: (No subject) |
|
|
cool dude wrote: people are not allowed to give out free source code if you don't know so don't bother asking. you can really get someone in trouble for that. sorry.
Your not allowed to give source code out? why? |
|
|
|
|
|
Tony
|
Posted: Wed Nov 03, 2004 11:17 pm Post subject: (No subject) |
|
|
what cool dude ment to say is that whatever source code you might need is already posted, so just search for it.
but if you're looking for something very specific, noone is going to write your assignment for you |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
|
Sponsor Sponsor
|
|
|
Delos
|
Posted: Thu Nov 04, 2004 11:05 am Post subject: (No subject) |
|
|
Another little thing that troubles (some) people is plagarism. If someone posts some code, since it was posted under their handle, it is technically their intellectual property...of course this opens up a million doors to do with international laws and autonomy on the net and such...suffice it to say that some souls out their take it upon themselves to copy the code so generously posted around here and pass it off as their own. Very bad.
Sure someone could post some code, but that's not going to go too far. Programming is not a case of knowing syntax and structure (although that obviously helps), it's a case of knowing principles and methods of problem solving. Code, be it OOT-speak or C-speak is just an way to formalize your thoughts so that the computer can churn out what you want it to do. |
|
|
|
|
|
Imm0rtal
|
Posted: Thu Nov 04, 2004 1:07 pm Post subject: (No subject) |
|
|
Delos wrote: Another little thing that troubles (some) people is plagarism. If someone posts some code, since it was posted under their handle, it is technically their intellectual property...of course this opens up a million doors to do with international laws and autonomy on the net and such...suffice it to say that some souls out their take it upon themselves to copy the code so generously posted around here and pass it off as their own. Very bad.
Sure someone could post some code, but that's not going to go too far. Programming is not a case of knowing syntax and structure (although that obviously helps), it's a case of knowing principles and methods of problem solving. Code, be it OOT-speak or C-speak is just an way to formalize your thoughts so that the computer can churn out what you want it to do.
Completely Understandable.. But I was wondering why it was supposdly illegal to post source code as I see C++ and Visual Basic Source all the time. Hell just by giving someone a compiled program your already giving them assembly source. |
|
|
|
|
|
Delos
|
Posted: Thu Nov 04, 2004 4:10 pm Post subject: (No subject) |
|
|
And once again we get back to cool dude's post. Basically what he was getting at is that a lot of people new to the site post asking not just for help but for the actual code. This can get quite irrirtating after awhile, as these are generally the people who just want a quick and easy mark in whatever course they may be taking.
This naturally means that they won't be learning anything at all, which is exactly what CompSci is not about.
Yes, cool dude did come off a bit harsh, but that's not entirely a bad thing. All that was meant was that handing over pieces of code essentially just because they were asked for is something that we try to discourage...even though it happens all the time. Once again, not always a bad thing.
In general, for every piece of understandable code that you (or anyone else) post(s), which you subsequently ask to be critiqued and/or helped with, the number of useful responses grows.
For every empty plea that is asked, the number of potential flammings grows...and grows...
Oh, and if you're able to reverse engineer assembly code, then you probably know enough . |
|
|
|
|
|
|
|