News:

The forum will NOT disappear in April 2023 please check this topic!

Main Menu

Ants! (a WIP)

Started by Chris!, March 22, 2011, 06:48:37 AM

Previous topic - Next topic

Chris!

I tried again with putting some more code in. What I basically did was copy and paste the code for the green guy and tried to put info on how to bounce on the walls. I put this in a call routine since the info on getting the joystick info was this way, too. Instead, I got what I did the first time: A bunch of flashing sprites. Can someone help me with the code I posted and help me actually get this working?
All my Odyssey2 projects, now in one place!
http://www.atari2600land.com/odyssey2.html

Chris!

All I want to do is have the tan ant move around inside the board diagonally and if he hits a wall, go the opposite direction. Why can't I do this?! In Basic, I'd have a variable add every frame, and when it reaches a certain point, move the ant an x and a y direction. Then, if the ant goes past one of the four certain points in the grid, have it change course the opposite directions.
All my Odyssey2 projects, now in one place!
http://www.atari2600land.com/odyssey2.html

manopac

Hey Chris,

sorry, I currently don't have any time to look at your code, but in theory what you do in BASIC is what you would do here as well - for every coordinate (X and Y) you have a memory location where you store either $01 or $FF, if the ant hits the limit you want it to reach (-> the grid), you just change the content of the variable, e.g.


so your code could look something like this:
(PSEUDO CODE !!)


mov r0,#25       ; this is an example wherever you store the up/down counter    (either +1 or -1 (FF) -> you have to store it there first !!)
mov r1,#26       ; this is an example wherever you store the coordinate

       mov           a,@r0
       mov           r2,a          ; contains now  +1 / -1 (FF)

       mov           a,@r1
       add            a, r2        ; increase / decrease the position
       mov           @r1,a       ; and write it back

; now see if we need to change the counter as we hit a border
       xrl             a,#1Fh      ; e.g. left border
       jz              ChangeCounter

       mov           a,@r1
       xrl             a,#99       ; e.g. right border
       jz              ChangeCounter

Done
       ret

ChangeCounter
       mov       a,r2        ; get the counter
       cpl         a           ; invert it and add 1    ->    1 -> FF,  FF-> 1
       add        a,1
       mov       @r0,a     ; and write it back
       jmp Done



you get the principle ?   (I didn't try to write optimized code but rather one that is understandable, so don't kill me for bad coding style :-) )
sex, lies, and videopac

Chris!

Thanks to Rene, I have updated the code majorly. It's now a lot smaller than it was, but there are a few problems.
#1 - the visible border flickers.
#2 - The tan ant, which I want to move diagonally, is only going down, which is weird because in his example, it says the object should be going left/right.
#3 - The extreme left/right/up/down points for the tan ant and Stan (the little green guy) need to be changed to fit the border.
So, would any one like to look through the new code and see what's going on?
All my Odyssey2 projects, now in one place!
http://www.atari2600land.com/odyssey2.html

Chris!

OK, I got problem #1 and #3 solved on my own, but still need help on problem #2.
All my Odyssey2 projects, now in one place!
http://www.atari2600land.com/odyssey2.html

Rene_G7400

Quote from: Chris! on September 19, 2011, 09:29:49 PM
OK, I got problem #1 and #3 solved on my own, but still need help on problem #2.

You've got a PM.

Chris!

OK, the ant is bouncing around the screen. I kind of wanted the x axis movement to be the same as the y axis, but at least it's bouncing around the screen now. Check out the official Ants! homepage at http://www.atari2600land.com/ants/ for a list of stuff I need to do next.
All my Odyssey2 projects, now in one place!
http://www.atari2600land.com/odyssey2.html

Janzl

I just tested your game and I must say that I really like the ant-sprite. It's just begs to get animated!
Ne tirez pas sur le administrator!

Chris!

Thanks, I had someone else much more skilled than me at making sprites make that for me. I don't know how I would go about programming animation, or what the extra sprites would look like. You mean the tan ant, right?
All my Odyssey2 projects, now in one place!
http://www.atari2600land.com/odyssey2.html

Chris!

Version 11 is here! Changes are:
Collision detection now works for the tan ant. You only get one life (like in so many other Odyssey2 games) and if you hit the tan ant, press fire to get back to the "GAME SELECT" screen.
The tan ant's speed increases with every twenty black ants you get
I don't know if there was sound in version 9, but I added a sound each time you get an ant.
All my Odyssey2 projects, now in one place!
http://www.atari2600land.com/odyssey2.html

Rafael

Chris, you?re doing a nice job. The game is cool, but I tested it on O2em v 1.81 and it not works, having time I?ll test on the real console, but by my experiences it will not work. Sugestion, try other colors, black backgroud ever looks good! Congrats by now.

Rafael

In time, my high for while:  51  ;)

Chris!

Where can you get v1.81? I think I have 1.18
All my Odyssey2 projects, now in one place!
http://www.atari2600land.com/odyssey2.html

Chris!

Version 12:
* Changed the joystick you use to the left one.
* Pressing fire at the death starts a new game, and doesn't go back to the GAME SELECT screen.
All my Odyssey2 projects, now in one place!
http://www.atari2600land.com/odyssey2.html

Rafael