Forums

Topic: Petit Computer

Posts 7,701 to 7,720 of 9,618

TAINT_Zzyex

JLMan wrote:

MAINCOUNTL is the amount of frames elapesed. So it's no good. As an example, if you have a really laggy game with 2 frames per second, MAINCOUNTL would rise by 2 in a second.
@LOOP
Code here.
IF TIME$!=NOW$ THEN TIME=TIME+1
NOW$=TIME$
GOTO @LOOP

You are all vastly overcomplacaing this. just do-
@TIME
cls
PRINT""TIME""
TIME=TIME+1
GOTO @TIME
Shortest one here. Tested and approved!
how would one make it goe up per tap? Im having issues with that on a game called beet the clock, where you race a cpu by rappedly tapping.

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

X:

twinArmageddons

TAINT_Zzyex wrote:

JLMan wrote:

MAINCOUNTL is the amount of frames elapesed. So it's no good. As an example, if you have a really laggy game with 2 frames per second, MAINCOUNTL would rise by 2 in a second.
@LOOP
Code here.
IF TIME$!=NOW$ THEN TIME=TIME+1
NOW$=TIME$
GOTO @LOOP

You are all vastly overcomplacaing this. just do-
@TIME
cls
PRINT""TIME""
TIME=TIME+1
GOTO @TIME
Shortest one here. Tested and approved!
how would one make it goe up per tap? Im having issues with that on a game called beet the clock, where you race a cpu by rappedly tapping.

IF TCHTIME==1 THEN X=X+1

get in loser we're going titan hunting

TAINT_Zzyex

heres wut i have-
@attack
cls
hp=hp100
if tchtime==1 then hp=hp-dmg
dmg=1
vsync 1
if button()==1024 goto @store
goto @attack
nothing happens when i tap.

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

X:

TAINT_Zzyex

okeey disregard that. i just had the hp=100 in the loop, it should have been outside... lol.
Now, how do i run 2 loops at once (enemy loop and player loop)?

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

X:

TAINT_Zzyex

whenever i use gosub/return it says return without gosub. I will try again

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

X:

randomous

If anyone read my old comment about condensing data, I've already found a solution. Sorry for taking up forum space!

randomous

TAINT_Zzyex

Disregard that... (it only works when you guyz say it)
Due to the crappy system, dmg always surpasses the hp breaking point. (0) How do i stop this?
Ex;
@theblackdragon
PRINT "ENEMY HEALTH
PRINT ""hp""
hp==10
HP=HP-0.1
If hp==0 goto @bluerobin2
goto @theblackdragon (tbd will love this)
when ran, it goes past 0 into the negatives. Wut?

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

X:

Discostew

randomous wrote:

If anyone read my old comment about condensing data, I've already found a solution. Sorry for taking up forum space!

And I had a solution all ready too, which allowed condensing and expanding (to an extent).

Discostew

Switch Friend Code: SW-6473-2521-3817

Pixelrobin

@TAINT_Zzyex Living the risky life arn't you. I wouldn't do that If I were you.

Your problem is that you check for zero AFTER you subtract health. So The game would count "0" as -0.1. Just do <= instead of ==. <= stands for "smaller than or equal to" meaning anything in the negetives or 0 will be considered as dead.

@Discostew @randomous, I attempted to make random values based on a "seed" using wacky graph equations. It worked, but I couldn't really specify any range. Do you have any ideas of flexible random seed solutions? I would like people to be able to share their Battlewoods worlds without using qrs.

Everybody do a chirp. CHIRP.

Discostew

@randomous

CLEAR:ACLS
NUMP1=10:NUMP2=8
DIM P1(NUMP1),P2(NUMP2)
FOR I=0 TO NUMP1-11(I)=RND(100):NEXT
SORT 0,NUMP1,P1
FOR I=0 TO NUMP1-1:?P1(I);" ";:NEXT:?
SPL=NUMP1/NUMP2:IDX=0
FOR I=0 TO NUMP2-1P2(I)=0OR (P1(IDX)+P1(IDX+SPL-.001))/2:?P2(I);" ";:IDX=IDX+SPL:NEXT:?
END

No sure if this was the kind of thing you wanted.

[Edited by Discostew]

Discostew

Switch Friend Code: SW-6473-2521-3817

randomous

@Bluerobin2 Are you looking to just generate a world based on random numbers generated from a seed? In that case, you can use the Linear Congruental Generator (errr below):

SEED=(whatever)

@SEEDRAND
RAND=SEED
RETURN

@RAND
RAND=(RAND*7+4444)%59049
RETURN

