プレイ日記
*J.P.*[P]£ aj2003aj
just to clarify, is this the correct way to do it?
6そうだね
プレイ済み
返信[1]
親投稿
Autz sonic-HD8765
To do what?
0そうだね
プレイ済み
返信[2]
親投稿
*J.P.*[P]£ aj2003aj
the arrays part, look at my previous post about 30 trees
0そうだね
プレイ済み
返信[3]
親投稿
Autz sonic-HD8765
Is hard to look at it and think what it supposed to do. Have you tried the previous suggestions on the other post?
0そうだね
プレイ済み
返信[4]
親投稿
*J.P.*[P]£ aj2003aj
i did exactly what it said and it works, i was just wondering if it was correct coding
0そうだね
プレイ済み
返信[5]
親投稿
raimondz raimondzz
Maybe you should add comments about the variables TREE1, TREE2 and TREES$. Remember that not everybody is aware of your code. Thing that i see wrong: - Surround that code on a for-next. - Handle other sprites (Currently, you're handling the sprite 9) I can help you with that part of the code if you post the key.
1そうだね
プレイ済み
返信[6]
親投稿
*J.P.*[P]£ aj2003aj
ok i will, but i will warn you some of my code is VERY bad and its not very organised yet, just use the bar and search for "random trees" when you get it, feel free to change anything you want and i haven't changed the bottom screen the way you said you but i still will do that.
0そうだね
プレイ済み
返信[7]
親投稿
*J.P.*[P]£ aj2003aj
if you could reply/finish by 10 my time (or before) that would be great, its 8:30 right now here.
0そうだね
プレイ済み
返信[8]
親投稿
raimondz raimondzz
Ok, I managed to add the trees using "for". However, I saw that you're calling spset on each loop... that function should be used at the start of the game(or screen) to initialize each sprite. I'm going to fix your code and post it tomorrow.
0そうだね
プレイ済み
返信[9]
親投稿
*J.P.*[P]£ aj2003aj
ok thank you, in the mean time i will be making more sprites for the game.
0そうだね
プレイ済み
返信[10]
親投稿
Aaron Krondelo
Yeah, you should start your code something like: FOR I=0 TO N SPSET I,X,X SPHIDE I NEXT
0そうだね
プレイ済み
返信[11]
親投稿
raimondz raimondzz
I have some bad news. I tried to fix your code but there are a lot of stuff that are hard coded, management number that are reused and inconsistent game loop(You have two parts where you process inputs: One before rendering and the other after that). The thing is that the game engine need to be done again. IDK if you want to start over but I can give you the structure to improve your project.
0そうだね
プレイ済み
返信[12]
親投稿
*J.P.*[P]£ aj2003aj
yeah I know, can I just have what you have done so far because I have just found out that I am going somewhere tomorrow and would like to have it as soon as possible
0そうだね
プレイ済み
返信[13]
親投稿
*J.P.*[P]£ aj2003aj
i am going to be completely honest with you. i dont really understand much of what you did. i do however understand that my code was very flawed. so what i need to do is basically set up everything but not in my main code,also i saw a big difference in speed being a ton faster,im confused,but i think i got it..? please, do correct me if im wrong im just trying to learn the correct ways to do it
0そうだね
プレイ済み
返信[14]
親投稿
raimondz raimondzz
The first thing is to setup a proper game loop. As you can see, I created 4 functions: init_, input_, update_ and render_. The game loop call input_, update_, render_ and vsync. That way, each role is separated and the screen is the last thing that is updated on each frame (That is to avoid some unexpected behaviors).
1そうだね
プレイ済み
返信[15]
親投稿
raimondz raimondzz
Next, try to do a object pool to store each actor of the map. This include the chest, tree, persons, etc. Remeber to use SPSET when your object is created and then do other stuff. Also, store each management number you're using on an array to remember the sprites that are in use. To handle behaviors create an array for the entities called behavior$.(In the game loop use "call behavior$[i]")
1そうだね
プレイ済み
返信[16]
親投稿
raimondz raimondzz
Finally, keep your code DRY. This mean Don't Repeat Yourself. Some guidelines: - Try to not abuse of copy paste. If you need to do changes later, you need to change multiple parts of your code. - Encapsulate things that look similar on def. For example, the button validation was long, so I change it for a function that check if the pointer is inside a rectangle.
1そうだね
プレイ済み
返信[17]
親投稿
raimondz raimondzz
- Try to keep your constants on variables or stored with data.
1そうだね
プレイ済み