Log In  


I suck at describing anything, hence the beautiful diagram provided. I've been taking cracks here and there trying to break it down, get the little bits and pieces of this working before diving into the whole thing to very mixed results.

Current issue is getting (and understanding) those fancy squares to move and loop along a designated path.

Yes, I was consumed by the ro-sham-bo minigame brainrot that were in a handful of GBA games. Some guidance would be much appreciated

https://imgur.com/a/d3SeOQB

Because the thing™ didn't upload



If you meant to post the diagram, it didn't come through.


Diagram now uploaded successfully


I'm not too familiar with the games you mention, but if you want to move a square along a path that's a bigger square, you really just need a couple of things: the four corners of the big square, the x,y of the small square and the Current x,y direction of the small square. If you start at the top left, then your small square moves right until it gets to the top right corner, then you change directions so it's moving down but not lest or right. When it gets to the bottom right corner, change directions so it's moving left but not up or down. Keep changing directions at each corner to move around the loop.

Sorry I'm on an android phone now otherwise I'd type up a simple example in the EDU edition online, but those are really the basics.


Actually, even if it's a crude and hasty one, a reference point would be nice.


1
path={
 l=20,
 t=20,
 r=100,
 b=70
}

squares={
 {
  x=20,
  y=20,
  c=8
 },
 {
  x=40,
  y=20,
  c=12
 },
 {
  x=60,
  y=20,
  c=11
 }
}

function _update()
 for s in all(squares) do
  if (s.y==path.t and s.x<path.r) s.x+=1
  if (s.x==path.r and s.y<path.b) s.y+=1
  if (s.y==path.b and s.x>path.l) s.x-=1
  if (s.x==path.l and s.y>path.t) s.y-=1
 end
end

function _draw()
 cls()
 for s in all(squares) do
  rect(s.x-4,s.y-4,s.x+4,s.y+4,s.c)
 end
end

It will technically skip the very corner pixel in the upper right, lower right and lower left since the values will change the same frame as the next condition is checked. But you asked for crude! So that's a puzzle for you to solve.


I had my suspicions on forloops and tables being the answer. Seeing it laid out, however, there was no way I'd make meaningful progress in a way that wouldn't lead to demotivating frustration. Very much appreciated!



[Please log in to post a comment]