Forums

Topic: Petit Computer

Posts 3,921 to 3,940 of 9,618

Gimmemorecoinz

Okay everyone. Because I was having issues with coding inside of PTCutilities but I really want to code on a pc not on my 3DS
I took the time to use the dialougue box of notepad++ to create a custom language highlighting. It is incomplete but functional.
Here it is on the wiki page http://petitcomputer.wikia.com/wiki/Notepad%2B%2B_highlightin...
This may help users spot errors more easily inside of petit computer code because of how the code is broken up and categorized.
Enjoy! Sprite commands haven't been added yet but most other "key" commands that beginners use, have been.

Got a project? PM ME on here!
Youtube: lostkitty64x
Want help with coding? PM ME! PM ME PM ME!! XD
FC: WIll post later.
Systems I own: ds lite, 3DS, PC/gaming, steam platform. I play alot of games. Just ask ! Minecraft anyone? :D

Gimmemorecoinz

Hey everyone. Your going to be surprised.. and maybe a bit confused.
I've created some example template code in order to handle typed arrays.
It supports up to 150 custom user defined types, each type can have up to 150 seperate instances
and each instance can have up to 10 custom named local variables, and each instance's local variables can hold up to ten local values
there is no @set function but you can make one yourself.

Here is the code. If your confused about what's going on ask me. I can try to explain it
NOTE: Not something for newbies to try using. though your welcome to it.

Typed%20Array%20system wrote:

Typed array system template by GimmeMoreCoinz
'by GimmeMoreCoinz

'First we define our data types
'and a system for typed arrays

'constant is
dim localtype_values(10)
dim localtype_valnames$(10)
local_type_name$=""
local_type_index=0
local_type_instance=0

dim typenames$(150)
dim typeinstance_types(150, 150) '150 instances of each type allowed. The value of "this" instance will index the name of this type.
dim type_variable_names$(150, 10)
dim type_instance_variables(150, 150, 10) '150 different user defined types. 150 unique instances of each type, 10 different variables to each type

@main

'handle the types and process their values

for temp=1 to 150
for temp2=1 to 150
for instance_vars=1 to 10

''perform testing on the values
local_type_instance=instance_vars
index1=temp1
index2=temp2
gosub @get_type_values

local_type_values(instance_vars)=localvar

next getvarproperties

'put your code here to handle the type values

if local_type_index==1 'this object is say, a specific sprite
if local_type_index==2 'this object is something else

'you would have to code a @set_type_values after all of this, if you change the local variables
'but basically this allows you to keep the specific values of the current object in memory while you branch to handle it based on it's "type"
'and you can safefely assume in your branching that if local_type_name$=="Bomb_sprite" then gosub @handlebombsprite or something like that.
'I know this is a complex system but it just allows you to create more dynamic programs. :3

next temp2
next temp1

goto @main

@get_type_values 'this function will put the local values of this type into memory
local_type_index=typeinstances_types(index1, index2)
local_type_name$=typenames$(local_type_index, local_type_instance)
localvar=type_instance_variables(index1, index2, instance_vars)
return

This is similiar to using accesors or class members in higherlevel languages such as

bikeclass bike1;
bike1.pedal_speed=10

Except that access code would be longer in BASIC
it would be more like
type_names$(1)="bike"
type_variable_names$(1, 1)="pedal_speed"
type_instance_variables(150, thisinstance, 1)=10 "fast
'thisinstance is 1 out of 10 copies of the class named Bike.
'you could call it thisbike to be less confusing

This is the same as in C++ going
mybikeclass bike_1
bike_1.pedal_speed=10
I hope this makes sense
the reason there are only 150 type names is because you can only have 150 unique type names
and the reason there are (150, 150, 10) for the other things (var names and variable values)
is because you can have up to 150 , OF 150 of each unique type.
So you can have 150 unique "types" and 150 copies of EACH unique type
and each unique type has 150 values for the name of it's variables
and 150 unique values for it's 10 non unique variables
I hope this makes some sense to the more experienced programmers ;3

