# math

0 favourites
• 14 posts
From the Asset Store
Aliens are invading our planet! Solve the math question, and attack the alien with your laser. Covers addition, subtract
• is there a way to learn the math on the games or these stuffs couldn't be learned??? i'm talking about math of sprites , layouts , window , ... see this example made by Kyatric

Example capx in the capx you will see something like that :

Sprite2.X - (Sprite2.Width/2) ?? so what does this mean? and how did you know this kind of math ? are there some common Equation like that or they are uncountable? also if it uncountable ... is there a math book that can help us on that? i know this one of the weirdest thing you ever hear but in my country they doesn't focus in shapes on math only one term of shapes on secondary school with only basics like get square meters and so on..

• You learn by practicing, and examining examples.

Sprite2.X - (Sprite2.Width/2)

It means exactly what it says: The X position of the sprite, minus half of its width. It's completely logical, just think about it.

• yes i know its what it what it looks like.

see the example has an equation looks like this :

Sprite2.X - (Sprite2.Width/2) >= Sprite.X - (Sprite.Width / 2)

so the question is why he didn't use this :

Sprite2.X >= Sprite.X

what's the differences? also is there something that can help me in some other equations?

...how can i keep exam examples if i don't know what i'm looking for? that why i'm asking if there is some common examples that i can try to check the differences.

• ## Try Construct 3

Develop games in your browser. Powerful, performant & highly capable.

Construct 3 users don't see these ads
• The width of Sprite and Sprite2 are different, so it can't be shortened.

In addition to what Davioware said it often helps to draw a diagram out to visualize. Also if you know what you are trying to calculate you can find a formula for it with google most of the time.

• ok lets say i have 3 kind of enemies and i want them to with this order:

-enemy1,(space = the enemy2 width),enemy2,(space = enemy3 width),enemy3

-in math ways lets say enemy1.width = 20 and enemy2.width = 40 , enemy3.width = 60 so it will be like this :

enemy1 then space = 40 then enemy2 then space = 60 then enemy3 so it will be a row with 3 enemies with this kind of stuffs .

another example lets say i have a sprite 5x5 then i scaled to fit 1000x3000 and i want in the start of layout to have another sprite to have a position on every 50 in width so it will be a line with about 20 sprite... and so many other examples so how can i search them on google? because i never tried to search equations on google

• I would suggest you to check Khan Academy since it has some very good video lessons on almost all math related subjects, from the very basic to more advanced ones.

As of your examples, I think you need some understand of basic programming as well, maybe how a loop works. Besides that, tackle a problem one step at a time, asking yourself each basic question that will form the big answer you are looking for. If you can't find it by "googling" it, probably you are asking the wrong questions.

If I understand your example right, you have 20 "cubes" that you need to be put side by side, for a start. Since you know the amount, you can just spawn the right quantity with a "repeat 20 times" loop and a "create" action.

So, if you want to put a cube next to other, from the left to the right, how would you do? The first one needs to be at 0 distance from the left side, so it is right at the side. The second one needs to be at 1 times the width of one cube, so it it right next to the first. The third one at 2 times the width of one cube, so it gives space for the first two. The forth at 3 times the width... As you may have noticed there is pattern here:

next X position = number of cubes * width of one cube.

As an addendum, the repeat has an index, called "loopindex", that returns the number of the current repetition, starting from 0. Back to the repeat loop, you need to fill in the X of it (next X position) with that expression, so, we know now that the repeat has a loopindex that returns a number, if we are creating cubes at each repeat, that loopindex tells us the number of cubes it had created. The width of a cube is a basic expression, you can see it at the expressions help.

So, into the "Create object" action, in the X position, you can translate our "equation" to:

X = loopindex * cube.width

But if you need to add a space between each one, so it it not all side by side? Well, like it is said, you need to add. So to keep the layout divided by 50, so you have 20 cubes evenly spaced, you must add 45 pixels of space to the 5 pixel cube.

X = loopindex * (cube.width + 45)

and that is it, if I understand you right. 20 cubes, 5 pixels wide, evenly distributed on a 1000pixels layout.

The only real tricky part here is the loopindex, but it is part of the sintax of construct "language", you will need to learn it. Construct is very forgiving in that area, with not much to learn, but you will need basic programming knowledge and basic math knowledge, no way around it.

