Author Topic: The animal crossing team.  (Read 14901 times)

0 Members and 1 Guest are viewing this topic.

Offline Augs

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 306
  • Rating: +30/-29
    • View Profile
Re: The animal crossing team.
« Reply #30 on: October 01, 2012, 01:37:10 pm »
Ok, Will do. I can do that real quick. Should be done by wednesday as I am not very productive.

Offline someone

  • LV3 Member (Next: 100)
  • ***
  • Posts: 49
  • Rating: +9/-0
    • View Profile
Re: The animal crossing team.
« Reply #31 on: October 01, 2012, 03:21:11 pm »
Here is a small preview of my game.
Hi Augs, I saw that some parts of the code that could be modified to read easier the code, like using "elseif" where it can be applied & adding a variable where you call the same chunk several times & so on. (There was even a crash when navigating up or down, due to being out of range in a table)

I've attached a file with the changes.

Offline Augs

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 306
  • Rating: +30/-29
    • View Profile
Re: The animal crossing team.
« Reply #32 on: October 01, 2012, 05:00:30 pm »
Thanks, I had a look at that. This is the first contribution, care to join the team?

The code is great but it I prefer the XMapCoord and YMapCoord, It will prove to be useful later, you will see. Did you find this? TheGame = "lost"
« Last Edit: October 01, 2012, 05:04:15 pm by Augs »

Offline someone

  • LV3 Member (Next: 100)
  • ***
  • Posts: 49
  • Rating: +9/-0
    • View Profile
Re: The animal crossing team.
« Reply #33 on: October 01, 2012, 05:49:56 pm »
Thanks for the invitation. In general, I like to help whenever I can & have time to do so, but I wouldn't like to be counted as an active member of a team. So I would like to pass the offer.

I suppose that XMapCoord and YMapCoord will be used for "warps" to other maps (most likely using those coordinates as new points), but you'll be limited to a determined number (Currently 64 or 100, depending if you count the margins or not). Calling a map by an ID is better as you will not be limited by the squares & you still have the character's coordinates which you can then compare. Although as you say, I don't know how you plan on creating the screens (though right now looks like those Zelda games for handheld)

As for the string, I know is a local joke here, but never cared to read what is really about...

Offline ElementCoder

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 611
  • Rating: +42/-2
    • View Profile
Re: The animal crossing team.
« Reply #34 on: October 02, 2012, 02:36:10 am »
As for the string, I know is a local joke here, but never cared to read what is really about...
*ElementCoder lost the game

The Game is a mental game in which you try to avoid thinking about The Game. The moment you realize you are playing The Game, you've thought about it and therefore lost. When you lose you have to tell everyone in you direct surroundings that you've lost The Game. The rules are quite simple:
1. Everyone in the world participates in The Game. You cannot not play The Game and you can never stop playing.
2. Whenever you think about The Game, you lose.
3. You have to tell people in your surroundings that you've lost the game.
« Last Edit: October 02, 2012, 02:36:44 am by ElementCoder »

Some people need a high five in the face... with a chair.
~EC

Offline Augs

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 306
  • Rating: +30/-29
    • View Profile
Re: The animal crossing team.
« Reply #35 on: October 02, 2012, 12:57:11 pm »
I updated the sprites. Now the houses look better.

Offline Augs

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 306
  • Rating: +30/-29
    • View Profile
Re: The animal crossing team.
« Reply #36 on: October 05, 2012, 06:14:16 pm »
Here is an update on the project.

-Added trees
-Added water
-Added moving screens

Edit: made finished the map
« Last Edit: October 11, 2012, 01:27:40 pm by Augs »

Offline ElementCoder

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 611
  • Rating: +42/-2
    • View Profile
Re: The animal crossing team.
« Reply #37 on: October 13, 2012, 02:07:45 pm »
Wow you're making good progress with this :D
P.S. The tree on the top right has a misalinged hitbox, you can walk behind the lower log, but not behind the second log. I suspect this should be the other way around? :P

Some people need a high five in the face... with a chair.
~EC

Offline Augs

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 306
  • Rating: +30/-29
    • View Profile
Re: The animal crossing team.
« Reply #38 on: October 13, 2012, 03:05:40 pm »
Thanks. I did not notice this. I also need to fix the bug where you can't get out of the house. However I will not do so now as the JC2 MP beta is up and I just got the new pokemon. Yeah this is a pretty big project for my 3rd project.

Offline DJ Omnimaga

  • Former TI programmer
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55828
  • Rating: +3151/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • DJ Omnimaga Music
Re: The animal crossing team.
« Reply #39 on: October 13, 2012, 03:08:17 pm »
Glad to see more updates :)
In case you are wondering where I went, I left Omni back in 2015 to form CodeWalrus due to various reasons explained back then, but I stopped calc dev in 2016 and am now mostly active on the CW Discord server at https://discord.gg/cuZcfcF



T-Shirt store | Reverbnation | Facebook | Youtube | Twitter | Spotify

Offline Happybobjr

  • James Oldiges
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2325
  • Rating: +128/-20
  • Howdy :)
    • View Profile
Re: The animal crossing team.
« Reply #40 on: October 13, 2012, 08:04:28 pm »
This looks really cool.  Its nice to see a larger interest in Lua
School: East Central High School
 
Axe: 1.0.0
TI-84 +SE  ||| OS: 2.53 MP (patched) ||| Version: "M"
TI-Nspire    |||  Lent out, and never returned
____________________________________________________________

Offline someone

  • LV3 Member (Next: 100)
  • ***
  • Posts: 49
  • Rating: +9/-0
    • View Profile
Re: The animal crossing team.
« Reply #41 on: October 15, 2012, 02:28:06 pm »
Hi Augs, I would recommend you to change how you store the images, so that you can reduce lines of codes when you look at them on the map (You would need to replace "..." with the actual string, I just skip it because is to long to post).
Also, you could move them out of the startup function you created & have them as global variables (well, that's it if you plan to reuse the "startup()" function to reset the game in order to skip recreating the graphics all over again...

Code: [Select]
platform.apilevel = '1.0'

---------------
-- CONSTANTS --
---------------
object = {}    -- C = Cobble, D = Door, G = Grass, L = Log, S = Dirt, W = Wood, X = Black, / = RoofL, | = RoofR, @ = Window, # = Leaf, ~ = Water, ` = Shop, ' = Post
object["C"] = image.new(...)
object["D"] = image.new(...)
object["1"] = object["D"]
object["2"] = object["D"]
object["G"] = image.new(...)
object["S"] = image.new(...)
object["W"] = image.new(...)
object["X"] = image.new(...)
object["/"] = image.new(...)
object["|"] = image.new(...)
object["@"] = image.new(...)
object["`"] = image.new(...)
object["~"] = image.new(...)
object["'"] = image.new(...)

frontObject = {} -- L = Log, # = Leaf,
frontObject["L"] = image.new(...)
frontObject["#"] = image.new(...)

And then, when you are painting them, you can use the following code:
Code: [Select]
--------------------------------------------------------------------------------
function on.paint(gc)
--------------------------------------------------------------------------------
  Doors()
 
  sprites(gc, object)         -- Background
  gc:drawImage(Person,(Xcoord-1)*BlockSize,(Ycoord-1)*BlockSize)
  sprites(gc, frontObject)    -- Foreground
 
end
--------------------------------------------------------------------------------
function sprites(gc, table)
--------------------------------------------------------------------------------
  for i = 1, #Map do          -- length of table -> 10
    for ii = 1, #Map[i] do    -- length of row -> 10
      sprite = string.sub(Map[i],ii,ii)
      if table[sprite] then
        gc:drawImage(table[sprite], BlockSize*(ii-1), BlockSize*(i-1))
      end
    end
  end
end

Edit: Joined functions when you paint something in the back and front of the character...
« Last Edit: October 16, 2012, 12:04:15 pm by someone »

Offline Augs

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 306
  • Rating: +30/-29
    • View Profile
Re: The animal crossing team.
« Reply #42 on: October 16, 2012, 10:04:41 am »
Thanks for the help. I will use parts of this. I won't use all of it since I don't understand some of it. But thanks anyway.

Offline someone

  • LV3 Member (Next: 100)
  • ***
  • Posts: 49
  • Rating: +9/-0
    • View Profile
Re: The animal crossing team.
« Reply #43 on: October 16, 2012, 11:50:00 am »
Which part you don't understand? It would be best to explain what the code is & does and use it (unless there's a better way than what I posted...) rather than skip it completely just because it seems confusing.

I'll explain the same code I posted earlier, if there's something that is not clear or you still don't fully understand, just ask ;):
Code: [Select]
platform.apilevel = '1.0'

---------------
-- CONSTANTS --
---------------
-- Since the images never change, I've moved them at the beginning in order to have them as global constants.
-- To store them, I've used a table, in where the key (what goes inside the brackets) matches the ASCII used for the sprites. This will greatly simplify the code when you look in the map for an specific sprite.

object = {}    -- C = Cobble, D = Door, G = Grass, L = Log, S = Dirt, W = Wood, X = Black, / = RoofL, | = RoofR, @ = Window, # = Leaf, ~ = Water, ` = Shop, ' = Post
object["C"] = image.new(...)
object["D"] = image.new(...)
object["1"] = object["D"]        -- This is just a reference to the sprite above
object["2"] = object["D"]        -- Same as above
object["G"] = image.new(...)
...
object["'"] = image.new(...)

-- Also, I've separated the items that will be painted on the front in another block
frontObject = {} -- L = Log, # = Leaf,
frontObject["L"] = image.new(...)
frontObject["#"] = image.new(...)

And the explanation of the second part of the code:
Code: [Select]
--------------------------------------------------------------------------------
function on.paint(gc)
--------------------------------------------------------------------------------
  Doors()
 
  sprites(gc, object)           -- Function for painting Background sprites, needs parameter "gc" for Graphic Content functions
  gc:drawImage(Person,(Xcoord-1)*BlockSize,(Ycoord-1)*BlockSize)    -- Character sprite
  sprites(gc, frontObject)     -- Function for painting Foreground sprites, needs parameter "gc" for Graphic Content functions
 
end
--------------------------------------------------------------------------------
function sprites(gc, table)
--------------------------------------------------------------------------------
  for i = 1, #Map do          -- length of table -> 10
    for ii = 1, #Map[i] do    -- length of row -> 10
      temp = string.sub(Map[i],ii,ii)
      if table[temp] then   -- Checks if key exists in the table before painting
        gc:drawImage(table[temp], BlockSize*(ii-1), BlockSize*(i-1))
      end
    end
  end
end
When you have a table, you can know its size if you use "#". Maybe that's the confusing part you have (since I had posted it before & you didn't included it).
« Last Edit: October 16, 2012, 11:58:57 am by someone »

Offline Augs

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 306
  • Rating: +30/-29
    • View Profile
Re: The animal crossing team.
« Reply #44 on: October 16, 2012, 01:03:51 pm »
I don't understand the table[temp] thing.