Jump to content
Arcade

Help Creating Objects

Recommended Posts

I need some help with my coding. I have a game I'm trying to make where a turkey and pilgrim fight each other (yes a Thanksgiving themed game). I have the code set up right now allowing my two people to move around. I decided I wanted to make some rocks in the area so the characters could hide behind them. I decided to set one as Player 2 (since the turkey and pilgrim are P0 and P1). However, whenever I try to put Player 2 in the code, and set player2x = some number and player2y= some number, I keep getting an error.

 

Does the program want me to make it to where I have to move those characters as well? Or can I not set the Rocks as a player? If not, then how can I go about setting them up? I guess my question overall is how can I set up the rocks with the sprites I have, without having to code them to move? I feel setting them as a player is cheating, but the sprite I have is nifty (it's a play on Plymouth Rock, as suggested by my wife) and I would like to keep it if I can.

 

Here is the code WITHOUT any player 2:

 

a= 25

b= 50

c=125

d=50

 

player0:

(its sprite)

end

 

player1:

(its sprite)

end

 

main

 

COLUP0 = $F4

COLUP1 = $1E

COLUBK = $C2

COLUPF = $00

 

player0x=a

player0y=b

player1x=c

player1y=d

 

drawscreen

if joy0right then a=a+1

if joy0left then a=a-1

if joy0up then b=b-1

if joy0down then b=b+1

 

if joy1right then c=c+1

if joy1left then c=c-1

if joy1up then d=d-1

if joy1down then d=d+1

goto main

 

I figured being able to draw the rocks how I want them as character sprites would make it look better, but the compiler doesn't like it when I try to code them in. Usually I try to insert code like this:

 

a= 25

b= 50

c=125

d=50

 

player0:

(its sprite)

end

 

player1:

(its sprite)

end

 

player2:

(whatever sprite)

end

 

main

 

COLUP0 = $F4

COLUP1 = $1E

COLUP2 = (whatever color)

COLUBK = $C2

COLUPF = $00

 

player0x=a

player0y=b

player1x=c

player1y=d

player2x = 50

player2y = 50

 

drawscreen

if joy0right then a=a+1

if joy0left then a=a-1

if joy0up then b=b-1

if joy0down then b=b+1

 

if joy1right then c=c+1

if joy1left then c=c-1

if joy1up then d=d-1

if joy1down then d=d+1

goto main

 

Sorry this is my very first time coding using Batari Basic. Any and all help would be appreciated. Don't get too upset as I do plan on asking a lot of questions down the line! Like I said, I'm new to this! Thanks for any and all help! Btw, I put (its sprite) and other things in there to shorten up my post. I know that's not code, but I just did that to shorten the post.

Edited by Arcade

Share this post


Link to post
Share on other sites

I'm no expert

 

While some strange things happen, I didn't have any trouble

getting it to compile.

 

Maybe this is a silly question but you did tell bB that you want

the mutisprite kernel right?

 

As I understand it, the mutisprite kernel recycles player1 and

player0 has a higher priority, ie player0 will always be in front of

all the other player sprites.

 

Also the virtual sprites will flicker if more than one of them occupys

the same horizontal space, they don't go behind each other.

Edited by bogax

Share this post


Link to post
Share on other sites

Multi-sprite kernel? No idea what that is. I guess I will look around and try to find it. Could you please explain it to me anyways just in case I can't figure it out or the code? Thanks! Hopefully I will be able to get it straightened out soon!

 

Okay I found some kind of multi kernal code and so far it seems to be working! I put this in it...

 

includesfile multisprite.inc

set kernel multisprite

set romsize 4k

set smartbranching on

 

The "set" on romsize 4k is highlighted in yellow but it compiles just fine! Thank you so much for your help! Question do I need all of that code for multi kernel or what? I don't really understand it but I'm doing my best to learn!

Edited by Arcade

Share this post


Link to post
Share on other sites

includesfile multisprite.inc

set kernel multisprite

set romsize 4k

set smartbranching on

 

The "set" on romsize 4k is highlighted in yellow but it compiles just fine! Thank you so much for your help! Question do I need all of that code for multi kernel or what? I don't really understand it but I'm doing my best to learn!

 

Again, I'm no expert

 

The yellow highlighting I assume is some Visual bB thing.

I know nothing of Visual bB.

 

I suppose there's likely something in the multisprite.inc that you

might want.

I'm not sure how necessary it is. Things work fine for me

without it.

Share this post


Link to post
Share on other sites

I got the multisprite to work. I think right now I will stick to just one. Got so much I'm trying to learn and do...for instance, collision detection between all characters that doesn't involve just making the background color flash. I want my people to not go through each other...then I have to get my "missiles" to work properly...a lot of work for me.

 

Thanks Random...I bookmarked your batari Basic commands page. I'm hoping that I can read up on that and learn some stuff and not have to ask so many questions. Some things I want to do I haven't found any information on. I'm not sure exactly what all bB can handle or do, but hopefully with some work I can accomplish said tasks (i.e. proper "missiles" and collision with them, and collision detection between characters to stop them from moving through each other).

 

Thanks again to both of you for your help!

Share this post


Link to post
Share on other sites
Thanks Random...I bookmarked your batari Basic commands page. I'm hoping that I can read up on that and learn some stuff and not have to ask so many questions. Some things I want to do I haven't found any information on. I'm not sure exactly what all bB can handle or do, but hopefully with some work I can accomplish said tasks (i.e. proper "missiles" and collision with them, and collision detection between characters to stop them from moving through each other).

 

Just remember that the bB page has a table of contents on the left side of the page and an index on the right side. I tried to include almost anything you can think of in the index so it would be easier to find things.

Share this post


Link to post
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.

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...