Jump to content

Dalta

New Members
  • Posts

    22
  • Joined

  • Last visited

Everything posted by Dalta

  1. Thanks for that help. I don't know what happened with configuring the controller inputs, the first time or two I loaded Studio Code it didn't remember the settings, but then after that, it did. So, problem solved I guess.
  2. Hey would someone mind explaining a part of this code further please? Particularly, these two lines: if HeroX <= BulletX[z] then BulletDirection[z] = BulletDirection[z] | %00000010 else BulletDirection[z] = BulletDirection[z] & %11111101 if HeroY <= BulletY[z] then BulletDirection[z] = BulletDirection[z] | %00000001 else BulletDirection[z] = BulletDirection[z] & %11111110 I understand what an 'and' and 'or' operation is, but I don't understand what's actually happening here. I copied these lines into my own code to see what happens. I had to flip the '<' signs and I also replaced 'BulletX' and Y with the 'enemyX' and Y variables. But after that my enemy sprites only fired imprecisely and only down and to the right. Does anyone know why I got that behaviour in my code as opposed to the precise shooting in this code? It's probably worth mentioning that I have two direction variables, one for up/down and one for left/right rather than just 'BulletDirection' which seems to be the case here. I think I just need to alter the part after the 'else' to get it to fire up and left too, but unfortunately I don't know what's actually happening in order to change it. Thanks for any help
  3. Is there a way to have the settings from the previous session become the default settings? i.e. The default programming language is currently bataribasic, currently I have to re-set the language to 7800basic every time I open Code Studio. This is also true of the settings for A7800, i.e. I have to reconfigure my joypad controls on A7800 every time I open Code Studio. Is there some way to set these as default I haven't seen, or is there some way it could be implemented? Also, the A7800 launches as the NTSC 7800, is there a way to get the PAL version to be what launches instead? Thanks for the work, I haven't installed the sprite editor version, but that looks really useful.
  4. Cool, no problem. I'm eternally grateful just for 7800basic's existence, I never would've made much progress if I was still struggling with assembly.
  5. Thanks for that help, don't know why I didn't just create a new variable, I guess I was too focused on figuring out a solution to the problem. Now that you mention it, I ran into two other issues that seem related, perhaps it will be helpful to you. One was when I was trying to implement some simple collision with a bullet and had a line that was something like if bullx>ex && bullx<ex+8 && bully>ey && bully<ey+16 then goto BulletInactive with ex being the enemy x position, and ex+8 being the enemy's width with ey the corresponding measures for the y axis. This code wouldn't run and I had to replace ex+8 with a new variable eh (enemy height) which was equal to the same thing. I copied this line or something similar from the http://www.randomterrain.com/7800basic.htmlwebsite, but I've looked through and I can't find anything like it now so I'm not sure what part I got it from. The other time wasn't an if statement but is kind of similar, it was with the plotsprite command. I had plotsprite enemy 0 ex[eco] ey[eco] but it wouldn't run, so I had to create a single use 'nex' variable which is equal to ex[eco] and ditto for ey to replace them in that statement. This is the same for all my plotsprite commands.
  6. So I've had another problem with this section of code. I was implementing multiple base blocks, so I made every variable into an array to accommodate each base block. The only change to the code I made was adding [bco] after the variable names. [bco] is the counter I use to loop through each array in order to manipulate each block. This broke the code, but it seems to be the specific configuration 'playerx+15>basex[bco]' that doesn't work (and presumably the playery equivalent), I've tested the other operations and they seem to work fine. Switching the signs to their opposite also works fine, and replacing the operation with playerx>basex[bco]-15 works, but causes the same problems as in my original post. When I say the code doesn't work, it never evaluates 'playerx+15>basex[bco]' to true. if playerx<basex[bco]+15 && playerx+15>basex[bco] && playery<basey[bco]+10 && playery+10<basey[bco] then plotsprite face1 0 100 100:nearbase[bco]=1 else nearbase[bco]=0 if joy0fire1 && nearbase[bco]=1 then basex[bco]=playerx+4:basey[bco]=playery+4:basepickedup[bco]=1 else basepickedup[bco]=0 Anyone know what could be wrong?
  7. So sorry not to reply sooner, was travelling. Thank you for that explanation, I had read that before but hadn't thought of it as a possible reason for this bug. I implemented your suggested workaround and everything works as intended now. Thanks so much!
  8. If you don't mind me asking, did you ever consider doing a kickstarter to fund production? If so why did you decide against it?
  9. Sorry couldn't think of a better title. So, I'm trying to implement moving and placing blocks in order to place them as defenses in front of the player's base. I wrote a simple code, just two lines, so that when the player's x and y are within a range of the block's x and y (15 pixels on the x, 10 on the y), and then the player presses a button, the block will jump to be 4 pixels away from the player's x and y ("carrying" the block). Everything works fine until the block gets to blockx=14 (and blocky=9) when the the block will detach from the player (the variable 'nearbase' is no longer true) and will not allow itself to be picked up again (nearbase is never re-set as 1), even if the player's x and y go away from the edge of the screen. I used plotvalue to display that the variables for player and base x and y are correct, stay what they should be and stay within range. There is no problem on the other end of the screen, only in the lower numbers. When the strange behaviour is happening, I ask (via plotting a debug image) if the playerx is within range, it says it isn't, despite the plotvalue clearly showing that, in fact, it is. playerx and playery are dimensioned as a and b while blockx and blocky are $2557 and $2561 so it doesn't seem to be an overwriting issue. The block is called 'base' in the code, so blockx=basex. if playerx<basex+15 && playerx>basex-15 && playery<basey+10 && playery>basey-10 then nearbase=1 else nearbase=0 if joy0fire1 && nearbase=1 then basex=playerx+4:basey=playery+4:basepickedup=1 else basepickedup=0 Anyone know what's going on?
  10. Thank you for your help, that wasn't actually the error, I was still getting weird behaviour after I fixed the problem you mentioned. But I moved the line bx=bullx[x]: by=bully[x] to go after the peekchar lines (here: tempbx=bx/8:tempby=by/16 tempchar2=peekchar(screenram,tempbx,tempby,20,12) if player_bullets[x]=1 && tempchar2=2 then player_bullets[x]=0 if tempchar2=2 then plotsprite face1 0 0 50) and I got improved behaviour (though I don't understand why, it's like the latter lines above affected the assignment of bx and/or by). But anyway, I think I'm on to something here and I will pursue this for a while. If I need further help I will come back, thanks so much.
  11. Hope it's ok that I create a new thread each time I need help, I figured it would help people in future search if they're stuck on something. Anyway, I've created bullets for the player to shoot and now I'm trying to get the bullets to disappear when they hit a wall. I admit that I don't fully understand peekchar, but I get weird behaviour around line 29 in the below code. Before I put in the peekchar code, the bullets shoot from the player in whatever direction they're moving, as expected, but when I put in those peekchar lines around line 29 below, I get behaviour I don't understand. The appearance or otherwise of the bullet seems to depend on the player's position when in theory, that shouldn't affect it at all. The bullets also only appear when the player is on a certain side of the screen, not when they are touching a certain character, which is what I thought peekchar does. In theory it should be the character underneath either the player or the bullet which affects behaviour, no? Everything works fine until I set what 'tempbx' and 'tempby' are for the peekchar function. I put in a debug line which plots another face sprite which should match the same conditions as the bullet, but it appears at different times, seemingly random. On one run through the game crashed and plotted out a load of numbers at the top of the screen (this happened before during a different bug when I had mis-assigned a variable. I went through several times to make sure I hadn't done that this time and it doesn't look like it. It seems like there's something about peekchar that I don't understand. I tried to create a gif to illustrate the issue but apparently it's not allowed. My abridged code looks like the following: set collisionwrap on set doublewide on <assign variables> ; this next line is copied from Atarius Maximus's code dim screenram = $2200 : rem to $24EF (20*12=240 bytes) rem $24F0 to $27FF are free ;screen0map is the name of the map I made with alphachars memcpy screenram screen0map 240 plotmap screenram 1 0 0 20 12 savescreen main pprevx=playerx: pprevy=playery <movement code> if joy0fire0 && btimer=0 then gosub bullInit ; *** Plotting and Moving Bullets if firecon>10 then firecon=firecon-1 for x=0 to firecon ;giving variables to the bullets, in order to work in the if statement bx=bullx[x]: by=bully[x] ;check if the Bullet has hit a wall tempbx=bx/16:tempby=by/8 ;the bullets stop plotting for some reason after I enter this line tempchar2=peekchar(screenram,tempbx,tempby,20,12) if player_bullets[x]=1 && tempchar2=2 then player_bullets[x]=0 if tempchar2=2 then plotsprite face1 0 0 50 ;this is a debug line, though has weird behaviour too ;if the bullet is active, plot it and move it depending on it's direction for the next frame if player_bullets[x]=1 then plotsprite bullet 0 bx by: bullx[x]=bullx[x]+bdr[x]: bully[x]=bully[x]+bdd[x] next <some other code to prevent player moving off screen> if btimer>0 then btimer=btimer-1 plotsprite face1 0 playerx playery drawscreen goto main bullInit ;gives initial bullet variables bullx[firecon]=playerx: bully[firecon]=playery ; sets initial bullet coords at the player's coords player_bullets[firecon]=1 ;this basically sets the bullet to be active bdd[firecon]=playery-pprevy ;this sets the up/down velocity of the bullet depending on the player's movement bdr[firecon]=playerx-pprevx ;the same as above for left/right firecon=firecon+1 ; firecon keeps track of how many bullets there are btimer=10 ;this prevents too many bullets being plotted too quickly return ;checks for collision when player moves down checkmovedown tempx=(playerx+1)/8 tempy=(playery+8)/16 tempchar1=peekchar(screenram,tempx,tempy,20,12) if tempchar1=2 then return playery=playery+2:return <other code for player collision detection> alphachars ' abcdefghijklmnopqrstuvwxyz!@#$%^&*()_+-=[]{}:";<>,.?/' alphadata screen0map tileset_blanks2 ' ' ' ' 'aaaaaa aaaaaaaaa' ' ' ' aaaa ' ' aaaaaa ' ' ' ' aaaaa ' ' ' 'aaaaaaaaaa aaaa' ' ' ' ' end Thanks as always for any help.
  12. Did you look into getting official licensing from Atari so you could put the logo, etc on the box like in the 80s?
  13. Anyone have a solution for implementing an array of bullets? In the sample code I've seen, usually a bullet sprite is plotted only while fire is held down, however I'd like for a bullet to be created when fire is pressed, and only disappear when it hits something or after a time limit. Normally to do this I would create an array of bullets and each time the fire button is pressed, add an item to that array, then when it's time to draw the screen, just do a for loop and plot each bullet before moving to the next. However, in 7800basic I can't seem to find a workaround, I think I've managed to create an array by declaring 'player_bullets[0]' as var0, with the intention of reserving 10 spaces, up to var9, for the players bullets, but I can't seem to even read an array element using a variable, i.e. I have a counter for the amount of bullets called 'bullcon', but referencing player_bullets[bullcon] returns an error. Can anyone help? Thank you
  14. Thanks a lot guys for the help. Yes, I thought about making a tile map originally, but I was just trying to get something quick and dirty up and running. Thanks for the link, I will go through and reformulate the code with its help. Edit: Ah, I've seen that link before haha, I was planning to come back to tiles and that after getting this game going, it looks my hand has been forced
  15. set zoneheight 8 set collisionwrap on dim playerx=a playerx=75 playery=176 dim playery=b dim platx=c c=142 dim platy=d d=152 dim platx2=g:platx2=platx-16 dim platx3=h:platx3=platx-32 dim platx4=i:platx4=platx-48 dim prevx=e dim prevy=f incgraphic face1.png incgraphic plat.png rem ***' set the colors of palette 0, which we'll use to draw the happy face P0C1=$82 P0C2=$48 P0C3=$fb main clearscreen prevx=playerx prevy=playery ;'joystick if joy0left then playerx=playerx-1 if joy0right then playerx=playerx+1 if joy0down then playery=playery+2 if joy0up then playery=playery-2 ;if joy0fire0 then ;if joy0fire1 then ;'stop player moving off screen if playerx<1 then playerx=playerx+1 if playerx>150 then playerx=playerx-1 if playery<1 then playery=playery+2 if playery>176 then playery=playery-2 ;'COLLISION DETECTION ;'bottom right wall if playerx>prevx && boxcollision(playerx, playery, 8, 8, 94, platy, 64, 2) then playerx=playerx-1 if playerx<prevx && boxcollision(playerx, playery, 8, 8, 94, platy, 64, 2) then playerx=playerx+1 if playery>prevy && boxcollision(playerx, playery, 8, 8, 94, platy, 64, 2) then playery=playery-2 if playery<prevy && boxcollision(playerx, playery, 8, 8, 94, platy, 64, 2) then playery=playery+2 ;'bottom left wall if playerx>prevx && boxcollision(playerx, playery, 8, 8, 0, 152, 64, 2) then playerx=playerx-1 if playerx<prevx && boxcollision(playerx, playery, 8, 8, 0, 152, 64, 2) then playerx=playerx+1 if playery>prevy && boxcollision(playerx, playery, 8, 8, 0, 152, 64, 2) then playery=playery-2 if playery<prevy && boxcollision(playerx, playery, 8, 8, 0, 152, 64, 2) then playery=playery+2:plotsprite plat 0 0 0 ;'top left wall if playerx>prevx && boxcollision(playerx, playery, 8, 8, 15, 48, 64, 2) then playerx=playerx-1 if playerx<prevx && boxcollision(playerx, playery, 8, 8, 15, 48, 64, 2) then playerx=playerx+1 if playery>prevy && boxcollision(playerx, playery, 8, 8, 15, 48, 64, 2) then playery=playery-2 if playery<prevy && boxcollision(playerx, playery, 8, 8, 15, 48, 64, 2) then playery=playery+2 ;'top right wall if playerx>prevx && boxcollision(playerx, playery, 8, 8, 94, 48, 64, 2) then playerx=playerx-1 if playerx<prevx && boxcollision(playerx, playery, 8, 8, 94, 48, 64, 2) then playerx=playerx+1 if playery>prevy && boxcollision(playerx, playery, 8, 8, 94, 48, 64, 2) then playery=playery-2 if playery<prevy && boxcollision(playerx, playery, 8, 8, 94, 48, 64, 2) then playery=playery+2 ;' middle wall upper if playerx>prevx && boxcollision(playerx, playery, 8, 8, 79, 68, 32, 2) then playerx=playerx-1 if playerx<prevx && boxcollision(playerx, playery, 8, 8, 79, 68, 32, 2) then playerx=playerx+1 if playery>prevy && boxcollision(playerx, playery, 8, 8, 79, 68, 32, 2) then playery=playery-2 if playery<prevy && boxcollision(playerx, playery, 8, 8, 79, 68, 32, 2) then playery=playery+2 ;' middle wall lower if playerx>prevx && boxcollision(playerx, playery, 8, 8, 22, 120, 32, 2) then playerx=playerx-1 if playerx<prevx && boxcollision(playerx, playery, 8, 8, 22, 120, 32, 2) then playerx=playerx+1 if playery>prevy && boxcollision(playerx, playery, 8, 8, 22, 120, 32, 2) then playery=playery-2 if playery<prevy && boxcollision(playerx, playery, 8, 8, 22, 120, 32, 2) then playery=playery+2 ;' debug line, draws a line in the top right of the screen when player hits the bottom left line if boxcollision(playerx, playery, 8, 8, 20, 120, 32, 2) then plotsprite plat 0 0 0 plotsprite face1 0 playerx playery ;'DRAWING WALLS plotsprite plat 0 platx platy plotsprite plat 0 platx2 platy plotsprite plat 0 platx3 platy plotsprite plat 0 platx4 platy plotsprites plat 0 0 platy plotsprites plat 0 16 platy plotsprites plat 0 32 platy plotsprites plat 0 48 platy ;'enemy base walls plotsprites plat 0 0 48 plotsprites plat 0 16 48 plotsprites plat 0 32 48 plotsprites plat 0 48 48 plotsprites plat 0 142 48 plotsprites plat 0 126 48 plotsprites plat 0 110 48 plotsprites plat 0 94 48 ;'middle walls plotsprites plat 0 79 68 plotsprites plat 0 95 68 plotsprites plat 0 22 120 plotsprites plat 0 38 120 drawscreen goto main Pff, it's already been over 10 days. Sorry for the delay, I'm hoping to carve out some time soon to work on this consistently soon but not there yet. If you still even remember what we were talking about and are interested, I would appreciate the help, thanks for the offer. I just hope it's not something embarrassingly simple, though that's what it feels like it will turn out to be to be honest. I hope you don't mind me posting it all, I figured it would probably take me longer to explain it than to just write out the entire code.
  16. Unfortunately not. I thought of that, everything starts at x=0 and I even changed it to x=1 or x=5 and I still get the bizarre behaviour were parts of the sprite don't collide. Just to clarify, I added 'set collisionwrap on' too and nothing changed.
  17. I'm having some trouble with boxcollision. I have drawn a very simple map with some 2-pixel high lines (plotted as sprites), then as I try to draw boxcollision boxes over them, it seems to work randomly. I check in four if statements first which way the player is moving (one if statement for each direction), then if they're colliding with the box, if both are true, I push the player back the way they came so they act like barriers. I'm aware this is far from efficient, I was just trying to get something up and running. It may be coincidence, but it's mostly sprites on the left side of the screen that don't work, however I drew a box on the left side without checking the direction and it worked ok, but it seemed to have a small gap in it where the player should've been colliding but wasn't. I tried changing the x and y coords of this box and sometimes it would collide and sometimes not. There's also another line which is like this. Some sprites are exactly the same as another except, for example, the y axis of the collision box, but one works and one doesn't. I've even drawn the exact same line straight after another, just with something else after the 'then' of the if statement and the first one works but not the second. One line i drew directly across from another, so the only difference is the x value, I gradually pushed the x value back by 16 pixels at a time and after about x-value 20 or so, the player stopped colliding with it (but seemed to continue to collide with the further right side of the line). So I'm preety baffled as to what's going on. The code is just a modified version of the 'simple' file in the samples folder with the colliding added. The sprites don't go outside the visible screen area and I doublechecked to make sure all the values, etc were correct. I put the debug collision boxes both before and after all the other collision if statements and they seemed to work the same. Anyone know what I'm doing wrong?
  18. Thanks guys, I've gone through the first link, a useful starting point. The second one looks very good too, hoping to put some decent hours into this over the weekend.
  19. Thanks for the advice SmittyB, I went the first route and after a few days I have a very unpolished single platform. Making a big tiled map seems like a better way to go, easier to implement levels. I just have to figure out how to stop an object falling when it hits a certain tile.
  20. Hi, thanks for making this tutorial, hopefully it'll get more people into 7800 devel. I'm currently trying to make a simple platformer, but I'm having trouble implementing platform collision, every solution I see online assumes the existence of classes. Are there classes in 7800basic or some workaround? If not, would you have any suggestions on how to implement platform collision? Thanks (sorry for sending the tweet earlier, I had just sent it when my AtariAge validation came through).
×
×
  • Create New...