Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Munchor

Pages: 1 ... 96 97 [98] 99 100 ... 424
1456
TI Z80 / Re: AXLE - 2011 Axe Platformer Contest
« on: May 20, 2011, 10:09:13 pm »
I've seen what people are planning for the contest, and I'm impressed, especially by all the physics-based games. My game (for the most part) has no physics, but I intend to make up for that with artwork and level design. Good luck everybody! :)

I'm impressed by your last screenshot too, that's looking really good :D

1457
Axe / Re: Physics Introduction Axe Tutorial
« on: May 20, 2011, 10:00:16 pm »
Thanks a lot for the feedback Builderboy and thanks for the acceleration/velocity difference explanation. I shall change it :)

1458
Axe / Re: Physics Introduction Axe Tutorial
« on: May 20, 2011, 08:18:59 pm »
This is a very nice tutorial for the basics of physics in games.  Very well done, Scout.  I'm sure that this thread will be pointed tofor inexperienced people to learn from. :)

Yeah I really hope so as it was also added to the Tutorials List. Thanks :)

1459
ASM / Re: Please Help
« on: May 20, 2011, 08:15:04 pm »
Nice. Ok, another question. Is there a (_DeleteMem) command, like there is an (_InsertMem) command? Or if not, is there a work around?

Also, is there a two-byte subtract command?

As I said earlier on IRC, yes there is.

You can find a list of all BCalls here.

1460
Axe / Re: Axe Bullets
« on: May 20, 2011, 08:00:16 pm »
well, you can use velocities to determine how they'll move ;) that's a simple way, though in Uncharted TI I do the dirty hack and just move it by one pixel per frame, since it's fast and small in code, and bullets are insanely fast anyways :)

Yes so how do you make them for both sides? Or you're not really using Horizontals, etc.?

1461
Axe / Axe Bullets
« on: May 20, 2011, 07:41:12 pm »
First of all, I shall explain why this isn't in the Axe Q&A topic. It's because this is something harder and that I need an explanation but not just for me, I think everybody can benefit if anyone can teach me this.

Code: [Select]
.A
0->Y->B->X->A
ClrDraw^^r
[38283B123C501028]->Pic1A
[1C14DC483C0A0814]->Pic1B

Repeat getKey(15)
  ClrDraw
  Pic1A->O 

  If getKey(3)
    Pic1A->O
  End

  If getKey(2)
    Pic1B->O
  End

  Pt-On(X/256,Y/256,O
  DispGraph
End

I had this code, and I wanted to implement bullets. This is what I used to do:

Code: [Select]
If getKey(54)
  Pxl-On(X+8,Y+2)^r
End
.CODE
Horizontal -^r

This is quite a dirty hack because this way bullets can only go to the right.

However, let's say one needs to make bullets for both sides. What code have you guys written for this before?

(This is more a sort of a discussion)

1462
Axe / Re: Physics Introduction Axe Tutorial
« on: May 20, 2011, 06:35:34 pm »
Awesome job!  This will be very helpful for people new to learning 8.8-based physics :)

Thanks a lot Ashbad, I actually just used some of the code I posted myself, funny thing :)

1463
TI Z80 / Re: [2011 Axe Entry] Uncharted TI
« on: May 20, 2011, 06:26:42 pm »
more fun with rockets:  (I fixed many bugs with the bullet activation and explosions, and now napalm spreads fire fairly evenly over the field)



Ashbad, that is looking really epic, nice job!

1464
tiDE / Re: Stetson Progress
« on: May 20, 2011, 05:36:05 pm »
Quote from: Scout
Very well SirCmpwn, I'd also like a few other things like speed of emulation (100%, 200%, 50%, ...).

Can't wait for a beta release or a RC.
Emulation speed modding is planned, and a beta will probably be sooner than you think.

So how's this coming along?

1465
Axe / Re: Specific Tutorials List (Axe)
« on: May 20, 2011, 04:21:56 pm »
Done.  ;)

Thanks never thought it'd be so fast :)

1466
Axe / Re: Specific Tutorials List (Axe)
« on: May 20, 2011, 03:52:51 pm »
I wrote a new tutorial today, will it be updated on this list? Thanks :)

1467
Axe / Re: Axe Q&A
« on: May 20, 2011, 12:24:46 pm »
I have a huge problem in Axe, I can't avoid that my sprites go through walls or even the floor when they are in fast speeds. Is there any way to avoid this?

1468
TI Z80 / Re: My explosive contest entry
« on: May 20, 2011, 11:55:36 am »


Epic.

1469
Axe / Re: Axe Q&A
« on: May 20, 2011, 11:51:36 am »
I have some little code, but it runs slow like hell, I'd like to know your opinions on why:

Code: [Select]
.C
512→Y
12288→X
0→A→B
Repeat getKey(15)
  ClrDraw
  Rect(0,0,96,64)
  RectI(3,3,90,58)
  Line(0,30,40,30)
  Rect(X/256,Y/256,8,8)

  If getKey(2)
    A-16→A
  End

  If getKey(3)
    A+16→A
  End
 
  X+A→X
  Y+B→Y

  If (pxl-Test(X/256+8,Y/256))
    0→A
  End

  If (pxl-Test(X/256-1,Y/256))
    0→A
  End
 
  If (pxl-Test(X/256,Y/256+8))
    0→B
  End

  !If (pxl-Test(X/256,Y/256+8))
    B+4→B
  End
 
  If getKey(4)
    B-16→B
  End
 
  DispGraph
End

