Jump to content
IGNORED

WIP: Ants


Recommended Posts

Odd. If I don't use the random function and put

ant2_ypos=100<<16

in place of what I want to put in, and lose the '>>16' part of line 83:

RSETOBJ(antontable,R_sprite_y,ant2_ypos<<16)

it puts the ant on the table. If I try the random function the ant y position goes to 0.

Link to comment
Share on other sites

Odd. If I don't use the random function and put

ant2_ypos=100<<16

in place of what I want to put in, and lose the '>>16' part of line 83:

RSETOBJ(antontable,R_sprite_y,ant2_ypos<<16)

it puts the ant on the table. If I try the random function the ant y position goes to 0.

 

It doesn't go to zero, it goes to something very close to and to all intents and purposes zero, as you are giving it a sub-pixel value of almost zero without the shift.

 

I already showed you how to place the ant on screen at between y=60 and y=160 in this post: http://atariage.com/forums/topic/247930-wip-ants/?do=findComment&comment=3425220

 

That it only stays put for one frame would be down to something else you are or were doing in the program.

  • Like 1
Link to comment
Share on other sites

Hi,

 

I tried putting this code in:

ant2_ypos=(int(RND*160) << 16)

and got this:

"invalid operands of types 'double' and 'int' to binary 'operator<<' Build error!"

 

Int doesn't work like Atari Basic, it's not a function. It's simply an operator that tells the compiler to change variable types. So what you'd want to do instead is something like: ant2_ypos=(((int)(RND*160))<<16).

 

(RND*160) will give you a "random" number. Then (int)(RND*160) will cast it to an integer (i.e. chop the decimal points off). Then ((int)(RND*160))<<16 will shift it left by 16 binary places.

 

 

 

Hope this helps, and if you find that your "random" numbers aren't so random then check out this topic.

  • Like 3
Link to comment
Share on other sites

I tried putting this code in:

ant2_ypos=(int(RND*160) << 16)

and got this:

"invalid operands of types 'double' and 'int' to binary 'operator<<' Build error!"

this goes away if instead of (int( you use ((int)(

 

ill grab this and look at it

 

Odd. If I don't use the random function and put

ant2_ypos=100<<16

in place of what I want to put in, and lose the '>>16' part of line 83:

RSETOBJ(antontable,R_sprite_y,ant2_ypos<<16)

it puts the ant on the table. If I try the random function the ant y position goes to 0.

 

 

well i have obtained the file, there are multiple possible causes for your issues, im not sure specifying 2 text / particle objects is helping but it seems to run none the less

for the ant moving along the screen why dont you just use xadd rather than adding 2<<16 to x? then get it to kill the object when it leaves the screen

 

also rset / get obj is pretty much obsolete, use rlist, its much easier to read and use.

 

 

i will look at the code and see if i can get it to do something a little useful, all i ask is that you study the code carefully and learn from it and continue the game

 

i can add comments if you would like this

i think you may be over thinking it for what you have and want to do

Link to comment
Share on other sites

 

This will work, but it's a huge resource hog (and if they both have the same GFXbase, pointless)

both identical, as you say, much useless!

 

---

 

delete partlist.s from your project folder this is broken, it is auto included from the rb+ include folder and is not needed locally to your project

it creates a big black square when i incorporated a load of optimisations that took me quite a while to figure out what had happened as a result the program is 99$ remarked out now lol so im am going to start again now that i have fixed that

 

i would recommend you use my object list editor here: http://atariage.com/forums/topic/233057-raptor-list-designer/?p=3419456 it will ease the process and creates of assigning objects to variables etc. i know you haven't been using this because your dividing your ant x/y size by 2 in an object which causd an error when i attempted to import that into the editor

 

you don't actually need to do that, just scale the ant by 50% but whatever

Link to comment
Share on other sites

 

i have fixed your broken program, please take note of everything within.

 

please try not to nest your subroutines like you did there, it caused brokenness that took a very long time to work out, i think i must have spent over 8 hours fanning about with it to make to work properly

 

most of you issues were your objects / object list specifications (the ant object isn't the right height it doesn't divide by 6, each frame should be the same)

 

it would probably be best if you had a subroutine to do the title screen then jump to another for the game, not have one loop and try and cram all the conditions to deal with everything into the main loop

 

remember you can have loops in subroutines

 

 

i killed off the antontable object as it was pretty pointless, instead i am reusing the itsanant object but scaled it by 50 %, this caused brokenness with your undersized ant object which has gone away, but i have not changed the object size, if you do make sure you update the height in the object list

 

just a note, you don't need to know the gfx size and location until you want to control individual frames, something which I believe is beyond the scope of this particular project at the moment, don't over complicate things for yourself to start with, make something that is small and works first, add improvements later when you are more used to it

 

full working + extras project is attached, most of your code has been remarked out because it was pretty much useless ;)

ant.rar

Edited by omf
  • Like 3
Link to comment
Share on other sites

OK, thanks a million! I didn't know there was a sprite necessity for its height to be a multiple of 6. Yeah, I figured the antontable thing was pointless too, I just did it so I could get used to Jaguar programming. I am wondering though, if there is a way to reset Virtual Jaguar, as it seems cumbersome to turn it on and off again every time I want to start anew. I know the Jaguar itself doesn't have a reset button, but you'd think they could add one for an emulator. I wish there was an inexpensive way to test on a real Jaguar (like an Jaguar Everdrive or something.)

Link to comment
Share on other sites

OK, thanks a million! I didn't know there was a sprite necessity for its height to be a multiple of 6. Yeah, I figured the antontable thing was pointless too, I just did it so I could get used to Jaguar programming. I am wondering though, if there is a way to reset Virtual Jaguar, as it seems cumbersome to turn it on and off again every time I want to start anew. I know the Jaguar itself doesn't have a reset button, but you'd think they could add one for an emulator. I wish there was an inexpensive way to test on a real Jaguar (like an Jaguar Everdrive or something.)

you can modify build.bat ti kill vj before starting, thats what i do

Link to comment
Share on other sites

OK, I'm having trouble once again. This time it's the movement of the ant in the main game. Why won't this work?

            framecounter=framecounter+1

        if (framecounter>60) then

            framecounter=0

            antdir=((int)(rnd * 3))

        endif

        

        if antdir=0 then

        rlist [itsanant].y = (rlist [itsanant].y - (2 << 16))

            endif

            

        if antdir=1 then        

        rlist [itsanant].y = (rlist [itsanant].y + (2 << 16))

            endif            

        

        if antdir=2 then

        rlist [itsanant].flip = R_is_flipped        

        rlist [itsanant].x = (rlist [itsanant].x - (2 << 16))

            endif

            

        if antdir=3 then

        rlist [itsanant].flip = R_is_normal    

        rlist [itsanant].x = (rlist [itsanant].x + (2 << 16))

            endif  

ants2.bas

Edited by atari2600land
Link to comment
Share on other sites

 

OK, I'm having trouble once again. This time it's the movement of the ant in the main game. Why won't this work?

            framecounter=framecounter+1

        if (framecounter>60) then

            framecounter=0

            antdir=((int)(rnd * 3))

        endif

        

        if antdir=0 then

        rlist [itsanant].y = (rlist [itsanant].y - (2 << 16))

            endif

            

        if antdir=1 then        

        rlist [itsanant].y = (rlist [itsanant].y + (2 << 16))

            endif            

        

        if antdir=2 then

        rlist [itsanant].flip = R_is_flipped        

        rlist [itsanant].x = (rlist [itsanant].x - (2 << 16))

            endif

            

        if antdir=3 then

        rlist [itsanant].flip = R_is_normal    

        rlist [itsanant].x = (rlist [itsanant].x + (2 << 16))

            endif  

you have not set antdir to anything, you i would have thought need to set this by adding directions to the joypad if statement

 

use

IF (pad1 BAND PAD_B and gamestartanim=0) THEN

gamestartanim=1

randomize (randomnumber) 'get a random number and use it as a seed to rnd does something useful when called

elseif (pad1 BAND PAD_UP) THEN

antdir=0

elseif (pad1 BAND PAD_DOWN) THEN

antdir=1

elseif (pad1 BAND PAD_LEFT) THEN

antdir=2

elseif (pad1 BAND PAD_RIGHT) THEN

antdir=3

END IF

 

and see if your ant moves with joypad control

antdir needs to be set to a value before those checks or it will always equal its initial value which is probably 0

 

 

the bat file i was speaking of is attached, replace your bat file with it

bat.rar

Link to comment
Share on other sites

 

OK, I'm having trouble once again. This time it's the movement of the ant in the main game. Why won't this work?

 

as it looks like i will be helping for the foreseeable future, i couldn't work with the code you had so i have re written it pretty much totally into something that makes sense to me

 

i have fixed your broken object images and cut out useless white space

 

 

you may have to rethink your pissed image, being that angle. the program how it is is moving the ant within a rectangle, as the table is not a rectangle it goes over the table top often, i have not changed the ant positioning. but then you need to have something to do i dont want to be writing all of your game for you

 

 

also try and stay clear from other bad habit coding picked up from batari basic or whatever, you had far far too many variables, very hard to keep track of, fear not, these useless things have been vanquished...

how you chose to write the game to begin with was in my opinion did not make much sence, it may have to you, but then again it may of added to your issues trying to get it to work, see this complete new project

 

replaced u235 sound / joypad functionality with zerosquare's offering to prevent brokenness for when and if you get to the point of adding sound

ant.rar

  • Like 3
Link to comment
Share on other sites

I found a workaround. I just put RPRINT " ", although that is probably not a good way to do it. RPRINTINT, by the way, does not work on my computer. It gives an error message. Anyway, I redid the table and stuff and here is "our" game so far. I hesitate to say "my" because omf did most of the work here. The whole point of this little thing is to see if I could do this, but it is becoming increasingly clearer I should just give up because it's too hard. I want to add a finger in to squish the ants with. By the way, real ants started appearing on the kitchen counter, so perhaps it's a sign I should continue?

 

ants3.zip

Edited by atari2600land
  • Like 2
Link to comment
Share on other sites

The whole point of this little thing is to see if I could do this, but it is becoming increasingly clearer I should just give up because it's too hard.

 

A shame you think that way but understandable. Probably would have been best to read a lot more before you began, play around with lots of the examples before thinking about your own project (to get a better understanding of how things work and the possibilities) and struggle more before asking questions (but that might have just been too boring/frustrating and maybe you'd have done nothing).

 

Depends if you made this just to make it and that would be that, or if you intended to continue making other things. If you just want to make the ants game and nothing more, I'd say go back to your own original program and work on it yourself, taking a look at what omf did if you get really stuck if you think it'd help.

Link to comment
Share on other sites

Case in point: sound. I made two RAW files for the title screen, but cannot play them. I put them in my assets file, but can't get them to play at all. I looked at the example files that use sound and used code, but I can't get it to play anything. I put them in the rapu235 file and they still won't play.

Edited by atari2600land
Link to comment
Share on other sites

How do I erase text? I got the text back on the title screen but when I go to the main game and put it in another place, the place it says on the title screen is still there. Why?

cls

 

 

Case in point: sound. I made two RAW files for the title screen, but cannot play them. I put them in my assets file, but can't get them to play at all. I looked at the example files that use sound and used code, but I can't get it to play anything. I put them in the rapu235 file and they still won't play.

 

 

i changed it from u235 to zeros player because u235 doesntplay the sound all the time in rb+

 

ill paste code shortly to play samples, you dont need raw tgough, wav or mp3 is fine, it will be reencoded to the right format

 

 

--------------

 

RPRINTINT only prints integers not text

Link to comment
Share on other sites

assets:

ABS,SFX_EXPLOSION,sfx_mlaw9233,ASSETS\SFX\Explosion.wav

 

main program:

SNDZEROPLAY(sound_channel, strptr(SFX_EXPLOSION), (strptr(SFX_EXPLOSION_end)-strptr(SFX_EXPLOSION)+3) and 0xfffffffc, 46168/9233, Zero_Audio_8bit_muLaw)

 

sound_channel is 1 to 4

SFX_EXPLOSION is your sound name

 

if you dim sound_shannel as integer or UBYTE you can do something like this:

 

sub play_explosion_sfx()
sound_channel ++
if sound_channel > 4 then sound_channel = 1

'play explosion
'SNDZEROPLAY chan, start_address , len , frequency , params
SNDZEROPLAY(sound_channel, strptr(SFX_EXPLOSION), (strptr(SFX_EXPLOSION_end)-strptr(SFX_EXPLOSION)+3) and 0xfffffffc, 46168/9233, Zero_Audio_8bit_muLaw)
'|Zero_Audio_Looping
end sub

 

 

then you can just do call play_explosion_sfx() and it will play your sound from the next sound channel

Link to comment
Share on other sites

I found a workaround. I just put RPRINT " ", although that is probably not a good way to do it. RPRINTINT, by the way, does not work on my computer. It gives an error message. Anyway, I redid the table and stuff and here is "our" game so far. I hesitate to say "my" because omf did most of the work here. The whole point of this little thing is to see if I could do this, but it is becoming increasingly clearer I should just give up because it's too hard. I want to add a finger in to squish the ants with. By the way, real ants started appearing on the kitchen counter, so perhaps it's a sign I should continue?

 

its not that hard, you just started off with a very confusing program format which did not help your debugging.

 

just stick which what i have helped you with and continue in the same format and you will be fine i would say, you have gor a fairly tidy / simple program now

 

also look in the rb+ docs folder and read the documentation, the quick ref text file may be of use to you

the bcx help file which may need to be unlocked (file properties) shows you the basic syntax (note some functionaliy is not there such as timer but its a guide)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...