Author Topic: Fastest/Most Optimized way to move a character around the homescreen  (Read 7365 times)

0 Members and 1 Guest are viewing this topic.

Offline dinosteven

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 194
  • Rating: +10/-1
    • View Profile
Re: Fastest/Most Optimized way to move a character around the homescreen
« Reply #30 on: July 28, 2013, 09:54:07 am »
Ah, but with the most recent code, with your optimization of using DelVar ADelVar B instead of 1->A, A and B are now 0. It would've caused some problems with that first erasing output, but I moved that to the bottom. Now the first line in the loop is the min(max(stuff)), which will move it to 1. And even if C=34 or something, max(1,0+1) = 1.
Code: [Select]
DelVar ADelVar BClrHome
Repeat Ans=45
max(1,min(16,A-(Ans=24)+(Ans=26→A // If Ans=24, max(1,min(16,0-1))=1. If Ans=26, max(1,min(16,0+1))=1. If otherwise, max(1,min(16,0))=1 still. Yay.
max(1,min(8,B-(C=25)+(C=34→B //Same applies for C. The max(1,X) guarantees it, and putting A and B as 0 with DelVar makes it so that the maximum it can be from the beginning is 1, which is fine. :)
Output(B,A,"*
Repeat Ans
getKey→C
End
Output(B,A,"   //This would've caused some problems - it would've given out of bounds. But I moved it to the end.
End
:) Test it!
« Last Edit: July 28, 2013, 09:59:33 am by dinosteven »

Offline Sorunome

  • Fox Fox Fox Fox Fox Fox Fox!
  • Support Staff
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 7920
  • Rating: +374/-13
  • Derpy Hooves
    • View Profile
    • My website! (You might lose the game)
Re: Fastest/Most Optimized way to move a character around the homescreen
« Reply #31 on: July 28, 2013, 09:56:27 am »
oooooooh, i get it now, that is pretty clever! :D

THE GAME
Also, check out my website
If OmnomIRC is screwed up, blame me!
Click here to give me an internet!