News:

Building a 3D Ray Tracer  By stevmjon

Main Menu

About Terraria style

Started by Koganwel, August 22, 2011, 01:51:32 PM

Previous topic - Next topic

Koganwel

For a map using DATA, (1,1,1,0,0,1,1....), the collisions are calculated on the co-ordinates of Map relating to those of the indicated object, usually "Player".

But what does of a random map of Terraria style? Does one use the same principle to calculate the collisions?

stevmjon

i just looked at the game Terraria, and it looks fun and involved to play.

there are different ways of going about using data for tile collisions.
> when pasting the random tiles, save this data in an array (0=no surface  1=surface).
> when pasting random tiles, create another map level (for reference only), and paste tile 0 & tile 1 where needed, but don't draw this map level. just refer to it with "peekleveltile" command.

there are examples about the website.

hope this helps, stevmjon
It's easy to start a program, but harder to finish it...

I think that means i am getting old and get side tracked too easy.

Koganwel

Merci, stevmjon.

I understand better what to do. I am more at ease with the scenarisation than with the concepts inherent in the programming which require a mathematical logic and a very good knowledge of the forces and limits of the commands.

I excavated in the forum and in the examples and demonstrations offered by Kevin, very generous in this respect, the same applies to the games conceived by the members of the forum.

Therefore, I will explore what you propose, I still thank you.

Yes, Terraria is a play strategic than it seems it with the first access. It is necessary to be patient and methodical. Very patient. The four boss are not part of fun! Alas, they give us, once killed, essential ingredients to obtain the best tools and the best weapons. There is of course an alternative: TerrariViewer - to furnish its inventory with objects which one did not know to deserve differently...

P.-S. : translation from French (Québec) by Word 2007. My English is word-by-word - ask Kevin about that !

Koganwel

Let us return in Terraria a short moment.

The blocks seem to be dimensions 16x16. The player must destroy three blocks in height and two in width "to make his bed". I suppose that the "box of collision" of the player is approximately 42 pixels in height and hardly 24-28 pixels in width.

LemonWizard

Hey.
You could also use raw arrays but that's getting a bit deeper.
Or you could skip tiles and use a different style of collision. I dunno you said terraria style.

Koganwel

Hello, everyone.


I have two theoretical questions to propose to you rather than my project like such, I am not ready with you to subject it to obtain your lights. What I will at the proper time do without fault, I do not fear to resort to assistance.


A) At the time of the jump of the player, it seems to to me that the jump is carried out according to an angle as marked as 80 degrees. What gives a jump in acute warhead, i.e. a marked high jump which is summarized with only some steps forwards - approximately three or four  or five widths of the sprite. In reality (let us think of a jumper of distance), the jump is less in height than in distance: the athlete does not even jump to 45 degrees, it would lose over the length of the jump. How to carry out that in programming? I did not know to still find the good algorithm.


B) In reality (always), the gravitation is not that of the planet Jupiter, the return towards the ground is... light - except on the great heights, then the subject can reach a speed of 500 km/h (if I am not mistaken). It seems to to me that my player too quickly crosses the height of the screen to the ground. But to decrease the gravitation does not solve the problem; then, the player tends to jump too high - and it turns over towards the ground at a speed also fulgurating. How can one slow down (a little) the falling speed so that the whole appears... natural?

Merci pour votre attention.

stevmjon

hey koganwel

here is a demo of a jump / fall that is smooth and looks natural.

if you jump off the edge, the fall speeds up over time (but it has a limit).
the main algorithm is:    jump=-7*cos(0-180)    *NOTE: the -7 ensures the sprite jumps upwards*

hope this helps.  i have documented the code as much as i can.

  stevmjon
It's easy to start a program, but harder to finish it...

I think that means i am getting old and get side tracked too easy.

Koganwel

I felt to have to resort to trigonometry to obtain a natural jump; alas, trigonometry and me let us not be the best friends of the World, also I sought a less complex solution, nearer to my capacities.

I "will play" with your code, adding impossibility of jumping while supporting continuously on UP, then my character appearing over-excited - making me think of the zombis of Terraria which are obstinated to jump a vertical obstacle while my character, well with the shelter, hammers them blows of sword or mass on the head.

I have also to understand when the ball touches with the wall-elevator, I have thus to add to the texts of debugging co-ordinates X and Y of the ball, in order to make climb the ball of a natural movement, rather than to give the impression of teleporting.

I am extremely surprised to carry out what few codes can achieve like work. In writing, one can hardly hope to make some much with few means, it is necessary to deserve the `Aaah!' and the `Oooh! ' of the admiring readers...

Thank you again.