What exactly would you do (in tile sheet sprites) to make the tile mesh together with another custom tile?
I'm really, really confused.
EDIT: For more clarification, it's like how the Example Block meshes with the dirt block on the tile sheet.
Main.tileMerge[Type][mod.TileType("ModTileBlock")] = true;
How do you make it take gel but shoot flames?
item.shoot = 145;
item.useAmmo = 23;
Here's some very basic homing code.
I hope that's enough to get you started.Code:public override void AI() { Vector2 acceleration = Vector2.Normalize(Main.MouseWorld - projectile.Center); //convert the distance from this projectile to the mouse to a unit-vector projectile.velocity += acceleration * 1.5f; //add one and a half of my acceleration to my velocity projectile.velocity *= 0.95f; //slow down slightly, i.e. apply drag projectile.rotation = projectile.velocity.ToRotation(); //calculate the direction that this projectile is going and rotate to face that way. }
public NPC FindNearest(Vector2 pos)
{
NPC nearest = null;
float oldDist = 1001;
float newDist = 1000;
for (int i = 0; i < Terraria.Main.npc.Length - 1; i++)
{
if (Terraria.Main.npc.friendly == true)
continue;
if (Terraria.Main.npc.active == false)
continue;
if (Terraria.Main.npc.damage == 0)
continue;
if (nearest == null)
nearest = Terraria.Main.npc;
else
{
oldDist = Vector2.Distance(pos, nearest.position);
newDist = Vector2.Distance(pos, Terraria.Main.npc.position);
if (newDist < oldDist)
nearest = Terraria.Main.npc;
}
}
return nearest;
}
snip
Main.npc[i].friendly
new error when I change it to nearest instead of Main.MouseWorld:
nearest does not exist in this current context
public NPC FindNearest(Vector2 pos)
{
NPC nearest = null;
float oldDist = 1001;
float newDist = 1000;
for (int i = 0; i < Terraria.Main.npc.Length - 1; i++)
{
if (Terraria.Main.npc[i].friendly == true)
continue;
if (Terraria.Main.npc[i].active == false)
continue;
if (Terraria.Main.npc[i].damage == 0)
continue;
if (nearest == null)
nearest = Terraria.Main.npc[i];
else
{
oldDist = Vector2.Distance(pos, nearest.position);
newDist = Vector2.Distance(pos, Terraria.Main.npc[i].position);
if (newDist < oldDist)
nearest = Terraria.Main.npc[i];
}
}
return nearest;
}
public override void AI()
{
Vector2 acceleration = Vector2.Normalize(nearest - projectile.Center);
projectile.velocity += acceleration * 1.5f;
projectile.velocity *= 0.95f;
projectile.rotation = projectile.velocity.ToRotation();
}
NPC nearest = this.FindNearest(projectile.Center);
Wait, does this mean that all the mods that I just installed won't work now..? Dayum.v0.8.2
-Added SaveCustomData and LoadCustomData hooks for GlobalItem
-Added client/server sync hooks for ModWorld
-Added client/server sync hooks for ModPlayer custom biomes
-Added hook for complete control over all item tooltips
-Added CanUseAbility and UseAbility hooks for ModMountData
-Added RecipeFinder and RecipeEditor for easy recipe editing
-Added hook for drawing NPC health bars
-Support for preserving unloaded mod tiles
-Name property for mod textures are now assigned
-Animations for opening/closing modded chests
-Made Main.DrawHealthBar public
-Made Terraria.Graphics.Shaders.GameShaders public
-Fixed bug where ConsumeItem is called for wrong item
-RecipeGroup bugfixes
I hope I didn't make any mistake with uploading anything, v0.8.1.2 and v0.8.2 look too similar...
Anyways, I highly highly recommend backing up all your save files before using this update. It makes several changes to how stuff are saved.
With all that being said, this update's basically "everything else" that doesn't fit into any category that we didn't have time to do earlier. Hopefully this takes care of most of the miscellaneous stuff before we move onto other major features like biomes. There's lots of cool stuff here that I'm happy about, especially ModifyTooltips, RecipeFinder, RecipeEditor, and preserving unloaded tiles. There might also be tons of bugs related to these features though, so make sure to report any you find!
One more thing I want to say. Progress this summer won't be nearly as fast as the complete craziness that was last summer. Not only am I tired from a particularly exhausting year of school, but I also want to make some progress on a game of my own. I also got a graphics tablet a couple of days ago and want to teach myself how to draw. Progress will still be definitely faster than while I was in school, but it won't quite match last year when I was basically working on this all day every day.
No, no mods need to be updated for this update.Wait, does this mean that all the mods that I just installed won't work now..? Dayum.
only if you updateWait, does this mean that all the mods that I just installed won't work now..? Dayum.
Thank you!No, no mods need to be updated for this update.
Also, please backup your player and world, for your safety!
You'll need to add the following to the list of if checks.my projectile is now homing in on enemies even if they are beyond walls.
is there an if statement that I can throw in FindNearest to stop this or do I have to rewrite everything?
also
YAY for the new update
if (!Collision.CanHit(pos, 1, 1, Main.npc[i].position, Main.npc[i].width, Main.npc[i].height))//Don't target NPC's I can't see
continue;
NPC nearNPC = FindNearest(projectile.Center);
Vector2 acceleration = Vector2.Zero;
if (nearNPC != null)
{
acceleration = Vector2.Normalize(nearNPC.position - projectile.Center);
} else
{
//this bit is optional, but you can get your projectile to accelerate differently here
}
projectile.velocity += acceleration * 1.5f;
projectile.velocity *= 0.95f;
projectile.rotation = projectile.velocity.ToRotation();
Adding new slots?And adding new slots is not available yet?
Yeah, something like the Tome slot from Exxo Avalon.Adding new slots?