Forums

Topic: Petit Computer

Posts 7,241 to 7,260 of 9,620

Pixelrobin

@ShadowGame I'm sure i'll ike it very much .

Everybody do a chirp. CHIRP.

3DS Friend Code: 3007-9228-5126

Slayer

I got frustrated over Mega Man 4 so I'm moving to the field of Petit Computer.
Just realized I'm only editing some code between FOLLOW4 and Apocalypse Rising. Problem is I'm not getting results...
Well, I might as well give the starter pistol infinite ammo. It's gonna be pretty weak, no point in limiting it and eventually the player will run out of ammo, get overwhelmed and eventually die.
It's hard getting shots to work, so I'm gonna work on animation and making the player go faster.
Here's my code for this-

@CONTROLS
IF BTRIG()==1 GOTO @UP
IF BTRIG()==2 GOTO @DOWN
IF BTRIG()==4 GOTO @LEFT
IF BTRIG()==8 GOTO @RIGHT
GOTO @CONTROLS
@UP
SPREAD(0),X,Y
SPOFS 0,X,Y-16,60
GOTO @CONTROLS
@DOWN
SPREAD(0),X,Y
SPOFS 0,X,Y+16,60
GOTO @CONTROLS
@LEFT
SPREAD(0),X,Y
SPOFS 0,X-16,Y,60
GOTO @CONTROLS
@RIGHT
SPREAD(0),X,Y
SPOFS 0,X+16,Y,60
GOTO @CONTROLS
That's what I have for movement, how do I get the player to move faster?

Edited on by Slayer

I have nothing really to say about myself.

Pixelrobin

@0Games I your case, just decrease the time it takes to get to the destination In the SPOFS (ex. 30 instead of 60).But why would you use BTRIG()? Use BUTTON(). Then you could have a much smoother movement system. Seriously. Its practicaly the same syntax. Why does everyong go for BTRIG()?

Everybody do a chirp. CHIRP.

3DS Friend Code: 3007-9228-5126

Malltog

Bluerobin2 wrote:

Why does everyong go for BTRIG()?

I think it's because it says in the manual that BTRIG only triggers "when a button is pressed" and nobody realizes that means it stops after a frame or whatever it is. So for future reference everyone movement should use BUTTON as should everything you want to continue as long as the button is held down.

Malltog

Nintendo Network ID: Malltog

Slayer

Malltog wrote:

Bluerobin2 wrote:

Why does everyong go for BTRIG()?

I think it's because it says in the manual that BTRIG only triggers "when a button is pressed" and nobody realizes that means it stops after a frame or whatever it is. So for future reference everyone movement should use BUTTON as should everything you want to continue as long as the button is held down.

I noticed that the player only responded when the d-pad was PRESSED, and when I held it the sprite moved and stopped as if I only pressed. Weird. Changing it to BUTTON() might not be very simple, and-wait, okay. I've got a strategy for that.

I have nothing really to say about myself.

ShadowGame

Does someone know when the Petit Computer
Offizial Strategy guide release on ios???

ShadowGame

Pixelrobin

@ShodowGame yeup. I want them to release it as an actual book before I buy it though. BTW moderatirs, could you please shorten the forum pages part? Something like:
0,1,2....363,364,365
The long page list is getting in the way of cintent especially on a 3ds. You could have an option to expand the pages too.

Everybody do a chirp. CHIRP.

3DS Friend Code: 3007-9228-5126

Ralph

@0Games personally I would have written the code more like this, to make it easier to have the player moving in two directions at once

EDIT: removed because of improved code below

Edited on by Ralph

Ralph

InsertPi

@Ralph @0Games or to shorten it even more:
@CONTROLS
SPOFS 0,X,Y
IF BUTTON() AND 1 THEN Y=Y-1
IF BUTTON() AND 2 THEN Y=Y+1
IF BUTTON() AND 4 THEN X=X-1
IF BUTTON () AND 8 THEN X=X+1
VSYNC 1
GOTO @CONTROLS

Edited on by InsertPi

If Facebook, Myspace, Twitter, Instagram, and Snapchat were all destroyed, 90% of teens would go insane. If you're one of the 10% that would be laughing at them, copy & paste this into your signature and hope it happens.