[Edited by Gimmemorecoinz]

Got a project? PM ME on here!
Youtube: lostkitty64x
Want help with coding? PM ME! PM ME PM ME!! XD
FC: WIll post later.
Systems I own: ds lite, 3DS, PC/gaming, steam platform. I play alot of games. Just ask ! Minecraft anyone? :D

bobliefeld

Anyone know if it's possible to specify an offset when using DATA / RESTORE / READ?

eg:

@mydata
DATA 1,2,3,4,5,6,7,8
DATA 8,7,6,5,4,3,2,1

RESTORE @mydata + 8
READ T

.. to start reading from the second line of DATA

I could use loads of labels or have a loop that just reads the data into nowhere until it hits the offset and then start actually reading the data but both are a bit wasteful in their own ways.

bobliefeld

InsertPi

bobliefeld wrote:

Anyone know if it's possible to specify an offset when using DATA / RESTORE / READ?

eg:

@mydata
DATA 1,2,3,4,5,6,7,8
DATA 8,7,6,5,4,3,2,1

RESTORE @mydata + 8
READ T

.. to start reading from the second line of DATA

I could use loads of labels or have a loop that just reads the data into nowhere until it hits the offset and then start actually reading the data but both are a bit wasteful in their own ways.

I'm not sure if that is possible... What I do is

@MYDATA
DATA 1,2,3,4,5,6,7,8
DATA 8,7,6,5,4,3,2,1
<blank line>
RESTORE @MYDATA
FOR I=9 TO 16
READ ArrayOfYourChoice(I)
NEXT

This specific code has not been tested yet, as I always use double dimention arrays with DATA, so let me know if there are any problems.

Oh and btw if you get a "undefined array" or similar error, just put DIM ArrayThatYouAreUsing(Number of "slots" useable in this array (you can choose)) like DIM ARRAY(5).

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

X:

InsertPi

FINALLY! I have a texture pack system with easy-install working with no problems! ! I will try to post the QRs today, along with instructions on installing/making textures.

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

X:

Gimmemorecoinz

Here's a tiny update: I have the design for the advanced smash bros engine down now. The one that will incorperate the new features of the update.
if you want an idea of how the engines going to be built check my template typed array code.
Characters will be stored as typed arrays.
The system will be more complex though and feature a much larger codebase. Probably a couple thousand lines of code for the entire engine plus menus plus etc. I will not have much left.. after this to work with.

Got a project? PM ME on here!
Youtube: lostkitty64x
Want help with coding? PM ME! PM ME PM ME!! XD
FC: WIll post later.
Systems I own: ds lite, 3DS, PC/gaming, steam platform. I play alot of games. Just ask ! Minecraft anyone? :D

InsertPi

Gimmemorecoinz wrote:

Here's a tiny update: I have the design for the advanced smash bros engine down now. The one that will incorperate the new features of the update.
if you want an idea of how the engines going to be built check my template typed array code.
Characters will be stored as typed arrays.
The system will be more complex though and feature a much larger codebase. Probably a couple thousand lines of code for the entire engine plus menus plus etc. I will not have much left.. after this to work with.

So. Many. Constant. Updates. D:<

(lol)

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.

X:

swordx

I finally came up with a story for DA2. Unlike the first, this one will be very story heavy. However, I'll be doing gameplay first.

swordx

InsertPi

I think I have found a way to remove/place blocks in Raycraft, but I need to know if it'll work:

ROW(1,1)=1
'Will be editable later
@LEVELDAT
DATA ROW(1,1),ROW(1,2)...
'This is the way the data for the world is displayed

Is this possible to work?

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

X:

ramstrong

IAmAPerson620 wrote:

I'm not sure if that is possible... What I do is

@MYDATA
DATA 1,2,3,4,5,6,7,8
DATA 8,7,6,5,4,3,2,1
<blank line>
RESTORE @MYDATA
FOR I=9 TO 16
READ ArrayOfYourChoice(I)
NEXT

