Omnimaga

Calculator Community => Other Calc-Related Projects and Ideas => TI Z80 => Topic started by: stevon8ter on December 04, 2012, 02:58:01 pm

Title: [AXE] some puzzler thing i guess...?
Post 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
Title: Re: [AXE] some puzzler thing i guess...?
Post by: aeTIos on December 04, 2012, 03:32:28 pm
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.
Title: Re: [AXE] some puzzler thing i guess...?
Post by: stevon8ter on December 04, 2012, 03:35:48 pm
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
Title: Re: [AXE] some puzzler thing i guess...?
Post by: Sorunome on December 04, 2012, 05:27:15 pm
looking nice so far, that is nice and smooth movement :D
Title: Re: [AXE] some puzzler thing i guess...?
Post by: stevon8ter on December 04, 2012, 05:29:59 pm
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
Title: Re: [AXE] some puzzler thing i guess...?
Post by: leafy on December 04, 2012, 06:12:29 pm
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:

Code: [Select]
Lbl GetT
Return {r2/8*12+(r1/8)+GDB0}

And since you're just checking for the empty ones, write another routine

Code: [Select]
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

Code: [Select]
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
Title: Re: [AXE] some puzzler thing i guess...?
Post by: stevon8ter on December 04, 2012, 06:16:56 pm
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
Title: Re: [AXE] some puzzler thing i guess...?
Post by: stevon8ter on December 06, 2012, 10:49:04 am

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?
Title: Re: [AXE] some puzzler thing i guess...?
Post by: shmibs on December 06, 2012, 11:11:56 am
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.
Title: Re: [AXE] some puzzler thing i guess...?
Post by: leafy on December 06, 2012, 11:12:42 am
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.
Title: Re: [AXE] some puzzler thing i guess...?
Post by: stevon8ter on December 06, 2012, 11:14:13 am
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 ;)
Title: Re: [AXE] some puzzler thing i guess...?
Post by: leafy on December 06, 2012, 11:16:48 am
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.
Title: Re: [AXE] some puzzler thing i guess...?
Post by: stevon8ter on December 06, 2012, 11:18:51 am
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)

Title: Re: [AXE] some puzzler thing i guess...?
Post by: leafy on December 06, 2012, 01:25:40 pm
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)
Title: Re: [AXE] some puzzler thing i guess...?
Post by: Matrefeytontias on December 06, 2012, 01:33:19 pm
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.
Title: Re: [AXE] some puzzler thing i guess...?
Post by: stevon8ter on December 06, 2012, 03:36:47 pm
But every time the prog starts... I set the GDB0 where the door is still closed but it's still open if i restart :/
Title: Re: [AXE] some puzzler thing i guess...?
Post by: stevon8ter on December 07, 2012, 12:14:52 pm
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

Title: Re: [AXE] some puzzler thing i guess...?
Post by: Sorunome on December 08, 2012, 02:15:39 am
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?
Title: Re: [AXE] some puzzler thing i guess...?
Post by: stevon8ter on December 08, 2012, 07:42:14 am
How do you mean sorunome?
Title: Re: [AXE] some puzzler thing i guess...?
Post by: Sorunome on December 08, 2012, 12:52:46 pm
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?
Title: Re: [AXE] some puzzler thing i guess...?
Post by: stevon8ter on December 08, 2012, 03:35:45 pm
Oooh , i actually mean, there are in example 100 puzzles, and every level will pick one of that 100 events randomly