3DS Friend Code: 2148-9259-0831 | Nintendo Network ID: IAmAPerson620 | Twitter:

Ralph

@IAmAPerson
Yeah that is a lot simpler, although I find it strange that none of us put THEN after the if statement.
Huh, I could have sworn that was true.

Edited on by Ralph

Ralph

mystman12

Are there any good tutorials on making enemy AI? I have an idea of how I could make it, but it would be really complicated. So I was wondering if I could find a better method.

I like makin' games!
Future Pinball games!
Petit Computer games!!
and SmileBASIC games!
Waiting for Kirby Air Ride 2. One day, it will come. One day...

3DS Friend Code: 0259-0292-5888 | Nintendo Network ID: mystman12 | Twitter:

TAINT_Zzyex

Hairmanban19 wrote:

@TAINT_Zzyex what is Tales of Alzonia gonna be like? Such as:Story,features,is it Choose Your Own Adventure,and things like that. I'm always up for a Text-Adventure!

I guess since im unbanned now i should tie up some loose ends. ok... @hairmanban19 there will be a story, gridbased dungeons, battleing, a town you can explore, and magic. My mind is running through thousands of ideas for it (literaly, the brain thinks at 100,000,000 thoughts a second), but i cant include them all. I've completed the 400 line intro to the game and im about 1/4 through the story. My website will be up soon so i can banter without being banned by a certain fell dragon.

"Did somebody say Aincrad?"
"No, go back to your own game!"
"awwww"
"And make out with Asuna."
"Aww-I mean YAY"

Twitter:

InsertPi

@TheBlackDragon for the forums, it should show the comments newest to oldest. It'd make it a lot easier.

If Facebook, Myspace, Twitter, Instagram, and Snapchat were all destroyed, 90% of teens would go insane. If you're one of the 10% that would be laughing at them, copy & paste this into your signature and hope it happens.

3DS Friend Code: 2148-9259-0831 | Nintendo Network ID: IAmAPerson620 | Twitter:

ramstrong

Malltog wrote:

Bluerobin2 wrote:

Why does everyong go for BTRIG()?

I think it's because it says in the manual that BTRIG only triggers "when a button is pressed" and nobody realizes that means it stops after a frame or whatever it is. So for future reference everyone movement should use BUTTON as should everything you want to continue as long as the button is held down.

BTRIG() is equivalent to BUTTON(1), and is the default for 60 fps, action game.

When you want the signal for as long as the button is pressed, you use BUTTON(0)

BUTTON(2),BUTTON(3) correspond to button being pressed and released (I forget which is which, though). Also 1 frame window for those.

TAINT_Zzyex wrote:

I guess since im unbanned now i should tie up some loose ends.(snip)My website will be up soon so i can banter without being banned by a certain fell dragon.

Or you can act like a responsible adult and avoid being banned in the first place. Good luck on your website.

@IAmAPerson
I'm sure there's a thread for suggesting such improvements. Look under Other-Suggestions, Ideas, and Feedback.

mystman12 wrote:

Are there any good tutorials on making enemy AI? I have an idea of how I could make it, but it would be really complicated. So I was wondering if I could find a better method.

The answer to that question can fill a very thick book. Or two.

I'd start with state-based automata. Then you can simply do ON state GOTO ... and fill in the details.

Edited on by ramstrong

Petit Computer Journal
Old site http://ramstrong.blogspot.com

Let's just call a spade, a spade.

3DS Friend Code: 1091-7596-4855

randomous

Since everyone's going crazy over buttons, I decided to test out some different button/direction methods. The results are really really sad, and I wish they weren't so (even though it makes perfect sense). OK, here we go:

The first one I'm going to talk about is the "mathematical" version. This goes along the lines of:

B=BUTTON()
X=X + ((B AND 8)==8) - ((B AND 4)==4)
Y=Y + ((B AND 2)==2) - ((B AND 1)==1)

That final ==1 isn't necessary, but whatever... it's just for clarity. Next, we have the "canonical" one:

IF BUTTON() AND 8 THEN X=X+1
IF BUTTON() AND 4 THEN X=X-1
IF BUTTON() AND 2 THEN Y=Y+1
IF BUTTON() AND 1 THEN Y=Y-1

Fair enough, and it's very straightforward. There's one more, but I'll get to that later. Let's hear those results! When run 10 thousand times, the first one takes 92 cycles, and the second one takes 47. Wow, that's a lot faster! There's a small catch: if you're pressing buttons (I was just holding it in this case... it doesn't really make a difference), the first one still takes 92 cycles, and the second one takes 69. So the second one is always the best out of the two, but you get a bit of a variable performance.

Now comes the sad part... I hope you have tissues ready. I decided to come up with my own method of buttons to direction code. I used my knowledge of interpreted systems along with knowledge of computer architecture... to come up with the most disgusting directional code ever. OK, it's not as intense I made it out to be... what with the computer architecture stuff. Anyway, here it is:

ON BUTTON()-1 GOSUB @YM,@YP,@NO,@XM,@XMYM,@XMYP,@XPYM,@XPYP

@YM : Y=Y-1 : RETURN
@YP : Y=Y+1 : RETURN
@XM : X=X-1 : RETURN
@XP : X=X+1 : RETURN

@XMYM : X = X - 1 : Y = Y - 1 : RETURN
@XMYP : X = X - 1 : Y = Y + 1 : RETURN
@XPYM : X = X + 1 : Y = Y - 1 : RETURN
@XPYP : X = X + 1 : Y = Y + 1 : RETURN

Are you done crying? Retching, perhaps? Jokes aside, this is a grossly bloated and horrible implementation. In fact, I've squished it up just so that I don't take up page space... in reality, those "XM/YM" things are all expanded into separate lines (it's faster that way). Here's the terrible part: it runs TWICE as fast as the IF statement one, which is FOUR TIMES faster than the math one. Coming in at 23 frames, this is... just not right. Sure it makes sense, but come on! I don't want to write code like this. On top of that, if you're holding down buttons, it only takes 26 frames... a measly 13% increase as opposed to the 47% increase seen in the IF statement version.

The bottom line: No matter what language you use, speed and readability never mix. If you want the shortest code (bytewise), use the math version. If you want readability, use the IF statement version. If you're grasping for speed in any way you can, use the "obfuscated" version. Just make sure to remove all those ":" and place each piece of code on it's own line, otherwise you don't gain anything.

Edited on by randomous

randomous

ramstrong

randomous wrote:

Since everyone's going crazy over buttons, I decided to test out some different button/direction methods. The results are really really sad, and I wish they weren't so (even though it makes perfect sense). OK, here we go: (snip)

Thanks, randomous. Can you do one more test and do array assignment? As in:

DX[0]=0Y[0]=0
DX[1]=0Y[1]=-1
DX[2]=0Y[2]=1
etc...

B=BUTTON() AND 15
X=DX[B]:Y=DY[B]

Or something like that. TIA.

Petit Computer Journal
Old site http://ramstrong.blogspot.com

Let's just call a spade, a spade.

3DS Friend Code: 1091-7596-4855

theblackdragon

TAINT_Zzyex wrote:

My website will be up soon so i can banter without being banned by a certain fell dragon.

If you hadn't felt the need to be so rude after having been asked to stop insulting other users, you wouldn't have been temp-banned. the Rules here are the same for everyone. Best of luck on your site, though!

@IAmAPerson, @bluerobin2: I'm afraid I and the rest of the moderation team have no control over these things, but there's a thread in the feedback section here where users are welcome to share their ideas for the site. Please feel free to ask for improvements in that thread. :3

BEST THREAD EVER
future of NL >:3
[16:43] James: I should learn these site rules more clearly
[16:44] LztheBlehBird: James doesn't know the rules? For shame!!!

3DS Friend Code: 3136-6802-7042 | Nintendo Network ID: gentlemen_cat | Twitter:

randomous

@ramstrong Sure, I can try that.

Oh goodness, I totally messed up the ON..GOSUB code. Silly me.. I'll fix it up and report the difference along with your method.

randomous

Please login or sign up to reply to this topic