This specific code has not been tested yet, as I always use double dimention arrays with DATA, so let me know if there are any problems.

It's not possible. What that will do is to put values 1-8 into Array[9-16].
Why don't you just use a string and MID$ into it? That's how I usually do it, anyway.

Regarding your other post: Why don't you try it and see? I don't think putting variables into DATA statement will work, though. I'd just as soon keep a separate array.

[Edited by ramstrong]

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

Let's just call a spade, a spade.

InsertPi

Here we go! Raycraft version Alpha 1.0 is finally here!

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.

X:

boot

Raycraft is awesome but my l and r buttons are broken. I was trying to make it so you could turn with y and b but when ever I walked forward it turned to the left. I was wondering how I could succsesfully do what I'm tryingto do edit: nm I fixed it

[Edited by boot]

Just your average talking boot. FC: 0791-4881-1672 for Smash and Pokemon.

InsertPi

boot wrote:

Raycraft is awesome but my l and r buttons are broken. I was trying to make it so you could turn with y and b but when ever I walked forward it turned to the left. I was wondering how I could succsesfully do what I'm tryingto do edit: nm I fixed it

Glad you like it!

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.

X:

noxuss

I was wondering if you guys could help me clear up my mess of code. Like, maybe there's other ways to do what I was trying to do? Thanks, ask any questions if you have 'em.

Code:

ACLS:BGMSTOP
LOCATE 9,11 : COLOR 15
PRINT "┌──────────────┐"
PRINT " │START TO PLAY!│"
PRINT " └──────────────┘"

@TITLELOOP
WAIT 1
IF BTRIG()==1024 THEN GOTO @GAMESTART
GOTO @TITLELOOP

'-----

@GAMESTART
ACLS
LOCATE 13, 10: BGMPLAY 4: PRINT "START!": WAIT 240: CLS
BGFILL 1,0,0,63,63,10,0,0,0
SPSET 0,64,2,0,0,0
SPOFS 0,128,128,1
SPSET 2,194,2,0,0,0
SPOFS 2,64,64,1
SPANIM 2,2,30,0
XP=0
PRINT "XP: "; XP
LEVEL=1
PRINT "LEVEL: "; LEVEL
BUL=0
GOTO @PLYRCONTROLS

'-----

@PLYRCONTROLS
SPREAD (0),X,Y
IF BUL==1 THEN GOTO @HITCHECK
@MOVEBTTNS
IF BTRIG()==1 THEN GOTO @MOVEUP
IF BTRIG()==2 THEN GOTO @MOVEDOWN
IF BTRIG()==4 THEN GOTO @MOVELEFT
IF BTRIG()==8 THEN GOTO @MOVERIGHT
IF BTRIG()==16 THEN GOTO @SHOOT
GOTO @PLYRCONTROLS

@MOVEUP
SPOFS 0,X,Y-16,30
SPCHR 0,76
SPANIM 0,3,15,1
ATT$="UP"
GOTO @PLYRCONTROLS

@MOVEDOWN
SPOFS 0,X,Y+16,30
SPCHR 0,68
SPANIM 0,3,15,1
ATT$= "DOWN"
GOTO @PLYRCONTROLS

@MOVELEFT
ATT$= "LEFT"
SPOFS 0,X-16,Y,30
SPCHR 0,72
SPANIM 0,3,15,1
GOTO @PLYRCONTROLS

@MOVERIGHT
ATT$= "RIGHT"
SPOFS 0,X+16,Y,30
SPCHR 0,64
SPANIM 0,3,15,1
GOTO @PLYRCONTROLS

'-----

@SHOOT
IF ATT$== "RIGHT" THEN GOTO @SHOOTRIGHT
IF ATT$== "LEFT" THEN GOTO @SHOOTLEFT
IF ATT$== "UP" THEN GOTO @SHOOTUP
IF ATT$== "DOWN" THEN GOTO @SHOOTDOWN

