Omnimaga
Calculator Community => Other Calc-Related Projects and Ideas => TI Z80 => Topic started by: stevon8ter on December 04, 2012, 02:58:01 pm
-
Hi guys, i hope this project will be finished in a while, that would be my first project in axe...
as you can see in the gif the only thing i did for now is: tilemap, sprite, collision detection, and movement
Any ideas?
My code could probably be optimized a lot but idc XD but for the interested people: here it is anyways
EDIT: if someone has a better 8*8 sprite, i'dd appreciate it xD
EDIT 2 : this will be a game where in every level, or room or call it what you want, you will habe to solve a fun puzzle/riddle to continue to the next level (some levels will maybe be like : search something, so that will include multiple rooms, idk yet what to do with it, so gimme ideas ;p )
EDIT 3: Greyscale is for later, now it's b/w only
-
At least this is a great learning project! I finished almost none of my projects (continuity *cough*<_<) but I learned a lot from doing all things. Hope you can get something nice out this though.
-
Yeah i'll try to finish it but i'm not sure if it'll work, and yes sucky graphs and prolly gonna be slow but whatever, like you said, it's great for learning
-
looking nice so far, that is nice and smooth movement :D
-
Thx ;)
I tried to do my best for my first axe program and it's the only way i could figure to do it...
Normal movement: x or y : 1-2lines
Movement+collision : 5lines xD
-
Here are a couple tips I could think of :P
Instead of sticking your tilemap drawing code inside the main loop (since you're not gonna be changing any tiles), you can stick it outside of the loop and StorePic to L3 (assuming you're willing to sacrifice that) and every loop through the main loop, just use RecallPic.
Also, for your collision routines, it's much easier to have a routine called GetT or something that returns the tile that a certain point is in. For instance, with your 8x8 tiles, you'd use:
Lbl GetT
Return {r2/8*12+(r1/8)+GDB0}
And since you're just checking for the empty ones, write another routine
Lbl CheckE
Return GetT(r1,r2)<1
or whatever. I've left it unoptimized for clarity - sometimes, this isn't the best way to do it, but it's good for many cases. That way you can rewrite
X-(getKey(2) and CheckE(X-1,Y) and CheckE(X-1,Y+7)) + (getKey(3) and CheckE(X+8,Y) and CheckE(X+8,Y+7))→X
Of course, there are much better ways to check for collisions, but I'll leave that as an exercise for you :D
-
1) there will be things changing in maps :p
2) yeah ok fair point, but there will also be walkable paths so i'll just have to change the number...
3) hmmm i don't like pixeltest xD
-
Instead of sticking your tilemap drawing code inside the main loop (since you're not gonna be changing any tiles), you can stick it outside of the loop and StorePic to L3 (assuming you're willing to sacrifice that) and every loop through the main loop, just use RecallPic.
Can this also be done with greyscale?
-
you'd have to recall both the front and back buffers, and use other places in RAM/a temporary appvar to do the storing, so it would be annoying but doable.
-
No; With greyscale, you'll likely have to add additional buffers or use L1. Of course, if you have a simple character like yours, you can just AND it off the frame before drawing it again the next frame, and then you won't have to redraw any part of the tilemap.
-
euhm, i don't really get it, could you please give a small example?
(already putted map routine outside main loop and now it's 2/3 times faster, thx ;)
-
So what you can try doing is something like
Main loop
Your code
Pt-On(X,Y,Picwhatever)
DispGraph
Pt-Change(X,Y,Picwhatever)
End loop
That'll make sure your character is erased before the next frame, so you don't have to use RecallPic anymore.
-
So then i'll also won't have to Clear the draw anymore? and also no saving? And how does this display the greyscale? Just when mapping i do DispGraphr ?
EDIT: also, i noticed that MirageOs saves some variables, and that's rather anoying, as you can see in the gif is saves the "door"-open and the sprite face direction :/
How can i do that it doesn't save it?
Also: source added
EDIT: MirageOS settings added in gif (tho i don't want the user has to change something, it should preferably be done inside the program itself)
-
You need to use free RAM and not program variables. (i.e. use the bytes in L1 and don't store new values to your original map, say GDB0 or whatever)
-
This or you can set your variables at the beginning of your code. For example, if the door is open if A is 1, then type 0→A at the start of the program.
-
But every time the prog starts... I set the GDB0 where the door is still closed but it's still open if i restart :/
-
1st sorry for double post
2nd new screenie
3rd ok so i'm gonna do it as following: every level will "teleport" (or will stay in thesame map) to a random event, like: pick up an egg in the map.. when it's done the dialog box (half screen white you see on the gif (only for test now)) will say something and the door will open, ass you can see on the right of map 2 (map 1 directly teleports for testing purpose) and then you can move to the next map... and there you will get another random event...
Now i need you guys to help me with the events xD i can't think of much events... preferably puzzlers/riddles/... but it can be anything... even if it's like a minigame or if it's moving you to some other place to do it... everything you can think of... so any ideas? post them here :D
-
Isn't that a bit too hard with teleporting at random events? I mean, wouldn't that be just trying out what to do and not really thinking?
-
How do you mean sorunome?
-
every level will "teleport" (or will stay in thesame map) to a random event, like: pick up an egg in the map..
And random events can't be thought through so wouldn't it be more like a random game than a puzzler?
-
Oooh , i actually mean, there are in example 100 puzzles, and every level will pick one of that 100 events randomly