Retro Lord Posted June 30, 2015 Share Posted June 30, 2015 (edited) I haven't figured this one out yet, but I believe the answer is math. The scrolling in haunted house, how would it be coded so that it stops scrolling up or down at the desired location? Tech demo of Haunted House clone: default.bas.bin You can walk around, and go to 3 different rooms, 1 to the right and 1 to the left of the blue room. No hit detection. Edited June 30, 2015 by Retro Lord Quote Link to comment Share on other sites More sharing options...
Retro Lord Posted June 30, 2015 Author Share Posted June 30, 2015 (edited) Nevermind, I figured it out. I used a counter, when you walk up j=j+1 until it reaches 60, then if j>60 pfscroll down and j=60 So simple, haha =) Implemented features: 8 direction rotation of eyes. Light effect around the eyes. Scrolling rooms up and down. Randomly appearing ghost and dot(placehold item) 3 hearts I use flicker for player1 so I can have both the light and the ghost on the screen at the same time, I couldn't capture it on the printscreen sadly. Planned features for the next version: Moving ghost Techdemo: Boo, Scary House 0.2.bin Edited June 30, 2015 by Retro Lord 2 Quote Link to comment Share on other sites More sharing options...
Retro Lord Posted July 1, 2015 Author Share Posted July 1, 2015 (edited) I'm having some problems with the movement of the ghost. I'm trying to have it follow the player arround, and this is my code for the ghost: q is the random counter that rolls everytime when you enter a room to see if a ghost will appear. If q=1 then the ghost is in the room. p is the flickering mechanic that flickers between the ghost sprite and the lightsource of the player. I tried using a counter for making the ghost follow the player : w. If w=1 then the ghost should follow but it dosn't. Does anybody have any pointers on this? rem makes the ghost appear when entering a room if q=1 && p=2 then player1x=50 : player1y=50 : w=1 if q=1 && p=2 && w=1 && player1x<player0x then _P1_L_R=_P1_L_R+0.30 if q=1 && p=2 && w=1 && player1x>player0x then _P1_L_R=_P1_L_R-0.30 if q=0 && p=2 then player1y=255 : player1x=255 : u=0 default.bas Edited July 1, 2015 by Retro Lord Quote Link to comment Share on other sites More sharing options...
Retro Lord Posted July 2, 2015 Author Share Posted July 2, 2015 (edited) Hm, some progress atleast, the ghost is now able to jitter a bit but no significant movement. if p=2 && q=1 then a=1 if a=1 && p=2 && q=1 then player1x=50 : player1y=50 : a=2 if a=2 && p=2 && q=1 then player1x=50 : _P1_U_D=_P1_U_D+0.30 Edited July 2, 2015 by Retro Lord Quote Link to comment Share on other sites More sharing options...
Retro Lord Posted July 2, 2015 Author Share Posted July 2, 2015 (edited) Finaly I got it working! The ghost now moves, phew, that was insanely hard to figure out! Current features: 8 way movement of eyes Light around the player Moving ghost holding a key 3 rooms Hearts Demo: Boo, Scary House 0.3.bin Edited July 2, 2015 by Retro Lord Quote Link to comment Share on other sites More sharing options...
Retro Lord Posted July 2, 2015 Author Share Posted July 2, 2015 (edited) I managed to get the key to spawn in 1 of the 9 rooms in the house, you have to find it. But I have hit a bug I'm not sure how to fix. The ghosts carry the key with them when they should not do that. I have a counter: z. That randomly picks a room and puts the key in it. And if you leave that room the key is still in it, but in all the other rooms the ghosts carry keys with them when the key should be located at player1x=255:player1y=255 NEW FEATURES: You can now go up and down the stairs (openings on the bottom and the top, the top leads up and the bottom leads down) Bumping into the ghosts resets the game (placeholding feature) b is the room counter. p is the frame counter and u determines if the key has been picked up. Any pointers? rem removes key if you leave the room it is in if z=0 && b>0 && p=0 && u=0 then player1x=255 : player1y=255 if z=1 && b<>1 && p=0 && u=0 then player1x=255 : player1y=255 if z=2 && b<2 && p=0 && u=0 then player1x=255 : player1y=255 if z=3 && b<2 && p=0 && u=0 then player1x=255 : player1y=255 if z=4 && b>0 && p=0 && u=0 then player1x=255 : player1y=255 if z=5 && b<>1 && p=0 && u=0 then player1x=255 : player1y=255 if z=6 && b<2 && p=0 && u=0 then player1x=255 : player1y=255 if z=7 && b<2 && p=0 && u=0 then player1x=255 : player1y=255 Demo: Boo, Scary House 0.4.bin Source: default.bas Edited July 2, 2015 by Retro Lord 2 Quote Link to comment Share on other sites More sharing options...
Papa Posted July 2, 2015 Share Posted July 2, 2015 Nice upgrade on the Haunted House game! My wife beat the original a few times and likes the game. I will show her this one. Good work! Quote Link to comment Share on other sites More sharing options...
Retro Lord Posted July 3, 2015 Author Share Posted July 3, 2015 Glad to hear you like it. I managed to fix the bug with the ghosts holding the key. Now the key is spawned in a random room, find it, pick it up and then search for a new key. That's as far as I've come. I'm running out of space fast and I only have 260kb left. Now I must do an ending to the game, fix wall collision and a gameover sequence. I was thinking of doing a Dracula theme. Where you explore Dracula's manor, finding stuff and then facing him off. I could do so that you need 3 items, like a cross, a stake and I don't know, holy water? With these items you go and find Dracula and kill him...Or something like that. Quote Link to comment Share on other sites More sharing options...
SeaGtGruff Posted July 3, 2015 Share Posted July 3, 2015 (edited) I'm looking forward to the new BIN. I think it's neat when people can recreate a classic Atari 2600 game using batari Basic. Edited July 3, 2015 by SeaGtGruff Quote Link to comment Share on other sites More sharing options...
Retro Lord Posted July 3, 2015 Author Share Posted July 3, 2015 It's pretty cool. I really like Haunted House and wished for a similar game with some differences, so I decided to just replicate some core features and add in some new stuff, I'm just gonna settle for a fun theme. Like I said I'm strongly thinking of Dracula. Just do a swap of the ghost on the third floor and have him move faster. The keys will be invisible to and can only be seen with your light, well that's the plan atleast. I have no idea on how I will pull that one off yet. Sprite flickering is a bit complicated I think. Quote Link to comment Share on other sites More sharing options...
Retro Lord Posted July 4, 2015 Author Share Posted July 4, 2015 I'm having some problems with my collision detection between player0 and the playfield. I got it working when you go left and right but not up and down. What could I be doing wrong? rem movement rem bounce right if n=1 then player0x=player0x+1 rem bounce left if n=2 then player0x=player0x-1 rem bounce down if n=3 then player0y=player0y+1 rem bounce up if n=4 then player0y=player0y-1 if !joy0left then n=0 if !joy0right then n=0 if !joy0up then n=0 if !joy0down then n=0 if n=0 && joy0left && collision(player0,playfield) then n=1 if n=1 && joy0left && collision(player0,playfield) then n=1 if n=0 && joy0right && collision(player0,playfield) then n=2 if n=1 && joy0right && collision(player0,playfield) then n=2 if n=0 && joy0down && j<185 && collision(player0,playfield) then pfscroll down : n=4 if n=3 && joy0down && j<185 && collision(player0,playfield) then pfscroll down : n=4 if n=0 && joy0up && j>67 && collision(player0,playfield) then pfscroll up : n=3 if n=3 && joy0up && j>67 && collision(player0,playfield) then pfscroll up : n=3 if joy0down && player0y=50 && j<185 then f=3 : k=2 : j=j+1 : pfscroll up : missile1y=missile1y-1 if joy0up && player0y=50 && j>67 then f=4 : k=2 : j=j-1 : pfscroll down : missile1y=missile1y+1 if joy0right then f=1 : k=2 : player0x=player0x+1 if joy0left then f=2 : k=2 : player0x=player0x-1 if joy0up && joy0right then f=5 if joy0up && joy0left then f=8 if joy0down && joy0right then f=6 if joy0down && joy0left then f=7 if joy0up && j<=67 then k=2 : player0y=player0y-1 : f=4 if joy0down && j<=67 then k=2 : player0y=player0y+1 : f=3 if joy0up && joy0right && j<=67 then k=2 : f=5 if joy0up && joy0left && j<=67 then k=2 : f=8 if joy0down && joy0right && j<=67 then k=2 : f=6 if joy0down && joy0left && j<=67 then k=2 : f=7 if joy0up && j>=185 then k=2 : player0y=player0y-1 : f=4 if joy0down && j>=185 then k=2 : player0y=player0y+1 : f=3 if joy0up && joy0right && j>=185 then k=2 : f=5 if joy0up && joy0left && j>=185 then k=2 : f=8 if joy0down && joy0right && j>=185 then k=2 : f=6 if joy0down && joy0left && j>=185 then k=2 : f=7 Source: default.bas Quote Link to comment Share on other sites More sharing options...
Retro Lord Posted July 4, 2015 Author Share Posted July 4, 2015 Well. I managed to do some progress. Now you are stopped when bumping into the playfield, but if you push left or right when pushing up or down you can move through the walls. Any thoughts? rem movement rem bounce right if n=1 then player0x=player0x+1 rem bounce left if n=2 then player0x=player0x-1 rem bounce down if n=3 then player0y=player0y+1 rem bounce up if n=4 then player0y=player0y-1 if !joy0left then n=0 if !joy0right then n=0 if !joy0up then n=0 if !joy0down then n=0 if n=0 && joy0left && collision(player0,playfield) then n=1 if n=1 && joy0left && collision(player0,playfield) then n=1 if n=0 && joy0right && collision(player0,playfield) then n=2 if n=1 && joy0right && collision(player0,playfield) then n=2 if n=0 && joy0up && j<=67 && collision(player0,playfield) then n=3 if n=0 && joy0up && j>=67 && collision(player0,playfield) then goto skip if n=0 && joy0up && joy0left && j>=67 && collision(player0,playfield) then goto skip if n=0 && joy0up && joy0right && j>=67 && collision(player0,playfield) then goto skip if n=0 && joy0down && j<=67 && collision(player0,playfield) then n=4 if n=0 && joy0down && j>=67 && collision(player0,playfield) then goto skip if n=0 && joy0down && joy0right && j>=67 && collision(player0,playfield) then goto skip if n=0 && joy0down && joy0left && j>=67 && collision(player0,playfield) then goto skip if joy0down && player0y=50 && j<185 then f=3 : k=2 : j=j+1 : pfscroll up : missile1y=missile1y-1 if joy0up && player0y=50 && j>67 then f=4 : k=2 : j=j-1 : pfscroll down : missile1y=missile1y+1 if joy0right then f=1 : k=2 : player0x=player0x+1 if joy0left then f=2 : k=2 : player0x=player0x-1 if joy0up && joy0right then f=5 if joy0up && joy0left then f=8 if joy0down && joy0right then f=6 if joy0down && joy0left then f=7 if joy0up && j<=67 then k=2 : player0y=player0y-1 : f=4 if joy0down && j<=67 then k=2 : player0y=player0y+1 : f=3 if joy0up && joy0right && j<=67 then k=2 : f=5 if joy0up && joy0left && j<=67 then k=2 : f=8 if joy0down && joy0right && j<=67 then k=2 : f=6 if joy0down && joy0left && j<=67 then k=2 : f=7 if joy0up && j>=185 then k=2 : player0y=player0y-1 : f=4 if joy0down && j>=185 then k=2 : player0y=player0y+1 : f=3 if joy0up && joy0right && j>=185 then k=2 : f=5 if joy0up && joy0left && j>=185 then k=2 : f=8 if joy0down && joy0right && j>=185 then k=2 : f=6 if joy0down && joy0left && j>=185 then k=2 : f=7 skip goto main Quote Link to comment Share on other sites More sharing options...
SeaGtGruff Posted July 5, 2015 Share Posted July 5, 2015 My Windows 8 computer isn't set up to compile batari Basic. Can you post a BIN to go with the BAS? Also, it seems like you could simplify those IFs, and I'm not following how N is being used. Quote Link to comment Share on other sites More sharing options...
Arenafoot Posted July 6, 2015 Share Posted July 6, 2015 nice work Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.