@SHOOTRIGHT
SPREAD(0),X,Y
SPSET 1,35,1,0,0,1
SPOFS 1,X,Y,1
BUL=1
WAIT 1
SPOFS 1,X+64,Y,30
WAIT 30
BUL=0
SPCLR 1
GOTO @PLYRCONTROLS

@SHOOTLEFT
SPREAD(0),X,Y
SPSET 1,35,1,0,0,1
SPOFS 1,X,Y,1
WAIT 1
BUL=1
SPOFS 1,X-64,Y,30
WAIT 30
BUL=0
SPCLR 1
GOTO @PLYRCONTROLS

@SHOOTUP
SPREAD(0),X,Y
SPSET 1,35,1,0,0,1
SPOFS 1,X,Y,1
WAIT 1
BUL=1
SPOFS 1,X,Y-64,30
WAIT 30
BUL=0
SPCLR 1
GOTO @PLYRCONTROLS

@SHOOTDOWN
SPREAD(0),X,Y
SPSET 1,35,1,0,0,1
SPOFS 1,X,Y,1
WAIT 1
BUL=1
SPOFS 1,X,Y+64,30
WAIT 30
BUL=0
SPCLR 1
GOTO @PLYRCONTROLS

@HITCHECK
IF SPHITSP(1,2)==TRUE THEN GOTO @ENEMYHIT

@ENEMYHIT
XP=XP +5
CLS
PRINT "XP: "; XP
GOTO @PLYRCONTROLS

noxuss

ramstrong

noxuss wrote:

I was wondering if you guys could help me clear up my mess of code. Like, maybe there's other ways to do what I was trying to do? Thanks, ask any questions if you have 'em.

You probably want to just post the QR code for something this long. The init could be group together. I'd create the bullet sprite in the init as well. That way, you can skip the WAIT command in @SHOOT without any trouble. @SHOOT can be one function, with different parameters. Learn ARRAY variables and use that for direction. Skip the WAIT command in starting screen and @SHOOT function.

Looks great so far! Please continue developing the game. Once you have the logic down pat, start adding sound effects.

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

Let's just call a spade, a spade.

noxuss

ramstrong wrote:

You probably want to just post the QR code for something this long. The init could be group together. I'd create the bullet sprite in the init as well. That way, you can skip the WAIT command in @SHOOT without any trouble. @SHOOT can be one function, with different parameters. Learn ARRAY variables and use that for direction. Skip the WAIT command in starting screen and @SHOOT function.

Looks great so far! Please continue developing the game. Once you have the logic down pat, start adding sound effects.

I love you community on here ! Hmm, I see what you mean, thanks. Does anyone know of any simple array tutorials? Because I haven't dealt with them before, and I'm eager to learn .

noxuss

damolii

@IAmAPerson620 Amazing........ but my R key has issues. It works only after I blow on it like 50 times. And only temporarily. Good game though

@noxuss Oh GOD (just playing with ya XD). There are things that concern me though. 1: Don't use GOTO for the directions, try GOSUB. Maybe that would be nicer. Also, try BUTTON() instead of BTRIG. I have the feeling that when you press the directional button, the sprite or whatever stops at a coordinate, and you have to press the button again. Am I right??

I don't have a 3DS so what do I put here? -Damolii

noxuss

damolii wrote:

@IAmAPerson620 Amazing........ but my R key has issues. It works only after I blow on it like 50 times. And only temporarily. Good game though

@noxuss Oh GOD (just playing with ya XD). There are things that concern me though. 1: Don't use GOTO for the directions, try GOSUB. Maybe that would be nicer. Also, try BUTTON() instead of BTRIG. I have the feeling that when you press the directional button, the sprite or whatever stops at a coordinate, and you have to press the button again. Am I right??

I tried using GOSUB but I couldn't get it working, it was as if it was treating GOSUB as GOTO. yesss, you're right about that button thing

noxuss

Sorry, this topic has been locked.