The randomness isn't all that great (in fact, it's terrible!), but it should be all right for games. This has a period of 59049 numbers, so if you generate more than that, they'll start to repeat in EXACTLY the same order (depending on the context, this might not matter as much as you think). For instance, if your first X numbers are 5, 669, and 7923, after 59049 numbers, you'll get the sequence 5, 669, 7923 again. There's not much I can do about this without making the algorithm EXTREMELY slow. The seed can be any number from 1 to 59049 (don't make it 0). You should call the SEEDRAND function only once (probably right before you generate the map or whatever you're doing). Here's some example code making use of it:

@START
SEED=RND(59049)
GOSUB @SEEDRAND
@LOOP
GOSUB @RAND
X=RAND
(do some stuff)
GOTO @LOOP

I know the seed is random in this example, but if you keep the seed around (or save it after it is chosen randomly), you can use the same value again to get the same stream of random numbers. If you need help, let me know. Also, I'm sure @Discostew will come up with something better, as this is probably the worst way to generate random numbers (it's just quick, that's all).

All that being said, you can actually double seed the generator if you like. You can pick another number instead of 4444, as long as it's not divisible by 3 (this is very important). For instance, you can choose a random set of 2's,4's, and 5's and multiply them together to get a number to replace 4444 (but it must be consistent for all random numbers generated in order for it to be a seed). If you want, I can provide the code for this "double" seed.

[Edited by randomous]

randomous

randomous

Discostew wrote:

@randomous

CLEAR:ACLS
NUMP1=10:NUMP2=8
DIM P1(NUMP1),P2(NUMP2)
FOR I=0 TO NUMP1-11(I)=RND(100):NEXT
SORT 0,NUMP1,P1
FOR I=0 TO NUMP1-1:?P1(I);" ";:NEXT:?
SPL=NUMP1/NUMP2:IDX=0
FOR I=0 TO NUMP2-1P2(I)=0OR (P1(IDX)+P1(IDX+SPL-.001))/2:?P2(I);" ";:IDX=IDX+SPL:NEXT:?
END

No sure if this was the kind of thing you wanted.

That's... actually what I came up with as well lol. You said this works for expanding as well?

randomous

Discostew

@randomous To an extent. If you go to double the entries, the numbers will just double up rather than average.

Discostew

Switch Friend Code: SW-6473-2521-3817

randomous

@Discostew That's true... I guess you can't really make more data from nothing lol.

randomous

Discostew

@randomous Well, so long as you have at least 2 entries (point A to point B), you can generate a transition to it with more points. The code I had dealt with just taking the average of two values, but could be modified to take a percent of both, one having a higher percent if the extra point is closer to it (if that makes any sense).

Like, imagine you have 2 points, and you want to expand it to 4. The first and last would be those two points, but the point in between would be a percentage of the two. The second point being at the 33% mark, and the third being at the 67% mark. If expanding to 3 from 2, it would basically be the average at 50%. Expand to 5, and you'd have extra points at 25%, 50%, and 75%. See where I'm getting at?

Discostew

Switch Friend Code: SW-6473-2521-3817

Pixelrobin

@randomous hey thanks again! So umm lets say I want a random range with a limit. Since I have to call this multiple times, anyway to scale down the max limit without ruining the chances of any number? Thanks so much for your help. I guess I got spoiled with most programming languages giving you the option to set the seed.

Everybody do a chirp. CHIRP.

randomous

@Bluerobin2 Let's say you want to generate numbers between 0 and 99:

GOSUB @RAND
NEWRAND=RAND%100

It is VERY IMPORTANT that you do not overwrite RAND. If you're worried about doing so, you can take a performance penalty and redo the @RAND and @SEEDRAND functions as follows:

@SEEDRAND
IRAND=SEED
RETURN

@RAND
IRAND=(IRAND*7 + 4444)%59049
RAND=IRAND
RETURN

This way, you'll have an "internal" random number, and overwriting RAND won't have any effect on generation. Also note that the 7 and 59049 should NOT be altered in any fashion. Those numbers were chosen for a reason, and changing them might ruin the randomness.

@Discostew I see what you mean, don't worry lol. I'm using this for a pattern recognition project I'm working on for Petit Computer. If it works... well, we'll have a cool tool for future programs (well, I think it's cool anyway).

[Edited by randomous]

randomous

twinArmageddons

more aottg progress
today i added an npc that's basically just a clone of your character (i wanted to make it a new character but i have limited sprite space) and it runs around looking for the titan if it exists and tries to attack using 3dmg if the titan is dead then it just wanders around. since this requires a lot more processing which can create lag, i'm going to make it optional. it can also be targeted by the titan and it can be killed and grabbed and eaten. if it's grabbed and you kill the titan fast enough, then the npc stays alive i'm also working on making the character rotate a bit depending on where you shoot the hook, but SPANGLE is one of the most annoying sprite commands :/ i'm also working on a carry option to carry the npc to the supply depot if it runs out of gas. if the npc runs out of blades then it tries to find the fastest way to the supply depot. npc will probably not have the ability to carry so good luck if you run out of gas the 3dmg is practically useless without gas. the titans also received minor ai improvements, so instead of attacking a general area, they'll adjust where they attack based on your character's speed, the position of the hooks, and the current position. so it basically tries to predict your movement. i also did a bit of work on special attacks, and i have 2 finished. i'm having a lot of trouble balancing titan shifting though :/ release date is still tba because i still have so many sprites to finish >.>
Edit: npc can now save you if you're grabbed but i wouldn't trust it bc it isn't very smart yet, but i'm trying to make it detect when you're in danger and try harder to rescue you than kill the titan
Edit 2: sometime i may add flares so the npc may actually have some importance (besides support) and i'm trying to make the ai a lot smarter so it's like you're actually playing with someone

[Edited by twinArmageddons]

get in loser we're going titan hunting

Sorry, this topic has been locked.