[QUOTE=Dvd;45654167]Correct.
Correct. The assert(...) statements help prevent you from accidentally typing something that doesn't make any sense -- there is no such thing as a die with less than 4 sides. A more stringent assert might check that 'sides' is one of the following: 4, 6, 8, 10, 12, 20, or 100.
This is probably the most confusing line for a new programmer. It's easy to look at it in reverse.
[code]for ii in range(0,5):
print("hello")[/code]
This is a for-loop in Python. Everything indented after this is going to be repeated, for some amount of times. How many times will "hello" be printed?
You need to understand that the for-loop in Python is just iterating over every object in a collection. "Ok, but I don't have a collection. I just want to print hello repeatedly!"
Sure, but your collection is the *number* of times that hello will be printed.
The function range(a,b) returns a list of numbers starting at a and ending at b - 1. e.g.: range(0,5) == [0, 1, 2, 3, 4]
Therefore when we loop over every element in that range, we will loop 5 times (the number of elements). "ii" is just a name applied to the current element of the loop -- it will in this case successively refer to 0, 1, 2, 3, and 4 depending on which iteration of the loop is in progress.
Look at it this way:
If you only have one d6, how do you roll 3d6? You roll that one die repeatedly, adding the result as necessary. That's exactly what this code does. It takes a description of the number of sides (>= 4) and the number of die you want to roll (> 0) and will calculate a sum from that based on repeatedly generating random integers.
Correct. The following are equivalent in almost all programming languages:
[code]b += a
b = b + a[/code]
Likewise, you have:
[code]b -= a
b = b - a
b *= a
b = b * a[/code]
et cetera.[/QUOTE]
This was all hugely helpful. Thanks a ton! I think I understand everything you've got going on in that section now, and how I could apply that to some other things. This is great stuff.
Now here's the next section, which I think I understand:
[code]def calculateAttributeScore():
score = getDiceSum(6, 3) #Defines "score" as the sum of three 6-sided die
if score >= 16: #if that sum is equal to or greater than 16...
bonus = getDiceSum(6, 1) #defines the bonus as 1D6
score += bonus #...add a bonus dice.
if bonus == 6: #if the bonus was a 6
score += getDiceSum(6, 1) #add another bonus die
return score #totals the dice rolls[/code]
This part is pretty straightforward. You're just defining a command called "calculateAttributeScore" and applying those rules I outlined already, but in a simpler format. I get the commands and I get the syntax. The next section is where my understanding starts falling apart.
[code]DEFINED_ATTRIBUTES = ["Physical Strength",
"Physical Beauty",
"Physical Prowess",
"Physical Endurance",
"Mental Affinity",
"Mental Endurance",
"Intelligence",
"Speed"]
charAttributes = []
for attribute in DEFINED_ATTRIBUTES:
score = calculateAttributeScore()
charAttributes.append(score)
print(attribute, score) #print the attribute and score[/code]
I don't really understand anything about what's going on in this section. I mean, I get the end result. This is where everything comes together, and you tell it to execute the [I]calculateAttributeScore[/I] command for each of the attributes, but I don't understand the commands you're actually giving, or how they were set up. Could you explain this section in a bit more depth, when you get the time? Thanks again! This is helping more than you know!
[QUOTE=Big Dumb American;45654471]This part is pretty straightforward. You're just defining a command called "calculateAttributeScore" and applying those rules I outlined already, but in a simpler format. I get the commands and I get the syntax. The next section is where my understanding starts falling apart.
[code]DEFINED_ATTRIBUTES = ["Physical Strength",
"Physical Beauty",
"Physical Prowess",
"Physical Endurance",
"Mental Affinity",
"Mental Endurance",
"Intelligence",
"Speed"]
charAttributes = []
for attribute in DEFINED_ATTRIBUTES:
score = calculateAttributeScore()
charAttributes.append(score)
print(attribute, score) #print the attribute and score[/code]
I don't really understand anything about what's going on in this section. I mean, I get the end result. This is where everything comes together, and you tell it to execute the [I]calculateAttributeScore[/I] command for each of the attributes, but I don't understand the commands you're actually giving, or how they were set up. Could you explain this section in a bit more depth, when you get the time? Thanks again! This is helping more than you know![/QUOTE]
This probably looks far more complicated than it actually is.
I'm defining a list of valid attributes -- in this case, my list is called "DEFINED_ATTRIBUTES". Go back to my other post where I talked about how the for-loop in Python works. It simply iterates (looks at) every object in a collection.
What are the objects in the collection DEFINED_ATTRIBUTES?
"Physical Strength", "Physical Beauty", "Physical Prowess", "Physical Endurance", "Mental Affinity", "Mental Endurance", "Intelligence", "Speed"
These labels (called 'strings') are what you kept writing out, repeatedly. What I've done is wrap them into this list DEFINED_ATTRIBUTES so that I can refer to them in shorthand.
For instance, DEFINED_ATTRIBUTES[0] == "Physical Strength". Anywhere you want to talk about "Physical Strength", you can replace that with DEFINED_ATTRIBUTES[0]. This is called 'array indexing' -- we are retrieving the 0th (first) element of DEFINED_ATTRIBUTES.
charAttributes is being defined as an empty list -- there's nothing in there (yet!).
The for-loop is going to iterate over every element in DEFINED_ATTRIBUTES -- the same strings representing the attribute names.
During every iteration of the loop, 'attribute' will refer to the current element. So during the first loop iteration, 'attribute' == "Physical Strength", during the second loop iteration, 'attribute' == "Physical Beauty".
I calculate a 'score' value for each element by calling calculateAttributeScore() and I add (append) it to the list charAttributes. Then I call print(attribute, score) so that what you see is "Physical Beauty 23" or whatever, where '23' is the randomly generated score for that element. Incidentally, I just realized that the print command should maybe say:
print(attribute, ":", score)
That way you get a colon -- "Physical Strength : 23".
After the loop has finished, charAttributes is a list containing all of the randomly generated scores for the attributes, in the order that they were defined in DEFINED_ATTRIBUTES.
e.g.:
print(DEFINED_ATTRIBUTES[0], charAttributes[0])
will print "Physical Strength 23" (assuming that the score calculated for physical strength was 23) while
print(DEFINED_ATTRIBUTES[4], charAttributes[4])
prints "Mental Affinity 14". (assuming that the score calculated for mental affinity was 14)
Arrays are generally 0-indexed, meaning that the first element is element 0, not element 1.
Oh! I see it now! Thanks so much! This has given me a lot to work with, and a lot of fun new commands to test out on my own. My next goal is to take the character creation process one step further by attempting to create the game's skill list in the program and allow it to randomly pull skill programs, or let the user select his own. For those skill programs that alter attributes, I want it to then go back and adjust them as necessary. For instance, the "Bodybuilding" skill adds "2" to physical strength.
I've got a few ideas of how to get started on it, thanks mostly to the stuff you just showed me, so I'll get started tomorrow! I'm sure I'll have lots of questions, though. I appreciate all the help, and can't wait to keep picking your brain.
Does anybody here have experience with Android studio?
I need help with this: [url]http://stackoverflow.com/questions/25234341/android-studio-error-swt-folder-does-not-exist[/url]
Not exactly programming, but I need some help with bash and the terminal.
I want to print multiple lines without increasing the number of lines in the terminal.
Just like this, but for multiple lines.
[code]
for i in $(seq 1 100); do echo -en "$i\r"; sleep 0.1; done
[/code]
Is that even possible?
[code]for i in $(seq 1 100); do echo -en "$i\n$i\e[A\r"; sleep 0.1; done[/code]
This is not portable so don't count on it working everywhere.
<ESC>[A is an ANSI escape code to move the cursor up one line, and echo replaces \e with <ESC>. You can also insert it directly with ctrl-V ctrl-[.
I'm trying to get this Android Studio project to compile. I just downloaded it straight off github, and all the dependencies and libraries are all set up already, the earlier version compiled fine.
[IMG]http://s1.postimg.org/l4zmb9alr/export.png[/IMG]
For some reason, this damned thing doesn't want to build, and I've never used android studio for anything before, and I got like a week to add a feature to this project and this is a major road block. For starters, the google-play-services library is seen as a project, despite being a library. I don't know how google play services or how that links into android studio, but it's giving me an error like this.
[IMG]http://s17.postimg.org/70d9gxtq7/error2.png[/IMG]
It's probably something simple, but I need to code like a madman before the end of the week and this is taking up time I don't have. If you need any more information let me know.
Whats the most simple, pain free way of rendering text in OpenGL and GLFW?
[QUOTE=WTF Nuke;45665542]Whats the most simple, pain free way of rendering text in OpenGL and GLFW?[/QUOTE]
There is none.
But seriously, [url=https://en.wikibooks.org/wiki/OpenGL_Programming/Modern_OpenGL_Tutorial_Text_Rendering_01]here is a tutorial that may help[/url] with the general ideas. This won't support much beyond English and maybe a few others that are just as simple (EFIGS).
Other than that, try searching for "OpenGL text rendering" and clicking around.
The real pains are localization and internationalization. Rendering something like Arabic successfully is the true test.
So I've joined my school stem club. They want me to put together some aort of demo for the CS subcommittee to try to get people to join our club. Are there any ideas guys? (no i will not help you with your darkrp server)
[QUOTE=DoritoBandit;45671467]So I've joined my school stem club. They want me to put together some aort of demo for the CS subcommittee to try to get people to join our club. Are there any ideas guys? (no i will not help you with your darkrp server)[/QUOTE]
I can be your ideas guy if you want.
[QUOTE=cartman300;45671483][QUOTE=DoritoBandit;45671467]So I've joined my school stem club. They want me to put together some aort of demo for the CS subcommittee to try to get people to join our club. Are there any ideas guys? (no i will not help you with your darkrp server)[/QUOTE] I can be your ideas guy if you want.[/QUOTE]Okay what's your idea
[QUOTE=DoritoBandit;45671521]Okay what's your idea[/QUOTE]
What about some fancy graphics demo? Something like [URL="https://www.youtube.com/watch?v=d4IDGAsyIMo"]cracktros[/URL]?
Does anybody know where I can find some programming challenges, for C++, which I can use to reinforce my programming skills and learn more about the language? It would be nice if they started at an easier difficulty and got harder. Things like course assignments and other random exercises would be nice.
[QUOTE=Duskling;45673562]Does anybody know where I can find some programming challenges, for C++, which I can use to reinforce my programming skills and learn more about the language? It would be nice if they started at an easier difficulty and got harder. Things like course assignments and other random exercises would be nice.[/QUOTE]
[url]http://www.reddit.com/r/dailyprogrammer[/url] is pretty cool.
my teacher also recommended us [url]https://www.hackerrank.com/[/url] which i've never used myself but maybe you'd like it
So I'm making a small contra clone for that demo
Is iPython good both as a general python utility and a scientific tool?
Can I just random python apps with it or is that outside its purpose?
I don't like the default IDLE shit that comes with vanilla Python...
[i]Is[/i] visual studio express good for C++ or is it mostly just for C#?
[QUOTE=Mobon1;45684075][i]Is[/i] visual studio express good for C++ or is it mostly just for C#?[/QUOTE]
There is Visual Studio 20xx and Visual C++ 20xx express. Both do C++, Visual Studio does both plus VB I think as well as Windows form designer stuff. There is also Visual C# I think and Visual Basic.
[editline]14th August 2014[/editline]
I had no idea Visual Studio Express was even a thing. I'll go out on a limb and say that VS is probably THE best IDE for C++, so to answer your question: Yes. If you are talking about the compiler thats sort of a different thing.
can someone rename a copy of DarkRP to LostRP for me and keep the same core files like i want it to be a fully renamed copy of DarkRP but have the same files and where there is the names of who made it put Im Metro, Yourname, and Credit to DarkRP
[editline]13th August 2014[/editline]
thx :dance:
[QUOTE=ejcole7;45684692]can someone rename a copy of DarkRP to LostRP for me and keep the same core files like i want it to be a fully renamed copy of DarkRP but have the same files and where there is the names of who made it put Im Metro, Yourname, and Credit to DarkRP
[editline]13th August 2014[/editline]
thx :dance:[/QUOTE]
.... What? I hope you aren't being serious.
[QUOTE=G4MB!T;45684788].... What? I hope you aren't being serious.[/QUOTE]
Not being serious of what? i want to rename DarkRP to LostRP
[QUOTE=ejcole7;45684692]can someone rename a copy of DarkRP to LostRP for me and keep the same core files like i want it to be a fully renamed copy of DarkRP but have the same files and where there is the names of who made it put Im Metro, Yourname, and Credit to DarkRP
[editline]13th August 2014[/editline]
thx :dance:[/QUOTE]
how much will you pay me
[QUOTE=G4MB!T;45684788].... What? I hope you aren't being serious.[/QUOTE]
Just noticed it said "other than gmod" XD
For example i have vertex data and normal data for these vertices, and if i want to modify these vertices in a vertex shader, how would i get the correct normals after that in shaders? Obviously after modifying vertex position the normal won't stay the same. I'm using OpenGL 3+
Hey guys, this is really basic C code. I'm wondering if there's anything I missed as far as redundancy that might be a beginner mistake.
[code]
#include <stdio.h>
#define TODECIMAL .01
int main(void)
{
float
yearlyInterestRate = 0,
monthlyPayment = 0,
monthlyInterestRate = 0,
currentBalance = 0;
int
increment = 1;
printf("Enter amount of loan: ");
scanf("%f", ¤tBalance);
printf("Enter interest rate: ");
scanf("%f", &yearlyInterestRate);
printf("Enter monthly payment: ");
scanf("%f", &monthlyPayment);
monthlyInterestRate = (yearlyInterestRate / 12) * TODECIMAL;
while (currentBalance > 0)
{
currentBalance = (currentBalance * monthlyInterestRate) + (currentBalance - monthlyPayment);
printf("Balance remaining after payment #%d: %.2f\n", increment, currentBalance);
increment += 1;
}
return 0;
}
[/code]
[QUOTE=Cittidel;45685785]Hey guys, this is really basic C code. I'm wondering if there's anything I missed as far as redundancy that might be a beginner mistake.
[code]
#include <stdio.h>
#define TODECIMAL .01
int main(void)
{
float
yearlyInterestRate = 0,
monthlyPayment = 0,
monthlyInterestRate = 0,
currentBalance = 0;
int
increment = 1;
printf("Enter amount of loan: ");
scanf("%f", ¤tBalance);
printf("Enter interest rate: ");
scanf("%f", &yearlyInterestRate);
printf("Enter monthly payment: ");
scanf("%f", &monthlyPayment);
monthlyInterestRate = (yearlyInterestRate / 12) * TODECIMAL;
while (currentBalance > 0)
{
currentBalance = (currentBalance * monthlyInterestRate) + (currentBalance - monthlyPayment);
printf("Balance remaining after payment #%d: %.2f\n", increment, currentBalance);
increment += 1;
}
return 0;
}
[/code][/QUOTE]
Are you getting any errors at all? I'm not sure if this will fix any (if you are having any) but its mostly just styling changes and fixes for precision.
[code]
#include <stdio.h>
#define TODECIMAL .01
int main(void)
{
float yearlyInterestRate = 0.0f,
monthlyPayment = 0.0f,
monthlyInterestRate = 0.0f,
currentBalance = 0.0f;
int increment = 1;
printf("Enter amount of loan: ");
scanf("%f", ¤tBalance);
printf("Enter interest rate: ");
scanf("%f", &yearlyInterestRate);
printf("Enter monthly payment: ");
scanf("%f", &monthlyPayment);
monthlyInterestRate = (yearlyInterestRate / 12.0f) * TODECIMAL;
while (currentBalance > 0)
{
currentBalance = (currentBalance * monthlyInterestRate) + (currentBalance - monthlyPayment);
printf("Balance remaining after payment #%d: %.2f\n", increment++, currentBalance);
}
return 0;
}
[/code]
[QUOTE=G4MB!T;45685957]Are you getting any errors at all? I'm not sure if this will fix any (if you are having any) but its mostly just styling changes and fixes for precision.
[/QUOTE]
No errors or even warnings on gcc, and the results match up with my textbook. Something must have happened when I copied it from Sublime Text Editor. Thank you for reminding me about precision with the float suffix, I should re-read that section again.
So I posted this in WAYWO
[quote]
So for my College STEM Club I had to put together a quick presentation to demonstrate some aspect of computer science. Unfortunately I'm not even technically a freshman yet since school starts a week from now. I am simply a highschool graduate. This task fell upon me because the STEM club is 99% Engineers, 1 meteorologist, and 1 CS major (me). So I threw this together in FREEBASIC. The framerate is a lot better than the video makes it look like, but VLC can't record that fast I guess
[vid]http://webmup.com/TPD0e/vid.webm[/vid]
after that counter in the top left hits 0 the blocks randomize and the marios go back out to re-organize them. It's not exactly the most advanced demonstration of AI, but its concept I guess. Little robots that can make something out of chaos.
I'm also making a poster :D it's like being in Highschool again!
edit:
i'd love some suggestions about what I can do now. I basically stole the concept from the super mario 128 demo:
[media]http://www.youtube.com/watch?v=f5uCnbDrp9o[/media][/quote]
I need help with ideas. I want to make this little sorting engine more impressive since it's a demo.
here's the code, if anybody knows quickbasic/freebasic
[code]
#Include "fbgfx.bi"
Using FB
Randomize Timer 'use time as a seed for randomization
ScreenRes 800,600,24
Const FALSE = 0
Const TRUE = -1 'no true boolean in freebasic
Dim Shared DEBUG_MODE As Byte = FALSE
Type MOVEABLE
X As Integer 'location in coordinates
Y As Integer
X_WIDTH As Integer 'width in pixels, not in coordinates
Y_HEIGHT As Integer
X_LIM As Integer 'Rightmost part of image in coordinates
Y_LIM As Integer
X_DESTINATION As Integer 'where to put the block
Y_DESTINATION As Integer
MY_BLOCK_X As Integer 'where to pick up the block
MY_BLOCK_Y As Integer
IMG As Any Ptr
STATUS As String 'looking/picking
DIRECTION As String 'left/right
COUNTER As Integer '1/-1
BOOL_GRABBING_BLOCK As Byte
BOOL_DONE As Byte
ACTIVATED As Byte
Declare Constructor
End Type
Constructor MOVEABLE
STATUS = "LOOKING"
DIRECTION = "LEFT"
COUNTER = 0
BOOL_DONE = FALSE
BOOL_GRABBING_BLOCK = FALSE
End Constructor
Type BLOCK
X As Integer
Y As Integer
X_LIM As Integer
Y_LIM As Integer
ACTIVATED As Byte
Declare Constructor
IMG As Any Ptr
End Type
Constructor BLOCK
ACTIVATED = FALSE
End Constructor
'LOCAL VARIABLES
Dim Shared WORDART(40,30) As BLOCK '40x30 array of 20px blocks, totaling 800x600
Dim Shared MARIOS(40,30) As MOVEABLE
Dim Shared BACKGROUND As Any Ptr
Dim Shared COUNTDOWN As Short = 1500
Dim Shared DONE_COUNTER As Short
Dim Shared TOTAL_MARIOS As Short
BACKGROUND = ImageCreate(800,600)
BLoad "BACKGROUND.BMP",BACKGROUND
'INITIALIZE BOXES AND SHIT
Declare Sub READ_MAP_FILE
Declare Sub INIT_ENTITIES
Declare Sub REDRAW_ENTITIES
'MARIOS AI
Declare Sub MARIO_AI
Declare Sub LOOK_FOR_MY_BLOCK
Declare Sub GO_TO_DESTINATION
Declare Sub CHECK_DIRECTION
Declare Sub CHECK_PICKING
Declare Sub GTFO
'MANIPULATE THE WORLD
Declare Sub REORDER
For I As Integer = 0 To 40 'randomize locations. I should put this in the constructor
For Q As Integer = 0 To 30
MARIOS(I,Q).X = Rnd*800
MARIOS(I,Q).Y = Rnd*600
WORDART(I,Q).X=Rnd*800
WORDART(I,Q).Y=Rnd*600
Next
Next
READ_MAP_FILE()
INIT_ENTITIES()
'RANDOMIZE BLOCKS AND MARIOS
While Not MULTIKEY(SC_ESCAPE)
ScreenLock
Cls
REDRAW_ENTITIES
MARIO_AI
Print COUNTDOWN
Print TOTAL_MARIOS 'debugging
Print DONE_COUNTER
REORDER
ScreenUnLock
Sleep 1 'delat 1ms
Wend
Sub READ_MAP_FILE
Dim CURRENTLINE As String
Open "NVCCSTEMCLUB.TXT" For Input As #1
For Q As Integer = 1 To 30
Line Input #1,CURRENTLINE 'open the "map" file
For I As Integer = 1 To Len(CURRENTLINE)
If Mid(CURRENTLINE,I,1) = "1" Then 'parse each line and put a block and a mario in their corresponding slot in their arrays
WORDART(I,Q).ACTIVATED = TRUE
MARIOS(I,Q).ACTIVATED = TRUE
TOTAL_MARIOS+=1 'count total # of marios on screen
MARIOS(I,Q).X_DESTINATION = (I*20)
MARIOS(I,Q).Y_DESTINATION = (Q*20)
MARIOS(I,Q).MY_BLOCK_X = WORDART(I,Q).X
MARIOS(I,Q).MY_BLOCK_Y = WORDART(I,Q).Y
EndIf
Next
Next
End Sub
Sub INIT_ENTITIES 'initialize the blocks and marios
For I As Integer = 1 To 40
For Q As Integer = 1 To 30
If WORDART(I,Q).ACTIVATED = TRUE Then
WORDART(I,Q).IMG = ImageCreate(20,20,RGB(255,0,255))
BLoad "BOX.BMP",WORDART(I,Q).IMG
Put (WORDART(I,Q).X, WORDART(I,Q).Y),WORDART(I,Q).IMG,TRANS
EndIf
If MARIOS(I,Q).ACTIVATED = TRUE Then
MARIOS(I,Q).IMG = ImageCreate(16,26,RGB(255,0,255))
BLoad "MARIO-" + MARIOS(I,Q).STATUS + "-" + MARIOS(I,Q).DIRECTION + "-" & MARIOS(I,Q).COUNTER & ".BMP" ,MARIOS(I,Q).IMG
Put (MARIOS(I,Q).X, MARIOS(I,Q).Y),MARIOS(I,Q).IMG,TRANS
EndIf
Next
Next
End Sub
Sub REDRAW_ENTITIES 'redraw screen. obvs
Put(0,0),BACKGROUND
For I As Integer = 1 To 40
For Q As Integer = 1 To 30
If WORDART(I,Q).ACTIVATED = TRUE Then
Put (WORDART(I,Q).X,WORDART(I,Q).Y),WORDART(I,Q).IMG,TRANS
EndIf
If MARIOS(I,Q).ACTIVATED = TRUE Then
BLoad "MARIO-" + MARIOS(I,Q).STATUS + "-" + MARIOS(I,Q).DIRECTION + "-" & MARIOS(I,Q).COUNTER & ".BMP" ,MARIOS(I,Q).IMG 'set the mario image based on whether or not they're looking left/right or grabbing a block
Put (MARIOS(I,Q).X,MARIOS(I,Q).Y),MARIOS(I,Q).IMG,Trans
'Line(MARIOS(I,Q).X,MARIOS(I,Q).Y)-(WORDART(I,Q).X,WORDART(I,Q).Y)' 'Debugging stuff. draw line from mario to block
'Line(MARIOS(I,Q).X,MARIOS(I,Q).Y)-(MARIOS(I,Q).X_DESTINATION,MARIOS(I,Q).Y_DESTINATION),RGB(255,100,255)
EndIf
Next
Next
End Sub
Sub MARIO_AI
LOOK_FOR_MY_BLOCK
CHECK_PICKING
GO_TO_DESTINATION
GTFO
End Sub
Sub LOOK_FOR_MY_BLOCK
For I As Integer = 1 To 40
For Q As Integer = 1 To 30
If MARIOS(I,Q).BOOL_GRABBING_BLOCK = FALSE And MARIOS(I,Q).BOOL_DONE = FALSE Then 'go to the block in relation to mario's position
If MARIOS(I,Q).X < MARIOS(I,Q).MY_BLOCK_X Then
MARIOS(I,Q).X+=1
MARIOS(I,Q).DIRECTION = "RIGHT"
ElseIf MARIOS(I,Q).X > MARIOS(I,Q).MY_BLOCK_X Then
MARIOS(I,Q).X-=1
MARIOS(I,Q).DIRECTION = "LEFT"
End If
If MARIOS(I,Q).Y < MARIOS(I,Q).MY_BLOCK_Y Then
MARIOS(I,Q).Y+=1
ElseIf MARIOS(I,Q).Y > MARIOS(I,Q).MY_BLOCK_Y Then
MARIOS(I,Q).Y-=1
End If
End If
Next
Next
End Sub
Sub GO_TO_DESTINATION
For I As Integer = 1 To 40
For Q As Integer = 1 To 30
If MARIOS(I,Q).BOOL_GRABBING_BLOCK = TRUE Then 'if you have a block, go find where to put it
If MARIOS(I,Q).X < MARIOS(I,Q).X_DESTINATION Then
MARIOS(I,Q).X += 1
MARIOS(I,Q).DIRECTION = "RIGHT"
ElseIf MARIOS(I,Q).X > MARIOS(I,Q).X_DESTINATION Then
MARIOS(I,Q).X -= 1
MARIOS(I,Q).DIRECTION = "LEFT"
EndIf
If MARIOS(I,Q).Y < MARIOS(I,Q).Y_DESTINATION Then
MARIOS(I,Q).Y += 1
ElseIf MARIOS(I,Q).Y > MARIOS(I,Q).Y_DESTINATION Then
MARIOS(I,Q).Y -= 1
EndIf
If MARIOS(I,Q).X = MARIOS(I,Q).X_DESTINATION Then ' put the block down
If MARIOS(I,Q).Y = MARIOS(I,Q).Y_DESTINATION Then
MARIOS(I,Q).BOOL_DONE = TRUE
MARIOS(I,Q).BOOL_GRABBING_BLOCK = FALSE
MARIOS(I,Q).STATUS = "LOOKING"
EndIf
EndIf
End If
Next
Next
End Sub
Sub CHECK_PICKING
For I As Integer = 1 To 40
For Q As Integer = 1 To 30 'grab block if on top of block
If MARIOS(I,Q).X = MARIOS(I,Q).MY_BLOCK_X And MARIOS(I,Q).Y = MARIOS(I,Q).MY_BLOCK_Y And MARIOS(I,Q).BOOL_DONE = FALSE Then
MARIOS(I,Q).BOOL_GRABBING_BLOCK = TRUE
EndIf
MARIOS(I,Q).COUNTER = Not MARIOS(I,Q).COUNTER 'switch the animation file from 1 to -1 and back again
If MARIOS(I,Q).BOOL_GRABBING_BLOCK = TRUE Then
WORDART(I,Q).X = MARIOS(I,Q).X
WORDART(I,Q).Y = MARIOS(I,Q).Y - 20
MARIOS(I,Q).STATUS = "PICKING"
EndIf
Next
Next
End Sub
Sub GTFO
For I As Integer = 0 To 40
For Q As Integer = 0 To 30
If MARIOS(I,Q).BOOL_DONE = TRUE Then ' leave screen on left or right
If MARIOS(I,Q).X <=400 Then
If MARIOS(I,Q).X>=-20 Then
MARIOS(I,Q).X-=3
MARIOS(I,Q).DIRECTION = "LEFT"
EndIf
ElseIf MARIOS(I,Q).X >400 Then
If MARIOS(I,Q).X <= 820 Then
MARIOS(I,Q).X+=3
MARIOS(I,Q).DIRECTION = "RIGHT"
EndIf
EndIf
EndIf
Next
Next
End Sub
Sub REORDER
If COUNTDOWN = 0 Then
DEBUG_MODE = Not DEBUG_MODE 'switch debug mode back and forth
For I As Integer = 0 To 40
For Q As Integer = 0 To 30
WORDART(I,Q).X = Rnd*800 'randomize the blocks
WORDART(I,Q).Y = Rnd*600
MARIOS(I,Q).MY_BLOCK_X = WORDART(I,Q).X 'find the new blocks location
MARIOS(I,Q).MY_BLOCK_Y = WORDART(I,Q).Y
MARIOS(I,Q).BOOL_GRABBING_BLOCK = FALSE 'resut "booleans"
MARIOS(I,Q).BOOL_DONE = FALSE
Next
Next
COUNTDOWN = 1500
EndIf
COUNTDOWN-=1
End Sub
[/code]
edit: fuck comments in the code thing i quit im using freebasic commenting ( ' )
Protip: don't ever think that suddenly deciding to abstract an already established architecture (however badly designed and copypasted) is a bright idea.
Seriously. I decided "oh I might try abstracting the services that interface with the DAOs so I can reuse them with other projects" and now I'm in a rabbit hole that shows no signs of ever stopping. It doesn't help that I have no idea how to Spring.
[b]EDIT[/b]
Someone throw me a rope or something I need to get out of here
Sorry, you need to Log In to post a reply to this thread.