Author Topic: [PROJECT] Racer3D: Replay  (Read 30178 times)

0 Members and 2 Guests are viewing this topic.

Offline aeTIos

  • Nonbinary computing specialist
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3915
  • Rating: +184/-32
    • View Profile
    • wank.party
Re: [PROJECT] Racer3D: Replay
« Reply #105 on: November 27, 2010, 01:58:10 pm »
yes

That's a very uncomprehensible reply now, is that a 'yes it works very good scoutDavid, you rule'?
That would pretty much be the same thing, aside from the you rule part ???

It was, of course, a joke. I'm now printing this code and will then implement it in my code.

Now, I still have to divide a 16*16 sprite I have into 4 8*8 sprites to make a loading screen (not needed but it's professional)

USE lordconiupiters 16*16 sprite drawing routine, if you dont use grayscale.
Link: in a minute
I'm not a nerd but I pretend:

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: [PROJECT] Racer3D: Replay
« Reply #106 on: November 27, 2010, 02:00:26 pm »
yes

That's a very uncomprehensible reply now, is that a 'yes it works very good scoutDavid, you rule'?
That would pretty much be the same thing, aside from the you rule part ???

It was, of course, a joke. I'm now printing this code and will then implement it in my code.

Now, I still have to divide a 16*16 sprite I have into 4 8*8 sprites to make a loading screen (not needed but it's professional)

USE lordconiupiters 16*16 sprite drawing routine, if you dont use grayscale.
Link: in a minute

I first need to know what a subroutine is. Also, splitting into 4 8*8 is not hard, if you're suggesting something easier

Offline calcdude84se

  • Needs Motivation
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2272
  • Rating: +78/-13
  • Wondering where their free time went...
    • View Profile
Re: [PROJECT] Racer3D: Replay
« Reply #107 on: November 27, 2010, 02:00:47 pm »
The first thing you need to consider is that the drawing of Pic1 at (0,0) is still there, even after you draw it again.
So (unless you want the old one to remain) you have to do one of two things: (There might be more, these are the two that have occurred to me.)
1) Store a copy of the screen before Pic1 was drawn at all to, say, L3 (the backbuffer). Draw Pic1. When you want to move Pic1, copy the backbuffer to the main buffer. This will effectively remove Pic1 from the screen. You can now draw Pic1 in its new location.
This is the "method" I mentioned ;)
I reread the thread and couldn't find your 'methods', so here is a new idea:
Code: [Select]
:[38107C1010282828->Pic1
:Pt-Change(0,0,Pic1
:DispGraph
:Repeat getKey(3)
:ClrDraw
:Pt-Change(0,10,Pic1
:DispGraph
:End

I added ClrDraw, that could work, right?
That should work, but I don't think it does what you originally intended. When you run it, what you will see is Pic1 appearing quickly once then disappearing at (0,0), and then it will display at (0,10), 10 pixels down, until you press right.
"People think computers will keep them from making mistakes. They're wrong. With computers you make mistakes faster."
-Adam Osborne
Spoiler For "PartesOS links":
I'll put it online when it does something.

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: [PROJECT] Racer3D: Replay
« Reply #108 on: November 27, 2010, 02:03:03 pm »
Quote
That should work, but I don't think it does what you originally intended. When you run it, what you will see is Pic1 appearing quickly once then disappearing at (0,0), and then it will display at (0,10), 10 pixels down, until you press right.

Yeah, I know, when I read the code, I imagine that happening, even without running it, since I haven't tested it yet.

The problem is this is probably the easier way of doing it without having to learn something new.

All that is here:

Code: [Select]
:[38107C1010282828->Pic1
:Pt-Change(0,0,Pic1
:DispGraph
:Repeat getKey(3)
:ClrDraw
:Pt-Change(0,10,Pic1
:DispGraph
:End

I already knew how to do, so I don't need to learn nothing new, which means I don't have to forget about anything I already knew!

Offline calcdude84se

  • Needs Motivation
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2272
  • Rating: +78/-13
  • Wondering where their free time went...
    • View Profile
Re: [PROJECT] Racer3D: Replay
« Reply #109 on: November 27, 2010, 02:23:45 pm »
My confusion is that I thought you wanted it to start at (0,0) and only move to (10,0) after you press right. I thought that, after that, you wanted it to continue to move right every time you pressed right.
"People think computers will keep them from making mistakes. They're wrong. With computers you make mistakes faster."
-Adam Osborne
Spoiler For "PartesOS links":
I'll put it online when it does something.

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: [PROJECT] Racer3D: Replay
« Reply #110 on: November 27, 2010, 02:33:30 pm »
My confusion is that I thought you wanted it to start at (0,0) and only move to (10,0) after you press right. I thought that, after that, you wanted it to continue to move right every time you pressed right.

What I want is this:

Pic1 at (0,0)
User presses Right
Pic1 at (10,0)
User presses Right
Pic1 at (20,0)
User presses Right
Pic1 at (30,0)
User presses Right
....
Pic1 at (MAX,0)
Pic1 goes back to (0,0)

Code: [Select]
:[38107C1010282828->Pic1
:10->A
:Pt-Change(0,0,Pic1
:DispGraph
:Repeat getKey(3)
:ClrDraw
:Pt-Change(0,A,Pic1
:A+10->A
:DispGraph
:If A>=MAX
:0->A
:End
:End


I think the order of the code is wrong, but something like that would work?

by the way, what is the max?

Offline calcdude84se

  • Needs Motivation
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2272
  • Rating: +78/-13
  • Wondering where their free time went...
    • View Profile
Re: [PROJECT] Racer3D: Replay
« Reply #111 on: November 27, 2010, 02:41:26 pm »
The max is 80, I think. If it's at 90, then part of the sprite is cut off.
However, the condition for the loop won't work. "Repeat getKey(3)" means that it does the loop until you press right. That means that, when you press right, the sprite doesn't move, but the program exits ;)
Edit: 1400th post! :D
« Last Edit: November 27, 2010, 02:42:18 pm by calcdude84se »
"People think computers will keep them from making mistakes. They're wrong. With computers you make mistakes faster."
-Adam Osborne
Spoiler For "PartesOS links":
I'll put it online when it does something.

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: [PROJECT] Racer3D: Replay
« Reply #112 on: November 27, 2010, 02:43:19 pm »
Code: [Select]
:[38107C1010282828->Pic1
:10->A
:Lbl 0
:Pt-Change(0,0,Pic1
:DispGraph
:Repeat getKey->Z
:End
:If Z!=3
:Goto 0
:End
:ClrDraw
:Pt-Change(0,A,Pic1
:A+10->A
:DispGraph
:If A>79
:0->A
:End
:End

This will only allow one 'right click', I'm afraid :S

Offline calcdude84se

  • Needs Motivation
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2272
  • Rating: +78/-13
  • Wondering where their free time went...
    • View Profile
Re: [PROJECT] Racer3D: Replay
« Reply #113 on: November 27, 2010, 02:51:34 pm »
Now it repeats until you press any key, and you're no longer using direct input, which means you can only read one keypress at a time.
For the condition of the Repeat, you should choose a key that quits the program and use that as the condition of the Repeat loop. ;)
"People think computers will keep them from making mistakes. They're wrong. With computers you make mistakes faster."
-Adam Osborne
Spoiler For "PartesOS links":
I'll put it online when it does something.

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: [PROJECT] Racer3D: Replay
« Reply #114 on: November 27, 2010, 04:44:42 pm »
Code: [Select]
:[38107C1010282828->Pic1
:10->A
:Lbl 0
:Pt-Change(0,0,Pic1
:DispGraph
:Repeat getKey(15)
:Goto 2
:End
:Lbl 2
:Repeat getKey->Z
:If Z!=3
:Goto 0
:End
:If Z=3
:ClrDraw
:Pt-Change(0,10,Pic1
:End

Or should I do something like:

Code: [Select]
:Repeat getKey->Z
:End
:While Z!=15
:If Z=3
:ClrDraw
:Pt-Change(0,10,Pic1
:End

The second one looks better to me :)

Offline calcdude84se

  • Needs Motivation
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2272
  • Rating: +78/-13
  • Wondering where their free time went...
    • View Profile
Re: [PROJECT] Racer3D: Replay
« Reply #115 on: November 27, 2010, 05:49:17 pm »
The first one is needlessly complicated and doesn't work anyway, so let's focus on the second :)
The main problem in the second one is that you're only checking for the key once. (The Repeat loop just waits for a key to be pressed, then continues, the key stored to Z)
Note: I'll continue as if you've fixed it to check for a key each time around the While loop.
You can still use getKey(15) and getKey(3); you don't have to use just regular getKey.
Also, you're missing an End. (You have a While and an If, but only one End).
You'll want a DispGraph in there too (in the If statement)
Also, you're still drawing the sprite at (0,10), not (10,0). Axe takes coordinates as X,Y in the Pt-( commands, not the Y,X that BASIC uses.
Note: I'll continue as if you've fixed these problems too.
The code's very close to perfect, but you still have a problem: each time you press right, it draws the sprite at (10,0). Never at (20,0) etc., but always at (10,0).
You'll need to use another variable to keep track of Pic1's current X position, and add 10 to it each time. As you've stated, if it goes too far right, its X position should be reset to 0.

Okay, so I'm somewhat forcing you along (Sorry x.x), but does this help?
"People think computers will keep them from making mistakes. They're wrong. With computers you make mistakes faster."
-Adam Osborne
Spoiler For "PartesOS links":
I'll put it online when it does something.

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: [PROJECT] Racer3D: Replay
« Reply #116 on: November 27, 2010, 06:11:08 pm »
Okay, Calcdude, I found a working way (using my calculator, I can't simulate the compiler with my mind yet, like I do with Python).


A screenie and a .8xp is attached for you to see, there is 1 problem, that you can easily see in the GIF.

Code:
Code: [Select]
:.PICTEST
:[38107C1010282828→Pic1
:0→A
:Lbl 0
:ClrDraw
:ClrHome
:Pt-Change(0,0,Pic1
:DispGraph
:Lbl 1
:If A>99
:0→A
:ClrDraw
:Pt-Change(A,0,Pic1
:DispGraph
:End
:If A<0
:90→A
:ClrDraw
:Pt-Change(A,0,Pic1
:DispGraph
:End
:Repeat getKey→Z
:End
:Repeat getKey(15)
:If Z=3
:ClrDraw
:A+10→A
:Pt-Change(A,0,Pic1
:DispGraph
:Goto 1
:End
:If Z=2
:ClrDraw
:A-10→A
:Pt-Change(A,0,Pic1
:DispGraph
:Goto 1
:End
:End
:Lbl 2

It was supposed to go to (90,0) when you press left and Pic1 is at (0,0).

Any idea how to fix this?

Offline Runer112

  • Moderator
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: [PROJECT] Racer3D: Replay
« Reply #117 on: November 27, 2010, 07:09:34 pm »
In Axe, just about all mathematics and comparsions are, by default, unsigned. And in an unsigned system, you can never have a value less than zero. What you need is a signed comparison.

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: [PROJECT] Racer3D: Replay
« Reply #118 on: November 27, 2010, 07:12:09 pm »
In Axe, just about all mathematics and comparsions are, by default, unsigned. And in an unsigned system, you can never have a value less than zero. What you need is a signed comparison.

Code: [Select]
:If -B>0
#DO CODE
:End

You mean this?

Offline nemo

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1203
  • Rating: +95/-11
    • View Profile
Re: [PROJECT] Racer3D: Replay
« Reply #119 on: November 27, 2010, 07:15:57 pm »
he means >> and <<. the signed comparisons.