Author Topic: Few Questions..  (Read 2411 times)

0 Members and 1 Guest are viewing this topic.

Offline Yeong

  • Not a bridge
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3739
  • Rating: +278/-12
  • Survivor of Apocalypse
    • View Profile
Few Questions..
« on: September 22, 2011, 10:44:52 pm »
I wanna know few things:
1. Can I import custom-named list from OS?
2. I see there's grp Token. What is the use of it?
3. How does enemy's AI in platform games work?
Sig wipe!

Offline LincolnB

  • Check It Out Now
  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1115
  • Rating: +125/-4
  • By Hackers For Hackers
    • View Profile
Re: Few Questions..
« Reply #1 on: September 22, 2011, 10:55:45 pm »
I wanna know few things:
1. Can I import custom-named list from OS?
2. I see there's grp Token. What is the use of it?
3. How does enemy's AI in platform games work?

I can help you on the 3rd one. Basically, you have a set of rules governing your enemy. More rules usually means more advanced artifical intelligence.

you could have a data structure (read: array) set up for each enemy, and then iterate through each data structure for each cycle of the main game loop, and apply some rules based on the data that exists for the enemies.

For example:

Data Structure:
Zeros(100)->GDB0
.+0=type of enemy
.+1=animation
.+2=X coordinate
.+4=Y coordinate
.+6=X velocity
.+8=Y velocity

You can have up to ten enemies in this example, and you'll have to load up code for each enemy by hand, or write a program to do it for you, or make it part of your tilemapper.

After you have the data structure, you would have as a part of your main game loop:

Code: [Select]

For(A,0,9)

.add XVelo to XCo and YVelo to YCo
{A*10+GDB0+6}r+{A*10+GDB0+2)r->{A*10+GDB0+2}r
{A*10+GDB0+8}r+{A*10+GDB0+4)r->{A*10+GDB0+4}r

If {A*10+GDB0}=0
.do some stuff based on the ruleset
.for what to do for type 0 enemies
ElseIf the type = 1
.do some stuff based on the ruleset
.for what to do for type 1 enemies
ElseIf the type = 2
.et cetera
Else
.you get the idea
End

End


Where r is the little superscript r thing.

And then, you would just have a display function that displayed the enemies at their X and Y coordinates with whatever animation crap you wanted.


Some example rules you can implement (all implemented in the form of if statements)

If enemy touches player
decrease player's health

If enemy is to the left of player
move enemy to the right

If enemy is to the right of player
move enemy to the left

If the enemy hits an object
make it go in the opposite direction


Et cetera et cetera et cetera.
Completed Projects:
   >> Spacky Emprise   >> Spacky 2 - Beta   >> Fantastic Sam
   >> An Exercise In Futility   >> GeoCore

My Current Projects:

Projects in Development:
In Medias Res - Contest Entry

Talk to me if you need help with Axe coding.


Spoiler For Bragging Rights:
Not much yet, hopefully this section will grow soon with time (and more contests)



Offline Darl181

  • «Yo buddy, you still alive?»
  • CoT Emeritus
  • LV12 Extreme Poster (Next: 5000)
  • *
  • Posts: 3408
  • Rating: +305/-13
  • VGhlIEdhbWU=
    • View Profile
    • darl181.webuda.com
Re: Few Questions..
« Reply #2 on: September 22, 2011, 11:09:12 pm »
Quote from: Axe documentation: Reading From Archive
The Maximum size file you can read from is 48kb but I don't think any variable gets that
big anyway except for groups maybe.
[...]
I don't even know how groups are formatted to be honest, you may want to
check out the TI-Developer's Guide for more information on variable formatting.
So um..good luck with that :P

As for platformer AI, I was working on that a bit.  It's not very complex/complete but blarg.
http://ourl.ca/12242

Vy'o'us pleorsdti thl'e gjaemue