So I am trying to figure out how to make my sprite move and jump. I tried doing it with:
gfx_TransparentSprite(sprite, x, y);
and then changing the x or y based on which arrow key the player presses. Then I am pasting a blank sprite to cover up the extra sprite that gets made.
This does not look that good. So I am looking through the Oiram code but I can't find where Oiram's movement is coded. Can someone please point me to it and/or explain how to do it?
Thank you
You may want to look into these two wiki pages about buffering graphics and performing partial redraw Smile

Buffering: https://github.com/CE-Programming/toolchain/wiki/GraphX-Library:-Buffering

Partial Redraw: https://github.com/CE-Programming/toolchain/wiki/GraphX-Library:-Partial-Redraw
Do those also explain how to make it so that the sprites don't get a white box around them when they overlap? I thought adding "transparent" to the sprite command does that but I still see a white box around my objects.
Sorry for my nooby questions and thanks for taking your time.
So it looks like you just didn't configure your transparent color that you chose in your images correctly. Generally one color is used to specify the transparency. Then when you create your convpng.ini file, simply add the #TranspColor line to tell it what color to treat as transparent Smile The format is:


Code:
#TranspColor : r,g,b,255


Where r,g,b are the color values used in the transparent color.

https://github.com/CE-Programming/toolchain/wiki/GraphX-Library:-Creating-sprites
Thank you for your patients.
So, I am trying to use partial redraw.
I am using the following code: pastebin.com/26dWdRcq
blank is a 32 x 32 white image and ubuntu is my sprite I want to move.
I get the error:
"(27,36) : ERROR (100) Syntax error make: *** [obj/main.obj] Error -1"
Can you please help me?
Be sure you update to the latest toolchain! Very Happy

Anywho, looks like fine to me; try recompiling with 'make -B'
Never mind, I fixed it. Thanks, updating it worked.[/code]
So, I have a new question now:
How do I slow down my sprite's movement?
Thank you again for answering my questions
You can add a simple delay using the delay(milliseconds) function Smile Or you can simply handle the movement every other loop or something.
Or you can make your increment of movement smaller (if you increase by 4 each loop try making that 1) and if that doesn't help then do what mateo said.
Okay, thank you both
So I have a new question now. I am trying to add mario-like jumping mechanics but I can't (player can shift left or right while jumping). My code's logic is like this:

https://pastebin.com/EFJ2aqwC
I have never coded like this without Unity's physics so I have no clue how to.
But the calculator doesn't recognize I am pressing both right and jump, so it only goes up.
Again, sorry for wasting your time.

Edit: Also, is there a way to tell if the player is holding down a button (and for how long they are holding it)?
I think so, as Oiram CE has a sprint fuctionality.
So I am trying to make a timer for my game. I have looked at the 3 example codes that are in the tool chain but I still can't get it to work. I am trying to make a function that starts recording the amount of time that has passed since the time it was called. I need this to program acceleration in my player's jump. Can someone please explain how I could do this? Again I have looked at the example codes in the tool chain but still do not understand it.
You have 3 steps: turn off the timer, reload it, and turn it on (again). You can do that with this code:

Code:
    timer_Control = TIMER1_DISABLE;       // Turns timer 1 off
    timer_1_ReloadValue = timer_1_Counter = 0;      // Reset both the counter value and the reload value
    timer_Control = TIMER1_ENABLE | TIMER1_32K | TIMER1_NOINT | TIMER1_UP;      // Enable the timer, set it to the crystal clock (you can use TIMER1_CPU as well for the CPU clock = 48MHz), and count up

Now, the timer is running. You can read the value with

Code:
timer_Control = TIMER1_DISABLE;     // Don't run while we read it!
timer_1_Counter....

You might need a little bit more, but I'm not experienced enough with timers, so someone else might help you Smile
PT_ is indeed correct; that is how the timer can be configured. However, using a timer to control a players jump time is not the best of ideas. It may be better to instead use a constant gravity acceleration which is always applied and then add an initial velocity in the opposite direction. No need for working with timers.
Okay, thank you both.
But I don't @Mateo, I don't understand what you mean by not using time to use acceleration. Don't I need to keep track of seconds past to allow my player to gain momentum when jumping/falling? Don't I need to change the initial velocity over time? I always used something like:

Velocity += (Acceleration * secondsPassed);

Can you please explain what you mean more?
Bump

I am also using the gfx_PrintStringXY(string, x, y);
It works fine when I use it in the beginning but it stops working after I call these two:

gfx_SetPalette(logo_gfx_pal, sizeof logo_gfx_pal, 0);
gfx_SetDrawBuffer();

How am I supposed to use the gfx_PrintStringXY() once I call those functions?? I have tried all the combinations I could think of but the text always become unreadable.
Define "unreadable." And code and/or a screenshot would be nice.
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 2
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement