Where is the random movement coming from

Skip to first unread message

Ian Sullivan (S)

Oct 13, 2021, 9:07:07 AM10/13/21
to Pyret Discuss
Just making a game off a provided template and I need the objects to scroll left to right. I have it so it detects when the x coordinate is more then 0 and if it is, it subtracts 10 from the value. If the x value is less than 0 then it should move it 600 pixels right and leave the x coordinate the same, but it seems to just appear in a random location. I just need to fix this so it teleports to the right of the screen at the same height.

Here is all the code, I think the problem is in the "Danger and Target movement section" but I have tried everything to fix it and nothing happens.

Ian Sullivan (S)

Oct 13, 2021, 9:09:17 AM10/13/21
to Pyret Discuss
meant to say it should leave the y-coordinate the same

Joe Gibbs Politz

Oct 13, 2021, 3:23:11 PM10/13/21
to pyret-...@googlegroups.com
Great question.

You're running into some limitations in how what we call the background code or teachpack set up the game. The code imported at
import shared-gdrive("bootstrap1-game-teachpack.arr", "0B32bNEogmncOa0w3SzVackFaVGc") as T
is making these decisions about where the danger and target start (and randomizing them), and you have little control over it when using the Bootstrap: Algebra setup.

If you want to have more control (even up to getting Madeleine dashing and wall-bouncing over those spikes; love Celeste btw) it might be useful to look at some of the material from Bootstrap: Reactive:

This course lays out how to build games and simulations where you have much, much more control than in the Algebra game setup, which it seems like you've somewhat mastered.

You received this message because you are subscribed to the Google Groups "Pyret Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyret-discuss+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pyret-discuss/8fc2b2b5-1d50-43a2-8b0b-56b5d8f77a5cn%40googlegroups.com.

Reply all
Reply to author
0 new messages