Forums

Topic: Petit Computer

Posts 9,241 to 9,260 of 9,618

Petitlife935

i need some serious help. if i put a little guy in the middle of my screen how do i make him move using the analog stick. ps im on a 2DS

Petitlife935

Lego-Meister

@Petitlife935 Here's one example:

ACLS:CLEAR

SPSET 0,32,1,0,0,0

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

SPOFS 0,X,Y
GOTO @LOOP

Untitled

[Edited by Lego-Meister]

Some programmers pride themselves on how many more lines of code they can write. I pride myself on how many less.

boot

Hey @bigdog00 or @bigdog_00 cant remember which... what is the latest version of CincOS

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

Petitlife935

[quote=Lego-Meister]@Petitlife935 Here's one example:

ACLS:CLEAR

SPSET 0,32,1,0,0,0

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

SPOFS 0,X,Y
GOTO @LOOP

that didn't really help. i want to be able to load a sprite and then have him move up, down left right on the screen.

Petitlife935

Discostew

Lego-Meister wrote:

@Petitlife935 Here's one example:

ACLS:CLEAR

SPSET 0,32,1,0,0,0

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

SPOFS 0,X,Y
GOTO @LOOP

Untitled

The X and Y assignments need to be swapped, as the first 2 bits (values 1 and 2) are for Up/Down, and the latter 2 bits (4 and 8) are for Left/Right. Also, I would suggest placing "VSYNC 1" at the beginning of the loop so it doesn't just zip in one direction.

Discostew

Switch Friend Code: SW-6473-2521-3817

Lego-Meister

@Discostew Yeah, I just typed it up on PTC Utilities. Didn't test it.

@Petitlife935 This was just an example. You could change the sprite and do anything you want with it.

Some programmers pride themselves on how many more lines of code they can write. I pride myself on how many less.

bigdog00

boot wrote:

Hey @bigdog00 or @bigdog_00 cant remember which... what is the latest version of CincOS

Uh... When I get my new PC I will upload the newest one. It has a touchscreen based lock and faster startup time. It is way better, and it allows you to make 2 custom shortcuts on the desktop. There are many more features, but I have yet to release it. Give me a few weeks.

I like petit computer! Asphault 3d is awesome!

X:

Slayer

How do I spawn a sprite randomly in the world? I'm trying to spawn a desert eagle randomly in the world. And in different parts of the map if it's possible? I've got a loop for it if it respawns too.
Thanks in advance, now I have a crash to fix.

[Edited by Slayer]

I have nothing really to say about myself.

LeviCelJir

Slayer wrote:

How do I spawn a sprite randomly in the world? I'm trying to spawn a desert eagle randomly in the world. And in different parts of the map if it's possible? I've got a loop for it if it respawns too.
Thanks in advance, now I have a crash to fix.

SPX=RND(50000)-RND(50000)
SPY=RND(50000)-RND(50000)
SPSET ID,da,da,da,da,da
@LOOPYDOOPY
SPOFS ID,SPX,SPY
GOTO @LOOPYDOOPY
and for player movement make sure to do the opposite like this
moving right:
SPX=SPX+1
moving left:
SPX=SPX-1
moving up:
SPY=SPY+1
moving down:
SPY=SPY-1
that basic jist

Hi I'm Levi and I like Bloopys :^)

Petitlife935

can anyome tell me the spset for the red wizard/necromancer guy?

Petitlife935

Discostew

Petitlife935 wrote:

so is that like 0,0,0,0,0,96?

No, the order is as follows

SPSET control number, sprite character number, palette number, horizontal rotation, vertical rotation, order of precedence [, width, height]

Using only the required fields (those in brackets are optional), using control number 0, the first palette of 16 sets, no horizontal/vertical rotation, and is in front of all background layers and console layer, it would be like this

SPSET 0, 96, 0, 0, 0, 0

The width and height are optional. When not used, they will take on 16x16 pixels, which in this case is what you want anyways.

[Edited by Discostew]

Discostew

Switch Friend Code: SW-6473-2521-3817

Petitlife935

actualy the red wizard is 95 and 0,96,0,0,0 is the blue wizard female i need to know the spset for the red wizard guy. thanks for your help so far though

Petitlife935

Petitlife935

nevermind i got it it was 0,195,0,0,0. but i understand there are different views of the red wizard like up, down, left and right,. after every walk command like for up its:

IF B AND 1 THEN Y=Y-1

would i put the up figure right after it so it looks like ths:

IF B AND 1 THEN Y=Y-1
SPSET 0,199,0,0,0,0

or is there another way?

Petitlife935

Discostew

SPSET should only be used when you need to create/reset a sprite. When you want to just change the sprite graphics, orientation, etc, use SPCHR instead. Using SPCHR will retain numerous attributes to the sprite, like position (set with SPOFS), scale (SPSCALE), and angle (SPANGLE), whereas using SPSET will reset them. SPCHR cannot be used on a sprite that was not first created with SPSET.

Discostew

Switch Friend Code: SW-6473-2521-3817

Petitlife935

ok, so ever where i put SPOFS 0,199,0,0,0,0 it gives me an error on where ever i put that code on. in this show me where id put this on.

ACLS:CLEAR
BEEP 37

@LOOP
VSYNC 1
B=BUTTON()
IF B AND 1 THEN Y=Y-1
IF B AND 1 THEN Y=Y+1
IF B AND 1 THEN X=X-1
IF B AND 1 THEN X=X+1

SPOFS 0,X,Y
GOTO @LOOP

up sprite is: 199
down sprite is: 195
left sprite is: 196
right sprite is: 192

Petitlife935

Discostew

Petitlife935 wrote:

ok, so ever where i put SPOFS 0,199,0,0,0,0 it gives me an error

That is because you mistook SPOFS for SPSET.

Discostew

Switch Friend Code: SW-6473-2521-3817

Sorry, this topic has been locked.