• dEspadas thanks for your help , i have a question in khan academy what should i learn? math? or what?? also which lessons should i study that has some math on shapes and these kind of stuffs.

also someone told me to learn the basics of game design is that true? or it is completely different?

• if your making games then you cant go wrong to read ANYTHING related to game design. Theres no reason not to read and learn from everything you can

• yes but there is alot of books of that kind of subject which one will be the most helpful for construct2 users?

and should i read it all or just the part that i'm stick with it?

http://blog.wolfire.com/2009/07/linear-algebra-for-game-developers-part-1

• Hi Zsangerous,

I totally understand your frustration, in an earlier post on this thread, someone mentioned googling for the answer, and if you don't get the right answers, you are probably asking the wrong questions. OK so what are the questions? I have a grasp of basic mathematics however, I was not sure what questions to ask. Not everyone wishes to have their equations solved for them once, as that will only help them once. My son got straight A's in math in high school because his teacher was vivid in his explanations. Visualizing the causes and effects, helped to determine how much he was able to absorb, understand and implement. When he got to college his professors refused to explain the equations, insisting he just memorize the formulas. His math grades fell. I think it would be nice to have a thread here where the people who have these sorts of questions, can meet up with people who will help with explanations of the processes. "Give me a fish I eat for a day, Teach me to fish and I eat forever". (or something like that).

Anyway I searched "linear algebra" etc. Looked around, went back to a site where I learned a great deal already. I found this video (in a series) that looks like it will be helpful to me. It will seem like kids play to most. I graduated from high school in the 70's, got an "A" in algebra, yet the years eroded all the memories.

Anyway if you get a chance here is a beginners video, linked to a series that might be helpful.

I will be studying these in my spare time.

Good luck Zsangerous!

UPDATE

Here is another good explanation of factoring for beginners

another on basic algebra

If anyone else knows of any good math tutorials, would you mind posting links here? Got link?

• Val , first of all thanks for learning us what you have used in maths ^^

2nd thing, for my self i had some of the best marks on school also the first year in university was for the basic math and i had A+ on it (alhamudllah) so where is my problem??

my problem was in house managing the math on shapes , most of our math is just numbers without any shapes stuffs. so i have asked someone on arabic topic (because i'm arabic) about which way it that i should know or learn about shapes and numbers???

most of the answers were some stuffs like these videos about the basics or videos about some stuffs that i don't need it to learn because i know it 100% ^^ but someone told me there are some books that can help you alot the books has a different style of studying, the book is learning how you can manage the math as it in a real life... when i read that book i thought it will not help me but it really helped me. in the book all the problems has been solved but when come to me i have no problem thats why i should know my problem in the game then i try to solve it.

for example if i want the middle point on the y axis on the window it will be windowhight/2    >>> we used window because he want it on window

>>> we used hight because of Y

>>> we use /2 because it = the middle.

in this case we should know the problem to know how to fix it.the book support alot of managing examples with different ways to solve it just to know that " there isn't any difficult on math "

the book is arabic book but maybe there is a translated one and his name looks like this : (????????? ??????) in translate it will be (the fun on math) or something like that ^^ i hope everyone to read it if you can ^^

also if you have any helps that can helps us it would be cool if you share it with us , many people need to learn and we are one of them ^^

• Hi Zsangerous!

Perhaps the math is the same everywhere, but the language may differ for people. I had a visit from my son who is a 3D artist, programmer, and special effects director. I asked him what lerp was and he did not know what the heck I was talking about. When I showed it to him he said "Aha!... linear interpolation". He knew the function, yet by a different name. I learned basic math in the 60's, fast forward 50 years and try to help a youngster with division etc. and so much has changed in the way they teach it! I'm a person who has a ton of difficulty until I can visualize in my mind what is really happening with the equation. I would love to see a great math tute on this site that explains the formulas, along with a capx that can be manipulated for learning purposes. If you are like me Zsangerious, you could probably recreate with great precision the colors and pattern of a piece of fabric or something that you have not set eyes on for years (or in my case decades). Yet it is difficult to remember math equations not visualized. I can totally visualize the basic math, and can balance my checkbook in my head. Yet I don't seem to understand things that come second nature to the left brained masses.

• 14 posts