I know it can be optimized like having 'or's in the first two pixel tests, but would that enchance its speed that much?

I have a theory, dividing variables by 256 is what's making it slow. Am I right?

I just tried this and it was much faster, I'm wondering why:

Code: [Select]
.C
512→Y
12288→X
0→A→B
Repeat getKey(15)
  ClrDraw
  Rect(0,0,96,64)
  RectI(3,3,90,58)
  Line(0,30,40,30)
  Rect(X/256,Y/256,8,8)

  If getKey(2)
    A-16→A
  End

  If getKey(3)
    A+16→A
  End
 
  X+A→X
  Y+B→Y

  If (pxl-Test(X/256+8,Y/256)) or (pxl-Test(X/256-1,Y/256))
    0→A
  End
 
  If (pxl-Test(X/256,Y/256+8))
    0→B
  End

  !If (pxl-Test(X/256,Y/256+8))
    B+4→B
  End
 
  If getKey(4)
    B-16→B
  End
 
  DispGraph
End

1470
Axe / Physics Introduction Axe Tutorial
« on: May 20, 2011, 11:31:21 am »
One of the things that I could never understand in Axe was acceleration/velocity and physics. And although everybody kept saying Builderboy's tutorials were the best for the job, I thought they were too advanced for me when I read them. When I read Axe Physics tutorials I was confused. Of course the tutorials were great, but just not for a true beginner.

All of my games were always non-realistic, without acceleration and using simple code and lots of dirty hacks. The other I finally understood acceleration and physics, and decided to write this very simple tutorial for the job.

Also, you may note most of the code in this tutorial is not optimized so you can understand it better.

Let's start with displaying an image and gravity:

Code: [Select]
.Y Position of the block
0→Y
.X Position of the block
44→X

Repeat getKey(15)
  ClrDraw

  .Draw a line at the bottom
  Line(0,63,95,63)

  .Draw our main image, a square of width=8
  Rect(X,Y,8,8

  !If (pxl-Test(X+3,Y+8))
    Y+1→Y
  End

  DispGraph
End

Irrealistic Gravity

This code draws a square and it will fall down vertically (gravity) until it hits the line. However, this code is not realistic. If you're surprised, don't worry, it's easy to get.

When an object falls down from, let's say, the top of a building, it will fall down vertically and it's speed will increase. So, the highest speed reached is higher if you throw it from a higher building. Newton calls this speed 'gravitational acceleration'.

So how to make this realistic? We will need a variable for the acceleration and a variable for the Y position of the sprite, so we don't change the Y position of the sprite directly, but add to its speed.

Now the next code uses the Fixed Point or as I prefer the x256 mode. We multiply the X and Y positions of stuff by 256 to get more precision. So if in the code I write X+1→X I'm adding 1/256 of a pixel to X. If you ever had the need to move a sprite/block to the right but not so fast as X+1→X then you can use the x256 mode. It's very important in Axe Physics.

To display sprites we write lines such as Pt-On(X/256,Y/256,PTR. So when we display them, we divide their positions by 256 to fit on the graphscreen. Functions like pxl-Test also require us to divide variables by 256 (if we're using the x256 mode).

Here's how it works to check if a pixel is black:

Code: [Select]
.X And Y Positions as pxl-Test( arguments
If (pxl-Test(X/256,Y/256))
  .CODE
End

Now here's some code that you can use as an example of acceleration and the x256 mode.

Code: [Select]
.Y Position of the block
0→Y
.Y Acceleration of the block
0→B
.X Position of the block
0→X

Repeat getKey(15)
  ClrDraw

  .Draw a line at the bottom
  Line(0,63,95,63)

  .Draw our main image, a square of width=8
  Rect(X/256,Y/256,8,8)

  .If nothing beneath block, make block go down
  !If (pxl-Test(X/256+3,Y/256+8))
    B+4→B
  End

  .If something beneath block, make block stop
  If (pxl-Test(X/256+3,Y/256+8))
    0→B
  End

  Y+B→Y

  DispGraph
End

More realistic gravity

As you can see, the speed of the block in this code gets higher and higher. However, if it hits the line, it immediately stops.

Now there's a very important concept you need to understand. Vectors and Components of Vectors. A movement can be represented by a vector, here is an example:



The ball is moving right because there's a force in the direction where it is going.

Now let's imagine a ball being thrown in the air:



The ball is not moving to a single direction, but both up and right. The vector has a force, but it can be split in two forces, the X force and Y force. The Y force is the vertical component of the force and the X component is the horizontal component of the force.

So, the last image could be actually represented this way:



When we add Fx to Fy we have the F force in the previous image.

In Axe, to make acceleration work like in real lifes, we have 4 variables:

Code: [Select]
.X Position
0→X
.Y Position
0→Y
.X Acceleration
0→A
.Y Acceleration
0→B
Repeat getKey(15)
  ClrDraw
 
  .CODE
 
  .Sum acceleration to the positions of the sprites
  X+A→X
  Y+B→Y 
 
  .MORE CODE
 
End

This will make sprites moving much more realistic.

Yet again, note this tutorial is just to let you more comfortable with some concepts and acceleration and Physics in Axe. I recommend you to move on to more advanced tutorials such as Builderboy's and others which can be found in axe.omnimaga.org.

Thanks
I'd like to thank Builderboy for inspiring me to learn Physics by making awesome games.

Thanks squidgetx for a tutorial you wrote on Omnimaga.

Thanks all Omnimaga members for support!

Attached is a PDF version of this tutorial.

Pages: 1 ... 96 97 [98] 99 100 ... 424